AGENT SKILL

obsidian-observability

Set up comprehensive logging and monitoring for Obsidian plugins. Use when implementing debug logging, tracking plugin performance, or setting up error reporting for your Obsidian plugin. Trigger with phrases like "obsidian logging", "obsidian monitoring", "obsidian debug", "track obsidian plugin".

License 许可
MIT
最近更新
2026-05-26
Stars
★ 0
Forks
0

01 前言 Front Matter

name
obsidian-observability
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
version
1.0.0
description
Set up comprehensive logging and monitoring for Obsidian plugins. Use when implementing debug logging, tracking plugin performance, or setting up error reporting for your Obsidian plugin. Trigger with phrases like "obsidian logging", "obsidian monitoring", "obsidian debug", "track obsidian plugin".
allowed-tools
Read, Write, Edit
compatible-with
claude-code, codex, openclaw

02 资源文件 1

03 SKILL.md 正文

Obsidian Observability

Contents

Overview

Implement comprehensive logging, metrics collection, error tracking, and a debug panel for Obsidian plugins.

Prerequisites

  • Working Obsidian plugin
  • Understanding of Developer Tools
  • Basic TypeScript knowledge

Key Metrics

Metric Type Purpose
Command execution time Timer Performance tracking
File operations count Counter Usage patterns
Error rate Counter Reliability
Cache hit ratio Gauge Efficiency
Memory usage Gauge Resource health

Instructions

Step 1: Add Structured Logger

Create a Logger class with levels (debug/info/warn/error), history buffer, formatted output, and timing helpers.

Step 2: Implement Metrics Collection

Build MetricsCollector with counters, gauges, and timers. Add timeAsync() wrapper for measuring function duration with percentile stats (p95).

Step 3: Set Up Error Tracking

Create ErrorTracker that deduplicates errors by name+message, counts occurrences, and provides wrapAsync() for safe error capture.

Step 4: Build Debug Panel View

Register a sidebar view (dev mode only) that auto-refreshes every 5 seconds showing counters, timer stats, recent errors, and log history. Add export button for downloadable JSON debug bundle.

Step 5: Integrate in Main Plugin

Initialize logger, metrics, and error tracker in onload(). Wrap commands with metrics timing. Track command usage with counters.

See detailed implementation for complete Logger, MetricsCollector, ErrorTracker, DebugView classes and CSS styles.

Output

  • Structured logger with levels and history
  • Metrics collection (counters, gauges, timers with p95)
  • Error tracking with deduplication
  • Debug panel for runtime inspection
  • Exportable debug bundle for support

Error Handling

Issue Cause Solution
Too much logging Debug level in prod Set level to 'error' in production
Memory growth Unbounded history Limit history to 100 entries
Performance impact Sync logging Use async patterns for file logging
Missing context No error tracking Wrap async calls with errorTracker

Examples

Quick Timing Check

const endTimer = logger.time('my-operation');
await doExpensiveWork();
endTimer(); // Logs: [plugin-id] my-operation (245.32ms)

Resources

Next Steps

For incident response, see obsidian-incident-runbook.

04 同仓库更多 Skills

SamuelChien
SamuelChien/mega-skills-collection

zustand-store-ts

Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state/action separation. Use when building React state management, creating global stores, or implementing reactive state patterns with Zustand.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zustand-store-creator

Zustand Store Creator - Auto-activating skill for Frontend Development. Triggers on: zustand store creator, zustand store creator Part of the Frontend Development skill category.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zero-trust-config-helper

Zero Trust Config Helper - Auto-activating skill for Security Advanced. Triggers on: zero trust config helper, zero trust config helper Part of the Security Advanced skill category.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zapier-integration-helper

Zapier Integration Helper - Auto-activating skill for Business Automation. Triggers on: zapier integration helper, zapier integration helper Part of the Business Automation skill category.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zai-cli

Execute z.AI CLI providing vision, search, reader, and GitHub exploration via CLI and MCP. Use when user needs image/video analysis, OCR, UI-to-code conversion, error diagnosis, real-time web search, web page to markdown extraction, or GitHub code exploration. Trigger with phrases like "analyze this image", "search the web for", "read this page", "explore this repo", or "use zai". Requires Z_AI_API_KEY.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

yt-research

Research competitor YouTube channels, niches, and trending topics for your content strategy. Use this skill whenever the user says "research channels", "analyze competitors", "find trending topics", "niche analysis", "competitive research", "what are other creators doing", "scrape YouTube channels", or wants to understand the competitive landscape for a specific tool or topic area. Use when working with yt research. Trigger with 'yt', 'research'.

★ 0