Skip to content

Add Cohere instrumentation package scaffolding#102

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

Add Cohere instrumentation package scaffolding#102
Nik-Reddy wants to merge 2 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
Contributor

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
Contributor 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
Contributor 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

Status last refreshed: 2026-07-25 12:51:45 UTC.

  • Waiting on: Author
  • Next step: Address or respond to 7 review feedback items:
    • Inline threads: 1, 2, 3, 4, 5, 6
    • Top-level feedback: 7
    • For each item, reply to move the discussion forward, e.g. link to the commit that addresses it, explain why no change is needed, or ask a follow-up question.

This automated status or its linked feedback items may be incorrect. If something looks wrong, please report it with the result you expected. If you believe this pull request is incorrectly routed as waiting on the author, comment /dashboard route:reviewers to route it from waiting on the author to waiting on reviewers. If the last refreshed time above predates your latest reply or push, the dashboard hasn't processed it yet.

@Nik-Reddy
Nik-Reddy force-pushed the feat/cohere-instrumentation-scaffold branch from 2d1208f to f3eebde Compare July 20, 2026 21:00
@Nik-Reddy
Nik-Reddy force-pushed the feat/cohere-instrumentation-scaffold branch from 5b5dfd0 to e7ce546 Compare July 21, 2026 05:01
@Nik-Reddy

Copy link
Copy Markdown
Contributor 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.

OTEL_SERVICE_NAME=opentelemetry-python-cohere

# Change to 'false' to hide prompt and completion content
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true

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.

this is an old value which is no longer supported

# OTEL_LOGS_EXPORTER=console

# Change to 'false' to hide prompt and completion content
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true

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.

same here

# OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
# OTEL_EXPORTER_OTLP_PROTOCOL=grpc

OTEL_SERVICE_NAME=opentelemetry-python-cohere

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.

Suggested change
OTEL_SERVICE_NAME=opentelemetry-python-cohere
OTEL_SERVICE_NAME=cohere-zero-code

handler = TelemetryHandler(
tracer_provider=tracer_provider,
meter_provider=meter_provider,
logger_provider=logger_provider,

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.

please pass completion_hook, check out openai as an example

# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

__version__ = "1.0b0.dev"

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.

Suggested change
__version__ = "1.0b0.dev"
__version__ = "1.1b0.dev"

to match global version in this repo

Comment thread eachdist.ini
# Packages the release workflows may publish (eachdist.py list-release-packages).
packages=
opentelemetry-instrumentation-genai-anthropic
opentelemetry-instrumentation-genai-cohere

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.

it should not be included into the list of releasable packages until there is some real instrumentation

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants