Skip to content

Commit 6d21ce7

Browse files
committed
fixes
1 parent f408fcb commit 6d21ce7

2 files changed

Lines changed: 6 additions & 24 deletions

File tree

  • instrumentation-genai/opentelemetry-instrumentation-openai-v2
  • util/opentelemetry-util-genai

instrumentation-genai/opentelemetry-instrumentation-openai-v2/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121
([#4325](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4325))
2222
- Add strongly typed Responses API extractors with validation and content
2323
extraction improvements
24+
([#4337](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4337))
2425
- Add completion hook support.
2526
([#4315](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4315))
2627
- Fix `response_format` handling: map `json_object`/`json_schema` to `json` output type.

util/opentelemetry-util-genai/AGENTS.md

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,7 @@ Use the appropriate semconv attribute modules — do not hardcode attribute name
1515
- `error.*` attributes: `opentelemetry.semconv.attributes.error_attributes`
1616
- Other namespaces: use the corresponding module from `opentelemetry.semconv`
1717

18-
## 2. TelemetryHandler Initialization
19-
20-
Construct `TelemetryHandler` once per instrumentor, passing the OTel providers and the
21-
completion hook. Always resolve the hook with `kwargs.get("completion_hook") or
22-
load_completion_hook()` so callers can inject a hook directly, and fall back to the
23-
entry-point-loaded hook configured via `OTEL_INSTRUMENTATION_GENAI_COMPLETION_HOOK`.
24-
25-
```python
26-
from opentelemetry.util.genai.completion_hook import load_completion_hook
27-
from opentelemetry.util.genai.handler import TelemetryHandler
28-
29-
handler = TelemetryHandler(
30-
tracer_provider=tracer_provider,
31-
meter_provider=meter_provider,
32-
logger_provider=logger_provider,
33-
completion_hook=kwargs.get("completion_hook") or load_completion_hook(),
34-
)
35-
```
36-
37-
## 3. Invocation Lifecycle Pattern
18+
## 2. Invocation Lifecycle Pattern
3819

3920
Every new operation type must follow this pattern:
4021

@@ -67,21 +48,21 @@ Context manager equivalents (`handler.inference()`, `handler.embedding()`, `hand
6748
etc.) in instrumentation or production code — direct construction skips span creation and context
6849
propagation, so all telemetry calls become no-ops. Always use `handler.start_*()`.
6950

70-
## 4. Exception Handling
51+
## 3. Exception Handling
7152

7253
- Do not add `raise {Error}` statements to `handler.py` or `types.py` — validation belongs in
7354
tests and callers, not telemetry internals.
7455
- When catching exceptions from the underlying library to record telemetry, always re-raise
7556
the original exception unmodified.
7657

77-
## 5. Documentation
58+
## 4. Documentation
7859

7960
- Docstrings for invocation types and span/event helpers must include a link to the
8061
corresponding operation in the semconv spec.
8162
- When adding or changing attributes, update the docstring to describe what is set and under
8263
what conditions (e.g., "set only when `server_address` is provided").
8364

84-
## 6. Tests
65+
## 5. Tests
8566

8667
- Every new operation type or attribute change must have tests verifying the exact attribute
8768
names and values produced, checked against the semconv spec.
@@ -90,7 +71,7 @@ propagation, so all telemetry calls become no-ops. Always use `handler.start_*()
9071
- Tests live in `tests/` — follow existing patterns there.
9172
- Don't call internal API in tests when the public API is available.
9273

93-
## 7. Python API Conventions
74+
## 6. Python API Conventions
9475

9576
- Mark private modules with an underscore.
9677
- Objects inside of a private module should be prefixed with underscopre if they

0 commit comments

Comments
 (0)