Skip to content

Commit a2a0448

Browse files
committed
update google-genai and vertext, deprecate all instr-genai here
1 parent 7ca2474 commit a2a0448

11 files changed

Lines changed: 70 additions & 191 deletions

File tree

.github/instructions/instrumentation-genai.instructions.md

Lines changed: 9 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,65 +2,14 @@
22
applyTo: "instrumentation-genai/**"
33
---
44

5-
Review rules for PRs touching `instrumentation-genai/**`. Flag violations with a link to the rule.
5+
Review rules for PRs touching `instrumentation-genai/**`.
66

7-
These rules are additive to
8-
[`instrumentation.instructions.md`](instrumentation.instructions.md), which applies to all
9-
instrumentation packages.
7+
GenAI instrumentations are no longer developed in this repository. They live in
8+
[opentelemetry-python-genai](https://github.com/open-telemetry/opentelemetry-python-genai),
9+
which is where new instrumentations, features, and bug fixes go. Everything left under
10+
`instrumentation-genai/` is deprecated, receives security patches only, and will be removed from
11+
this repository in the future.
1012

11-
## 1. Scope of `instrumentation-genai/`
12-
13-
Only for:
14-
15-
- Generative AI inference providers,
16-
- Agentic frameworks,
17-
- Libraries directly supporting the above (e.g., MCP, GenAI protocols).
18-
19-
Database clients (including vector DBs used outside a GenAI-specific client) and CLI libs belong
20-
in `instrumentation/`, not here.
21-
22-
## 2. GenAI component ownership
23-
24-
See [`CONTRIBUTING.md#guideline-for-genai-instrumentations`](../../CONTRIBUTING.md#guideline-for-genai-instrumentations)
25-
for GenAI-specific maintenance expectations on top of the general
26-
[instrumentation checklist](../../CONTRIBUTING.md#guideline-for-instrumentations).
27-
28-
## 3. Telemetry and configuration via `opentelemetry-util-genai`
29-
30-
- Spans, logs, metrics, and events must go through `opentelemetry-util-genai`. Direct use of
31-
`Tracer`, `Meter`, `Logger`, or event APIs is not allowed.
32-
- Content capture, hooks, and other cross-cutting configuration are owned by the util.
33-
Instrumentations must not introduce their own env vars, settings, or hook interfaces.
34-
- Message content, prompts, and tool call arguments must only be set through the util's content
35-
capture path — never as unconditional span/log attributes.
36-
- Adding attributes to invocations produced by the util is fine.
37-
- If a capability is missing in `opentelemetry-util-genai`, land it in the util first.
38-
39-
## 4. GenAI semantic conventions
40-
41-
- Attributes, spans, events, and metrics must match the
42-
[GenAI semantic conventions](https://github.com/open-telemetry/semantic-conventions/tree/main/docs/gen-ai).
43-
- `gen_ai.*` attribute names must come from
44-
`opentelemetry.semconv._incubating.attributes.gen_ai_attributes`.
45-
- For attributes with a well-known value set, use the generated enum from the same module
46-
(e.g. `GenAiOutputTypeValues` for `gen_ai.output.type`) instead of string literals.
47-
48-
## 5. Tests
49-
50-
- Use recorded VCR cassettes for provider calls. No live-key-only tests; skipping on missing key
51-
is not acceptable.
52-
- Cover streaming and non-streaming variants when both exist.
53-
- For error scenarios, at minimum include: provider error / endpoint unavailable, stream
54-
interrupted by network, stream closed early by the caller.
55-
56-
## 6. Examples
57-
58-
New instrumentations must ship a minimal example under the package's `examples/`, with both a
59-
`manual/` and a `zero-code/` (auto-instrumentation) variant.
60-
61-
## 7. PR description
62-
63-
- Cover which part of the GenAI semconv the change implements or follows (when applicable) and
64-
how instrumentations should consume it.
65-
66-
See also [AGENTS.md](../../AGENTS.md) for general repo rules.
13+
Reject PRs that add new instrumentations here, add features, or fix non-security bugs, and point
14+
the author to the `opentelemetry-python-genai` repo. See
15+
[instrumentation-genai/AGENTS.md](../../instrumentation-genai/AGENTS.md).

.github/instructions/instrumentation.instructions.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,18 @@ applyTo: "{instrumentation,instrumentation-genai}/**"
55
Review rules for PRs touching `instrumentation/**` and `instrumentation-genai/**`. Flag violations
66
with a link to the rule.
77

8-
## 0. Reviewer mindset
8+
## 0. GenAI instrumentations maintained elsewhere
9+
10+
GenAI instrumentations are developed and released from the
11+
[opentelemetry-python-genai](https://github.com/open-telemetry/opentelemetry-python-genai)
12+
repository. Everything left under `instrumentation-genai/` here is deprecated, receives security
13+
patches only, and will be removed from this repository in the future.
14+
15+
Reject PRs that add features or fix non-security bugs in these packages and point the author to
16+
the `opentelemetry-python-genai` repo. See
17+
[instrumentation-genai/AGENTS.md](../../instrumentation-genai/AGENTS.md).
18+
19+
## 1. Reviewer mindset
920

1021
Review as long-term maintainer.
1122

@@ -18,15 +29,15 @@ For new instrumentations, consult upstream library docs and judge:
1829
For changes to existing instrumentations: prefer back-compat. Break users only for a real reason;
1930
prefer opt-in or additive. Breaking changes need explicit justification in the PR.
2031

21-
## 1. Component ownership & maintenance commitment
32+
## 2. Component ownership & maintenance commitment
2233

2334
- New instrumentations must add an entry under the correct folder in
2435
[`component_owners.yml`](../component_owners.yml) in the same PR. Contributor must commit to
2536
long-term maintenance. See
2637
[Expectations from contributors](../../CONTRIBUTING.md#expectations-from-contributors) and the
2738
general [instrumentation checklist](../../CONTRIBUTING.md#guideline-for-instrumentations).
2839

29-
## 2. Semantic conventions
40+
## 3. Semantic conventions
3041

3142
- Attribute names must come from the semconv attribute modules, not hardcoded strings. Use the
3243
module matching the namespace under `opentelemetry.semconv` (e.g. `server_attributes`,
@@ -35,13 +46,13 @@ prefer opt-in or additive. Breaking changes need explicit justification in the P
3546
modules instead of string literals.
3647
- If a signal is not in semconv, wait until semconv lands.
3748

38-
## 3. Exception handling
49+
## 4. Exception handling
3950

4051
- When catching exceptions from the underlying library to record telemetry, always re-raise the
4152
original exception unmodified.
4253
- Do not raise **new** exceptions in instrumentation/telemetry code.
4354

44-
## 4. Tests
55+
## 5. Tests
4556

4657
- For every public API instrumented, cover sync/async variants when both exist.
4758
- Cover happy path and error scenarios.

.github/workflows/package-prepare-release.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ on:
1010
- opentelemetry-resource-detector-azure
1111
- opentelemetry-resourcedetector-gcp
1212
- opentelemetry-sdk-extension-aws
13-
- opentelemetry-instrumentation-vertexai
14-
- opentelemetry-instrumentation-google-genai
1513
- opentelemetry-util-genai
1614
description: 'Package to be released'
1715
required: true

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ comment - not in the PR description.
3434
## Structure
3535

3636
- `instrumentation/` - instrumentation packages (Flask, Django, FastAPI, gRPC, databases, etc.)
37-
- `instrumentation-genai/` - GenAI instrumentations (OpenAI, Google GenAI, Vertex AI, etc.)
37+
- `instrumentation-genai/` - GenAI instrumentations; deprecated and no longer developed here, see
38+
[instrumentation-genai/AGENTS.md](instrumentation-genai/AGENTS.md)
3839
- `util/` - shared utilities (`util-http`, `util-genai`)
3940
- `exporter/` - custom exporters
4041
- `propagator/` - context propagators

CONTRIBUTING.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ If you are using AI agents to assist with contributions, please read [AGENTS.md]
4242
- [Guideline for instrumentations](#guideline-for-instrumentations)
4343
- [Update supported instrumentation package versions](#update-supported-instrumentation-package-versions)
4444
- [Guideline for GenAI instrumentations](#guideline-for-genai-instrumentations)
45-
- [Get Involved](#get-involved)
45+
- [Get Involved](#get-involved)
4646
- [Expectations from contributors](#expectations-from-contributors)
4747
- [Guidelines for native OpenTelemetry instrumentation](#guidelines-for-native-opentelemetry-instrumentation)
4848
- [Updating supported Python versions](#updating-supported-python-versions)
@@ -428,15 +428,17 @@ Example PRs: [#2976](https://github.com/open-telemetry/opentelemetry-python-cont
428428

429429
## Guideline for GenAI instrumentations
430430

431-
Instrumentations that relate to [Generative AI](https://opentelemetry.io/docs/specs/semconv/gen-ai/) systems will be placed in the [instrumentation-genai](./instrumentation-genai) folder. This section covers contributions related to those instrumentations. Please note that the [guidelines for instrumentations](#guideline-for-instrumentations) and [expectations from contributors](#expectations-from-contributors) still apply.
431+
[Generative AI](https://opentelemetry.io/docs/specs/semconv/gen-ai/) instrumentations are **no longer developed in this repository**. They live in the [opentelemetry-python-genai](https://github.com/open-telemetry/opentelemetry-python-genai) repository - please contribute new instrumentations, features, bug fixes, and issues there.
432432

433-
### Get Involved
433+
The packages still present in the [instrumentation-genai](./instrumentation-genai) folder are deprecated, receive security patches only, and will be removed from this repository in the future.
434+
435+
## Get Involved
434436

435437
* Reviewing PRs: If you would like to be tagged as reviewer in new PRs related to these instrumentations, please submit a PR to add your GitHub handle to [component_owners.yml](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/.github/component_owners.yml) under the corresponding instrumentation folder(s).
436438

437439
* Approving PRs: If you would like to be able to approve PRs related to these instrumentations, you must join [opentelemetry-python-contrib-approvers](https://github.com/orgs/open-telemetry/teams/opentelemetry-python-contrib-approvers) team. Please ask one of the [Python contrib maintainers](https://github.com/orgs/open-telemetry/teams/opentelemetry-python-contrib-maintainers) to be accepted into the team.
438440

439-
* Tracking and Creating Issues: For tracking issues related to Generative AI, please filter or add the label [gen-ai](https://github.com/open-telemetry/opentelemetry-python-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Agen-ai) when creating or searching issues. If you do not see an issue related to an instrumentation you would like to contribute to, please create a new tracking issue so the community is aware of its progress.
441+
* Tracking and Creating Issues: If you do not see an issue related to an instrumentation you would like to contribute to, please create a new tracking issue so the community is aware of its progress.
440442

441443
## Expectations from contributors
442444

docs/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ install <https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs>
5050
cd opentelemetry-python-contrib
5151
pip install -e ./instrumentation/opentelemetry-instrumentation-flask
5252
pip install -e ./instrumentation/opentelemetry-instrumentation-botocore
53-
pip install -e ./instrumentation-genai/opentelemetry-instrumentation-openai-v2
5453
pip install -e ./sdk-extension/opentelemetry-sdk-extension-aws
5554
pip install -e ./resource/opentelemetry-resource-detector-containerid
5655

instrumentation-genai/AGENTS.md

Lines changed: 6 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,11 @@
11
# GenAI Instrumentation — Agent and Contributor Guidelines
22

3-
Instrumentation packages here wrap specific libraries (OpenAI, Google GenAI, etc.) and bridge
4-
them to the shared telemetry layer in `util/opentelemetry-util-genai`.
3+
**GenAI instrumentations are no longer developed in this repository.** They live in
4+
[opentelemetry-python-genai](https://github.com/open-telemetry/opentelemetry-python-genai),
5+
which is where new instrumentations, features, and bug fixes go.
56

6-
These rules are additive to the shared instrumentation rules in the repo-root
7-
[AGENTS.md](../AGENTS.md).
7+
The packages still present under this directory are deprecated, receive security patches only,
8+
and will be removed from this repository in the future.
89

9-
## 0. Instrumentations Maintained Elsewhere
10-
11-
Development and releases for these GenAI instrumentations have moved to the
12-
[opentelemetry-python-genai](https://github.com/open-telemetry/opentelemetry-python-genai)
13-
repository. Direct new development and fixes there, not here:
14-
15-
- `opentelemetry-instrumentation-genai-anthropic` (anthropic)
16-
- `opentelemetry-instrumentation-genai-claude-agent-sdk` (claude-agent-sdk)
17-
- `opentelemetry-instrumentation-genai-langchain` (langchain)
18-
- `opentelemetry-instrumentation-genai-weaviate-client` (weaviate-client)
19-
- `opentelemetry-instrumentation-genai-openai` (openai; only security patches in this repo, as `opentelemetry-instrumentation-openai-v2`)
20-
- `opentelemetry-instrumentation-genai-openai-agents` (openai-agents; only security patches in this repo, as `opentelemetry-instrumentation-openai-agents-v2`)
21-
22-
Do not add, modify, or attempt to fix these instrumentations in this repository beyond security
23-
patches for the packages that still live here. Direct any other changes to the
10+
Do not add, modify, or attempt to fix instrumentations here. Send any change to the
2411
`opentelemetry-python-genai` repo instead.
25-
26-
## 1. Instrumentation Layer Boundary
27-
28-
Do not call OpenTelemetry APIs (`tracer`, `meter`, `span`, event APIs) directly.
29-
Always go through `TelemetryHandler` and the invocation objects it returns.
30-
31-
This layer is responsible only for:
32-
33-
- Patching the library
34-
- Parsing library-specific input/output into invocation fields
35-
36-
Everything else (span creation, metric recording, event emission, context propagation)
37-
belongs in `util/opentelemetry-util-genai`.
38-
39-
For GenAI streaming wrappers, prefer the shared `SyncStreamWrapper` and `AsyncStreamWrapper`
40-
helpers from `opentelemetry.util.genai.stream` instead of reimplementing iteration,
41-
close/context-manager, and finalization behavior in provider packages.
42-
43-
Put provider-specific chunk parsing and telemetry finalization in private hook methods or a
44-
narrow mixin. Do not make async stream wrappers inherit from sync stream wrappers.
45-
46-
## 2. TelemetryHandler Initialization
47-
48-
Construct `TelemetryHandler` once inside `_instrument()`, passing all OTel providers and the
49-
completion hook. Always prefer an explicitly injected hook (`kwargs.get("completion_hook")`)
50-
over the entry-point hook loaded by `load_completion_hook()`, so test code can override the
51-
hook without touching the environment.
52-
53-
```python
54-
from opentelemetry.util.genai.completion_hook import load_completion_hook
55-
from opentelemetry.util.genai.handler import TelemetryHandler
56-
57-
def _instrument(self, **kwargs):
58-
tracer_provider = kwargs.get("tracer_provider")
59-
meter_provider = kwargs.get("meter_provider")
60-
logger_provider = kwargs.get("logger_provider")
61-
62-
handler = TelemetryHandler(
63-
tracer_provider=tracer_provider,
64-
meter_provider=meter_provider,
65-
logger_provider=logger_provider,
66-
completion_hook=kwargs.get("completion_hook") or load_completion_hook(),
67-
)
68-
# pass handler to each patch/wrapper function
69-
```
70-
71-
## 3. Invocation Pattern
72-
73-
Use `start_*()` and control span lifetime manually:
74-
75-
```python
76-
invocation = handler.start_inference(provider, request_model, server_address=..., server_port=...)
77-
invocation.temperature = ...
78-
try:
79-
response = client.call(...)
80-
invocation.response_model_name = response.model
81-
invocation.finish_reasons = response.finish_reasons
82-
invocation.stop()
83-
except Exception as exc:
84-
invocation.fail(exc)
85-
raise
86-
```
87-
88-
Content capture decisions must come from the shared handler, not from instrumentation-local
89-
environment checks or duplicated helper logic. Evaluate the handler's content-capture API once
90-
when creating wrappers (for example, `capture_content = handler.should_capture_content()`) and
91-
pass that value through invocation/request helpers.
92-
93-
## 4. Semantic conventions
94-
95-
Attributes, spans, events, and metrics follow the
96-
[GenAI semantic conventions](https://github.com/open-telemetry/semantic-conventions/tree/main/docs/gen-ai).
97-
Do not emit signals that are not covered by semconv.
98-
99-
`gen_ai.*` attribute names and the enums for well-known values (e.g. `GenAiOutputTypeValues` for
100-
`gen_ai.output.type`) live in `opentelemetry.semconv._incubating.attributes.gen_ai_attributes`.
101-
102-
## 5. Tests
103-
104-
- Use VCR cassettes for provider calls. Do not skip tests when an API key is missing.
105-
- Cover streaming and non-streaming variants when both exist.
106-
- Cover error scenarios, at minimum: provider error / endpoint unavailable, stream interrupted by
107-
network, stream closed early by the caller.
108-
109-
## 6. Examples
110-
111-
New instrumentations ship a minimal example under the package's `examples/` directory, with
112-
both a `manual/` setup and a `zero-code/` (auto-instrumentation) variant.

instrumentation-genai/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11

22
> [!WARNING]
3-
> GenAI instrumentations are moving to the
3+
> GenAI instrumentations have been moved to the
44
> [opentelemetry-python-genai](https://github.com/open-telemetry/opentelemetry-python-genai)
55
> repository, which is now their home for new development and releases. The
6-
> instrumentations that still live in this repository only receive security
6+
> instrumentations in this repository only receive security
77
> patches and will be removed from here in the future.
88
99
| Instrumentation | Supported Packages | Metrics support | Semconv status |
1010
| --------------- | ------------------ | --------------- | -------------- |
1111
| [opentelemetry-instrumentation-genai-anthropic](https://github.com/open-telemetry/opentelemetry-python-genai/tree/main/instrumentation/opentelemetry-instrumentation-genai-anthropic) | anthropic >= 0.16.0 | Yes | development
1212
| [opentelemetry-instrumentation-genai-claude-agent-sdk](https://github.com/open-telemetry/opentelemetry-python-genai/tree/main/instrumentation/opentelemetry-instrumentation-genai-claude-agent-sdk) | claude-agent-sdk >= 0.1.14 | No | development
13-
| [opentelemetry-instrumentation-google-genai](./opentelemetry-instrumentation-google-genai) | google-genai >= 1.32.0 | No | development
13+
| [opentelemetry-instrumentation-google-genai](https://github.com/open-telemetry/opentelemetry-python-genai/tree/main/instrumentation/opentelemetry-instrumentation-google-genai) | google-genai >= 1.32.0 | No | development
1414
| [opentelemetry-instrumentation-genai-langchain](https://github.com/open-telemetry/opentelemetry-python-genai/tree/main/instrumentation/opentelemetry-instrumentation-genai-langchain) | langchain >= 0.3.21 | Yes | development
1515
| [opentelemetry-instrumentation-genai-openai-agents](https://github.com/open-telemetry/opentelemetry-python-genai/tree/main/instrumentation/opentelemetry-instrumentation-genai-openai-agents) | openai-agents >= 0.3.3 | No | development
1616
| [opentelemetry-instrumentation-genai-openai](https://github.com/open-telemetry/opentelemetry-python-genai/tree/main/instrumentation/opentelemetry-instrumentation-genai-openai) | openai >= 1.26.0 | Yes | development

instrumentation-genai/opentelemetry-instrumentation-google-genai/CHANGELOG.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
# Changelog
22

3+
> [!WARNING]
4+
> This copy of the instrumentation is deprecated and only receives security patches.
5+
> `opentelemetry-instrumentation-google-genai` keeps its name, but is developed and released from the
6+
> [opentelemetry-python-genai](https://github.com/open-telemetry/opentelemetry-python-genai/tree/main/instrumentation/opentelemetry-instrumentation-google-genai)
7+
> repository starting with version `1.0b0`, which contains breaking changes. See its
8+
> [CHANGELOG](https://github.com/open-telemetry/opentelemetry-python-genai/blob/main/instrumentation/opentelemetry-instrumentation-google-genai/CHANGELOG.md)
9+
> for later releases.
10+
311
All notable changes to this project will be documented in this file.
412

513
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
614
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
715

8-
## Unreleased
9-
10-
-Add `gen_ai.usage.reasoning.output_tokens` attribute to capture thinking tokens on spans/events when the experimental sem conv flag is set. Add thinking tokens to output tokens. ([#4313](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4313))
11-
-Add `gen_ai.usage.cache_read.input_tokens` attribute to capture cached tokens on spans/events when the experimental sem conv flag is set. ([#4313](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4313))
12-
1316
## Version 0.7b1 (2026-05-19)
1417
## Version 0.7b0 (2026-02-20)
1518
- Fix bug in how tokens are counted when using the streaming `generateContent` method. ([#4152](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4152)).

0 commit comments

Comments
 (0)