anth-observability

Featured

Set up observability for Claude API integrations with metrics, logging, and alerting for latency, cost, errors, and token usage. Trigger with phrases like "anthropic monitoring", "claude observability", "anthropic metrics", "track claude usage", "claude dashboard".

AI & Automation 2,944 stars 440 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Anthropic Observability ## Overview Instrument Claude API calls with structured logging, Prometheus metrics, and cost tracking. Every API response includes `usage` data and rate limit headers — capture these for dashboards and alerting. ## Structured Logging ```python import anthropic import logging import time import json logger = logging.getLogger("claude") def create_with_logging(client: anthropic.Anthropic, **kwargs) -> anthropic.types.Message: start = time.monotonic() request_meta = { "model": kwargs.get("model"), "max_tokens": kwargs.get("max_tokens"), "tool_count": len(kwargs.get("tools", [])), "stream": kwargs.get("stream", False), } try: response = client.messages.create(**kwargs) duration_ms = int((time.monotonic() - start) * 1000) logger.info(json.dumps({ "event": "claude.request", "request_id": response._request_id, "model": response.model, "input_tokens": response.usage.input_tokens, "output_tokens": response.usage.output_tokens, "cache_read_tokens": getattr(response.usage, "cache_read_input_tokens", 0), "stop_reason": response.stop_reason, "duration_ms": duration_ms, "content_blocks": len(response.content), })) return response except anthropic.APIStatusError as e: duration_ms = int((time.monotonic() - start) * 1000) logger.error(json.dumps...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category