agentsclimarketplace

Notion observability

Skill jeremylongshore/claude-code-plugins-plus-skills/skills/.curated/notion-observability

425 plugins, 2,810 skills, 200 agents for Claude Code. Open-source marketplace at tonsofskills.com with the ccpi CLI package manager.

Install
npx -y skills add jeremylongshore/claude-code-plugins-plus-skills --skill notion-observability

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

'Set up observability for Notion integrations with metrics, traces, and alerts.

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

5.9 KB, as published. Nobody here has run it

Notion Observability

Overview

Instrument Notion API calls with metrics, structured logging, and alerting. Track request rates, latencies, error rates, and rate limit headroom across a full observability stack: an instrumented client wrapper, Prometheus metrics, structured logging via pino, health check endpoints, and alerting rules.

Prerequisites

  • @notionhq/client v2+ installed (npm install @notionhq/client)
  • Python alternative: notion-client (pip install notion-client)
  • Prometheus-compatible metrics backend (optional: Grafana, Datadog, or CloudWatch)
  • Structured logging library: pino (Node.js) or structlog (Python)

Authentication

All snippets read the integration token from the NOTION_TOKEN environment variable (never hard-code it) and pass it as auth to the Notion client constructor. Store it in your secret manager and inject it at runtime. The health check and metrics endpoints below expose no secrets — only aggregate counters and status.

Instructions

The workflow layers three pieces. Build them in order; each is self-contained. Full code for every step lives in references/implementation.md.

Step 1: Instrumented client wrapper

Wrap every Notion call so timing, error classification, rate-limit detection, and structured logging happen automatically. The wrapper accumulates per-operation latency buckets and exposes getMetrics() for avg/p95. Skeleton:

class InstrumentedNotionClient {
  async call<T>(operation: string, fn: (c: Client) => Promise<T>): Promise<T> {
    const start = performance.now();
    try {
      const result = await fn(this.client);
      this.recordLatency(operation, Math.round(performance.now() - start));
      return result;
    } catch (error) {
      if (isNotionClientError(error) && error.code === APIErrorCode.RateLimited) {
        this.metrics.rateLimitCount++;
      }
      throw error;
    }
  }
}

A Python (notion-client) equivalent is in the reference. Full TypeScript + Python wrappers: references/implementation.md (Step 1).

Step 2: Prometheus metrics export

Register a request counter, a latency histogram (buckets tuned for Notion's typical 200-800ms responses), an error counter keyed by error code, and a rate-limit gauge. Wrap calls with startTimer() and expose a /metrics endpoint for scraping. Full export code: references/implementation.md (Step 2).

Step 3: Health check, structured logging, and alerting

Add a /health/notion endpoint that probes users.me and returns 200/503 with aggregate metrics, wire pino for JSON logs with slow-query warnings (>2s), and ship Prometheus alerting rules for error-rate spikes, rate-limit exhaustion, high P95 latency, and outages. Full endpoint, logger, and alert rules: references/implementation.md (Step 3).

Output

  • Instrumented Notion client tracking all API calls with per-operation latency buckets
  • Prometheus metrics for request rate, latency histograms, and error counters
  • Structured JSON logging via pino with slow-query warnings (>2s)
  • Health check endpoint with Notion connectivity status and aggregate metrics
  • Alerting rules for error rate spikes, rate limiting, high latency, and outages

Error Handling

IssueCauseSolution
High cardinality metricsToo many unique label valuesUse fixed operation names (databases.query, pages.create)
Alert storms on Notion outageAll alerts fire simultaneouslyAdd group_wait: 30s in alertmanager config
Missing metrics for some callsNot all API calls use wrapperEnforce wrapper at architecture level
Log volume too high in prodDEBUG level enabledSet LOG_LEVEL=info or warn in production
P95 latency unreliableToo few samplesEnsure minimum 100 requests in window
Rate limit counter never firesWrong error code checkUse APIErrorCode.RateLimited constant

Examples

Ready-to-run PromQL dashboard queries and a no-Prometheus inline console metrics snippet live in references/examples.md. Quickest smoke test — error percentage in PromQL:

100 * rate(notion_errors_total[5m]) / rate(notion_requests_total[5m])

Resources

Next Steps

For incident response procedures when monitoring detects failures, see the notion-incident-runbook skill. Once metrics flow, build a Grafana dashboard from the PromQL queries in references/examples.md and tune alert thresholds to your traffic baseline.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.