| name | cohere-observability |
| description | Set up comprehensive observability for Cohere API v2 with metrics, traces, and alerts.
Use when implementing monitoring for Chat/Embed/Rerank operations,
setting up dashboards, or configuring alerts for Cohere integrations.
Trigger with phrases like "cohere monitoring", "cohere metrics",
"cohere observability", "monitor cohere", "cohere alerts", "cohere tracing".
|
| allowed-tools | Read, Write, Edit |
| version | 1.5.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","ai","nlp","cohere"] |
| compatibility | Designed for Claude Code |
Cohere Observability
Overview
Set up production observability for Cohere API v2 with Prometheus metrics, OpenTelemetry tracing, and AlertManager rules. Tracks per-endpoint latency, token usage, error rates, and costs.
Prerequisites
- Prometheus or compatible metrics backend
- OpenTelemetry SDK installed
cohere-ai SDK v7+
Instructions
Step 1: Metrics Collection
import { Registry, Counter, Histogram, Gauge } from 'prom-client';
const registry = new Registry();
const requestCounter = new Counter({
name: 'cohere_requests_total',
help: 'Total Cohere API requests',
labelNames: ['endpoint', 'model', 'status'],
registers: [registry],
});
const requestDuration = new Histogram({
name: 'cohere_request_duration_seconds',
help: 'Cohere request duration',
labelNames: ['endpoint', 'model'],
buckets: [0.1, 0.25, 0.5, 1, 2.5, 5, 10, ],
: [registry],
});
tokenCounter = ({
: ,
: ,
: [, , ],
: [registry],
});
errorCounter = ({
: ,
: ,
: [, ],
: [registry],
});
rateLimitGauge = ({
: ,
: ,
: [],
: [registry],
});