Add instrumentation for Cohere (cohere-ai)

Open
#24,490 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
68/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
node.js, typescript

Research direction

Start with packages/server-utils/src/ai/cohere/ and src/integrations/cohere.ts, then inspect the existing mistral and anthropic integrations for structure and registration through getTracingIntegrations(). Instrument CohereClientV2 and CohereClient chat(), chatStream(), embed(), and rerank(), including streaming, with the listed gen_ai attributes and token usage; done means native Cohere coverage is available through the runtime re-exports.

Written by the indexing model from the issue text.

Description

Feature javascript Node.js Spans

Add native gen-AI instrumentation for the Cohere Node SDK, cohere-ai (repo).

Coverage status

  • @ai-sdk/cohere (Vercel AI SDK provider, ~3.2M/mo) is already covered by proxy through our vercel-ai integration.
  • The native cohere-ai SDK is not covered. This issue tracks that path.

Relevance (npm)

  • cohere-ai: ~1.9M downloads/month (~20.3M last year) — roughly flat-to-modest growth. Cohere is a notable enterprise/RAG-focused provider (chat, embeddings, and rerank), and rerank in particular has no equivalent in the providers we instrument today.

Rough scope

  • Add instrumentation logic under packages/server-utils/src/ai/cohere/ and wire it up via src/integrations/cohere.ts, registered in getTracingIntegrations(); runtime packages re-export from @sentry/server-utils.
  • Instrument CohereClientV2 (and legacy CohereClient): chat() / chatStream(), embed(), and rerank(), including streaming.
  • Emit gen_ai.* spans per the span attribute conventions (gen_ai.provider.name = cohere, request/response model, token usage, finish reasons).
  • Cohere is not OpenAI wire-compatible, so it needs bespoke instrumentation (like mistral/anthropic), not the openai-compatible shim.
Dominant language
TypeScript
Stars
8.7k
Forks
1.9k
Avg merge
1d 18h
Merged PRs (30d)
543

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from getsentry/sentry-javascript

All issues in getsentry/sentry-javascript

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.