notion-observability
Set up observability for Notion integrations with metrics, traces, and alerts. Use when implementing monitoring for Notion API calls, setting up dashboards, or configuring alerting for Notion integration health. Trigger with phrases like "notion monitoring", "notion metrics", "notion observability", "monitor notion", "notion alerts", "notion tracing".
What this skill does
# Notion Observability
## Overview
Instrument Notion API calls with metrics, structured logging, and alerting. Track request rates, latencies, error rates, and rate limit headroom. This skill covers a full observability stack: an instrumented client wrapper, Prometheus metrics with histogram buckets tuned for Notion's typical 200-800ms latency, structured logging via pino, health check endpoints, and Prometheus alerting rules for error rate spikes, rate limit exhaustion, high latency, and service outages.
## 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)
## Instructions
### Step 1: Instrumented Notion Client Wrapper
Wrap every Notion API call with timing, error classification, and structured logging:
```typescript
import { Client, isNotionClientError, APIErrorCode } from '@notionhq/client';
interface NotionMetrics {
requestCount: number;
errorCount: number;
rateLimitCount: number;
totalLatencyMs: number;
latencyBuckets: Map<string, number[]>;
lastError: { code: string; message: string; timestamp: string } | null;
}
class InstrumentedNotionClient {
private client: Client;
private metrics: NotionMetrics = {
requestCount: 0,
errorCount: 0,
rateLimitCount: 0,
totalLatencyMs: 0,
latencyBuckets: new Map(),
lastError: null,
};
constructor(auth: string, timeoutMs = 30_000) {
this.client = new Client({ auth, timeoutMs });
}
async call<T>(operation: string, fn: (client: Client) => Promise<T>): Promise<T> {
const start = performance.now();
this.metrics.requestCount++;
try {
const result = await fn(this.client);
const durationMs = Math.round(performance.now() - start);
this.metrics.totalLatencyMs += durationMs;
this.recordLatency(operation, durationMs);
console.log(JSON.stringify({
level: 'info',
service: 'notion',
operation,
durationMs,
status: 'ok',
timestamp: new Date().toISOString(),
}));
return result;
} catch (error) {
const durationMs = Math.round(performance.now() - start);
this.metrics.totalLatencyMs += durationMs;
this.metrics.errorCount++;
this.recordLatency(operation, durationMs);
let errorInfo: { code: string; message: string; status: number };
if (isNotionClientError(error)) {
errorInfo = { code: error.code, message: error.message, status: error.status };
if (error.code === APIErrorCode.RateLimited) {
this.metrics.rateLimitCount++;
}
} else {
errorInfo = { code: 'unknown', message: String(error), status: 0 };
}
this.metrics.lastError = {
code: errorInfo.code,
message: errorInfo.message,
timestamp: new Date().toISOString(),
};
console.log(JSON.stringify({
level: 'error',
service: 'notion',
operation,
durationMs,
status: 'error',
errorCode: errorInfo.code,
httpStatus: errorInfo.status,
message: errorInfo.message,
timestamp: new Date().toISOString(),
}));
throw error;
}
}
private recordLatency(operation: string, durationMs: number) {
const existing = this.metrics.latencyBuckets.get(operation) || [];
existing.push(durationMs);
this.metrics.latencyBuckets.set(operation, existing);
}
getMetrics(): NotionMetrics & { avgLatencyMs: number; p95LatencyMs: number } {
const allLatencies = Array.from(this.metrics.latencyBuckets.values()).flat().sort((a, b) => a - b);
const p95Index = Math.floor(allLatencies.length * 0.95);
return {
...this.metrics,
avgLatencyMs: this.metrics.requestCount > 0
? Math.round(this.metrics.totalLatencyMs / this.metrics.requestCount)
: 0,
p95LatencyMs: allLatencies[p95Index] ?? 0,
};
}
}
// Usage
const notion = new InstrumentedNotionClient(process.env.NOTION_TOKEN!);
const pages = await notion.call('databases.query', (client) =>
client.databases.query({ database_id: dbId, page_size: 50 })
);
const user = await notion.call('users.me', (client) =>
client.users.me({})
);
```
**Python — instrumented wrapper:**
```python
import time
import json
import logging
from notion_client import Client, APIResponseError
logger = logging.getLogger("notion")
class InstrumentedNotion:
def __init__(self, token: str):
self.client = Client(auth=token, timeout_ms=30_000)
self.request_count = 0
self.error_count = 0
self.rate_limit_count = 0
self.total_latency_ms = 0.0
def call(self, operation: str, fn):
start = time.monotonic()
self.request_count += 1
try:
result = fn(self.client)
duration_ms = round((time.monotonic() - start) * 1000)
self.total_latency_ms += duration_ms
logger.info(json.dumps({
"service": "notion", "operation": operation,
"duration_ms": duration_ms, "status": "ok",
}))
return result
except APIResponseError as e:
duration_ms = round((time.monotonic() - start) * 1000)
self.total_latency_ms += duration_ms
self.error_count += 1
if e.status == 429:
self.rate_limit_count += 1
logger.error(json.dumps({
"service": "notion", "operation": operation,
"duration_ms": duration_ms, "status": "error",
"error_code": e.code, "http_status": e.status,
}))
raise
# Usage
notion = InstrumentedNotion(os.environ["NOTION_TOKEN"])
pages = notion.call("databases.query",
lambda c: c.databases.query(database_id=db_id, page_size=50))
```
### Step 2: Prometheus Metrics Export
```typescript
import { Registry, Counter, Histogram, Gauge } from 'prom-client';
const registry = new Registry();
const notionRequests = new Counter({
name: 'notion_requests_total',
help: 'Total Notion API requests',
labelNames: ['operation', 'status'],
registers: [registry],
});
const notionDuration = new Histogram({
name: 'notion_request_duration_seconds',
help: 'Notion API request latency in seconds',
labelNames: ['operation'],
// Buckets tuned for Notion's typical 200-800ms response times
buckets: [0.1, 0.25, 0.5, 0.8, 1, 2, 5, 10],
registers: [registry],
});
const notionErrors = new Counter({
name: 'notion_errors_total',
help: 'Notion API errors by error code',
labelNames: ['code'],
registers: [registry],
});
const notionRateLimitRemaining = new Gauge({
name: 'notion_rate_limit_remaining',
help: 'Estimated remaining rate limit headroom',
registers: [registry],
});
// Wrap every Notion call with Prometheus instrumentation
async function instrumentedCall<T>(
operation: string,
fn: () => Promise<T>
): Promise<T> {
const timer = notionDuration.startTimer({ operation });
try {
const result = await fn();
notionRequests.inc({ operation, status: 'success' });
return result;
} catch (error) {
notionRequests.inc({ operation, status: 'error' });
if (isNotionClientError(error)) {
notionErrors.inc({ code: error.code });
}
throw error;
} finally {
timer();
}
}
// Expose /metrics endpoint for Prometheus scraping
app.get('/metrics', async (_req, res) => {
res.set('Content-Type', registry.contentType);
res.send(await registry.metrics());
});
```
### Step 3: Health Check, Structured Logging, and Alerting
**Health check endpoint:**
```typescript
app.get('/health/notion', async (_req, res) => {
const checks: Record<string, any> = {};
// Test Notion API connectivity
const start = Date.now();
try {
const me = await notion.call('health.users.meRelated in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.