Skip to content

Add Cohere instrumentation package scaffolding - #102

Open
Nik-Reddy wants to merge 3 commits into
open-telemetry:mainfrom
Nik-Reddy:feat/cohere-instrumentation-scaffold
Open

Nik-Reddy wants to merge 3 commits into
open-telemetry:mainfrom
Nik-Reddy:feat/cohere-instrumentation-scaffold

Conversation

@Nik-Reddy

@Nik-Reddy Nik-Reddy commented May 31, 2026

Copy link
Copy Markdown
Member

Description

Adds a scaffold-only Cohere V2 instrumentation package as PR 1 of 4 tracked in #56. The CohereInstrumentor sets up tracer, logger, and meter providers but does not yet wrap any Cohere client methods.

Ported from open-telemetry/opentelemetry-python-contrib#4418, adapted to the new-repo conventions:

  • Package name: opentelemetry-instrumentation-genai-cohere
  • Import path: opentelemetry.instrumentation.genai.cohere
  • Class: CohereInstrumentor
  • Cohere SDK floor: cohere >= 5.13.0 (V2 GA floor; 5.0.0 lacks ClientV2)
  • Python: 3.10, 3.11, 3.12, 3.13, 3.14
  • OTel pins: opentelemetry-api ~= 1.40, opentelemetry-instrumentation ~= 0.61b0, opentelemetry-semantic-conventions ~= 0.61b0, opentelemetry-util-genai >= 1.0b0.dev

This mirrors the opentelemetry-instrumentation-genai-claude-agent-sdk scaffold shape.

Scope

  • New package skeleton (src/, tests/, examples/, pyproject.toml, README.rst, LICENSE)
  • 7 smoke tests covering instantiation, dependency reporting, instrument/uninstrument cycle, idempotent calls, no-provider fallback, and required-attribute presence
  • Workspace registration: root pyproject.toml, tox.ini, eachdist.ini, uv.lock, and regenerated instrumentation/README.md
  • Example placeholders (examples/manual and examples/zero-code) with explicit scaffold disclaimers per Cohere V2 instrumentation: continue scaffold + chat completions from my previous work opentelemetry-python-contrib#4418 #56
  • Towncrier changelog fragment (.changelog/102.added)

Not in this PR (follow-ups per #56)

  • PR 2: chat completions instrumentation (sync, async, non-streaming)
  • PR 3: streaming
  • PR 4: conformance tests

Validation

  • uv lock succeeds; cohere v7.0.2 added with transitive deps
  • tox -e generate regenerates instrumentation/README.md with the cohere row alphabetically inserted
  • uv run ruff check instrumentation/opentelemetry-instrumentation-genai-cohere/ passes
  • pytest passes 7/7 on both latest and oldest dep sets across the full Python 3.10-3.14 matrix

Closes part of #56.

Copilot AI review requested due to automatic review settings May 31, 2026 09:25
@Nik-Reddy
Nik-Reddy requested a review from a team as a code owner May 31, 2026 09:25
@Nik-Reddy
Nik-Reddy force-pushed the feat/cohere-instrumentation-scaffold branch 3 times, most recently from 89a48ed to 856791f Compare May 31, 2026 09:42
@Nik-Reddy
Nik-Reddy force-pushed the feat/cohere-instrumentation-scaffold branch from 59dbfec to a437ffe Compare June 7, 2026 17:53
@Nik-Reddy

Copy link
Copy Markdown
Member Author

@lzchen PR is rebased and all checks are passing now. Could you please merge it when you get a chance? Thanks!

@lzchen

lzchen commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Hi @Nik-Reddy , will have to wait for a maintainer to merge.

@Nik-Reddy
Nik-Reddy force-pushed the feat/cohere-instrumentation-scaffold branch from a437ffe to 9515baf Compare June 8, 2026 22:28
@Nik-Reddy

Copy link
Copy Markdown
Member Author

@lmolkova all checks are passing. This is the scaffold-only Cohere package PR from the roadmap in #56.

Could you please take a look when you get a chance? Thanks!

@Nik-Reddy
Nik-Reddy force-pushed the feat/cohere-instrumentation-scaffold branch 2 times, most recently from 86218c5 to 8e48615 Compare June 14, 2026 09:07
@eternalcuriouslearner

Copy link
Copy Markdown
Contributor

@lmolkova I am thinking we can use openinference for adding instrumentation coverage for cohere. wdyt?

@lmolkova

lmolkova commented Jun 26, 2026

Copy link
Copy Markdown
Member

@lmolkova I am thinking we can use openinference for adding instrumentation coverage for cohere. wdyt?

it doesn't seem like they have instrumentation for it

@github-actions

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 days of this comment.
If you're still working on this, please add a comment or push new commits.

@github-actions github-actions Bot added the Stale Issue or PR has been inactive label Jul 15, 2026
@Nik-Reddy
Nik-Reddy force-pushed the feat/cohere-instrumentation-scaffold branch from be60e6a to 2d1208f Compare July 17, 2026 17:22
@github-actions github-actions Bot removed the Stale Issue or PR has been inactive label Jul 18, 2026
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Jul 18, 2026

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-09-21 18:32 UTC

Respond to 1 review item (e.g. link a commit, explain why not, ask a follow-up):

  • Top-level threads: 1
Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Should this be with reviewers? Comment /dashboard route:reviewers to route it to them.
  • Anything wrong — including the routing? Report it with what you expected; it helps us improve the dashboard.

@Nik-Reddy
Nik-Reddy force-pushed the feat/cohere-instrumentation-scaffold branch 2 times, most recently from 5b5dfd0 to e7ce546 Compare July 21, 2026 05:01
@Nik-Reddy

Copy link
Copy Markdown
Member Author

@lmolkova @lzchen Rebased onto main and addressed all review feedback:

  • Replaced manual tracer/logger/meter with TelemetryHandler
  • Fixed the docstring
  • Removed unrelated google-genai cassette files

@lmolkova lmolkova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more comments.

The key question, @Nik-Reddy are you going to follow up with real instrumentation right away? We already have a couple of empty instrumentations in this repo and unless you'd like to work on actual cohere instrumentation, I would prefer to not add another one.

Comment thread instrumentation/opentelemetry-instrumentation-genai-cohere/examples/manual/.env Outdated
Comment thread eachdist.ini Outdated
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Jul 29, 2026

Copy link
Copy Markdown

Hi @Nik-Reddy — just a friendly reminder that this pull request is waiting on you. The dashboard status comment has the open items and is kept current.

  • Replying is enough to hand it off — answer, explain why no change is needed, or ask a follow-up. The dashboard routes it onward once nothing on the list is waiting on you.
  • To hand it back for any other reason, including the dashboard getting this wrong, comment /dashboard route:reviewers.

@Nik-Reddy

Copy link
Copy Markdown
Member Author

@lmolkova Yes, I'm committed to following up with the actual instrumentation right after #102 lands. The plan (laid out in #56) is:

  • PR 2: Chat completions (sync + async), wrapping ClientV2.chat and AsyncClientV2.chat with TelemetryHandler, full semconv attributes, content capture, error handling. This is ready to go on my end.
  • PR 3: Streaming support for chat_stream (sync + async), building on the streaming helpers from Add streaming timing metrics to generic stream wrappers #13.
  • PR 4: RAG/citations extraction (blocked on a semconv proposal, will file separately).

Each one lands before the next opens, same as the other provider packages. PR 2 will follow within days of #102 merging.

Happy to rebase and resolve the outstanding review threads so this is merge-ready whenever you get a chance to look.

@Nik-Reddy
Nik-Reddy force-pushed the feat/cohere-instrumentation-scaffold branch 4 times, most recently from dd0888d to 7c1551a Compare August 17, 2026 04:53
Adds a scaffold-only Cohere V2 instrumentation package as PR 1 of 4
tracked in open-telemetry#56. The CohereInstrumentor sets up TelemetryHandler with
completion_hook support but does not yet wrap any Cohere client methods.

Package: opentelemetry-instrumentation-genai-cohere
Import: opentelemetry.instrumentation.genai.cohere
Class: CohereInstrumentor
Cohere SDK floor: cohere >= 5.13.0 (V2 GA)
Python: 3.10, 3.11, 3.12, 3.13, 3.14

Scope:
- New package skeleton (src/, tests/, examples/, pyproject.toml, README.rst)
- Smoke tests covering instantiation, dependency reporting, instrument/
  uninstrument cycle, idempotent calls, no-provider fallback
- Workspace registration: root pyproject.toml, tox.ini, eachdist.ini, uv.lock
- Example placeholders (manual and zero-code)
- Towncrier changelog fragment (.changelog/102.added)
- TelemetryHandler with completion_hook following openai instrumentor pattern
- Version set to 1.1b0.dev matching global repo version
- Not included in release_packages until real instrumentation lands

Not in this PR (follow-ups per open-telemetry#56):
- PR 2: chat completions instrumentation (sync, async, non-streaming)
- PR 3: streaming
- PR 4: conformance tests
@Nik-Reddy
Nik-Reddy force-pushed the feat/cohere-instrumentation-scaffold branch from 7c1551a to 955bf10 Compare August 17, 2026 07:14
Resolved conflicts in README.md, pyproject.toml, tox.ini, and uv.lock
from upstream package additions (dspy, portkey). Regenerated
README.md and uv.lock from source instead of hand-editing generated
output.
@Nik-Reddy
Nik-Reddy force-pushed the feat/cohere-instrumentation-scaffold branch from 412b76d to 8dae262 Compare August 27, 2026 08:39
@github-actions

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 days of this comment.
If you're still working on this, please add a comment or push new commits.

@github-actions github-actions Bot added the Stale Issue or PR has been inactive label Sep 17, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Stale Issue or PR has been inactive

Development

Successfully merging this pull request may close these issues.

4 participants