@@ -20,30 +20,64 @@ prefer opt-in or additive. Breaking changes need explicit justification in the P
2020## 1. Maintenance commitment
2121
2222- New instrumentations require contributor commitment to long-term maintenance. See
23- [ Expectations from contributors] ( ../../CONTRIBUTING.md#expectations-from-contributors ) and the
24- general [ instrumentation checklist] ( ../../CONTRIBUTING.md#guideline-for-instrumentations ) .
23+ [ Expectations from contributors] ( ../../CONTRIBUTING.md#expectations-from-contributors ) , the
24+ general [ instrumentation checklist] ( ../../CONTRIBUTING.md#guideline-for-instrumentations ) , and
25+ the GenAI-specific expectations in
26+ [ ` CONTRIBUTING.md#guideline-for-genai-instrumentations ` ] ( ../../CONTRIBUTING.md#guideline-for-genai-instrumentations ) .
2527
26- ## 2. Semantic conventions
28+ ## 2. Telemetry and configuration via ` opentelemetry-util-genai `
2729
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+ ## 3. Semantic conventions
40+
41+ - Attributes, spans, events, and metrics must match the
42+ [ GenAI semantic conventions] ( https://github.com/open-telemetry/semantic-conventions-genai/tree/main/docs/gen-ai ) .
2843- Attribute names must come from the semconv attribute modules, not hardcoded strings. Use the
2944 module matching the namespace under ` opentelemetry.semconv ` (e.g. ` server_attributes ` ,
30- ` error_attributes ` , ` http_attributes ` , ` db_attributes ` , …).
45+ ` error_attributes ` , ` http_attributes ` , ` db_attributes ` , …). ` gen_ai.* ` attribute names must
46+ come from ` opentelemetry.semconv._incubating.attributes.gen_ai_attributes ` .
3147- For attributes with a well-known value set in semconv, use the generated enum from the same
32- modules instead of string literals.
48+ module (e.g. ` GenAiOutputTypeValues ` for ` gen_ai.output.type ` ) instead of string literals.
3349- If a signal is not in semconv, wait until semconv lands.
3450
35- ## 3 . Exception handling
51+ ## 4 . Exception handling
3652
3753- When catching exceptions from the underlying library to record telemetry, always re-raise the
3854 original exception unmodified.
3955- Do not raise ** new** exceptions in instrumentation/telemetry code.
4056
41- ## 4 . Tests
57+ ## 5 . Tests
4258
4359- For every public API instrumented, cover sync/async variants when both exist.
44- - Cover happy path and error scenarios.
60+ - Cover streaming and non-streaming variants when both exist.
61+ - Cover happy path and error scenarios. For error scenarios, at minimum include: provider error /
62+ endpoint unavailable, stream interrupted by network, stream closed early by the caller.
63+ - Use recorded VCR cassettes for provider calls. No live-key-only tests; skipping on missing key
64+ is not acceptable.
4565- Tests must verify exact attribute names ** and value types** , checked against the semconv spec.
4666- Test against oldest and latest supported library versions via ` tests/requirements.{oldest,latest}.txt `
4767 and ` {oldest,latest} ` ` tox.ini ` factors.
68+ - ` tests/conftest.py ` must consume the shared fixtures from ` opentelemetry.test_util_genai `
69+ (` from opentelemetry.test_util_genai.fixtures import * ` and
70+ ` from opentelemetry.test_util_genai.vcr import fixture_vcr, scrub_response_headers ` ). Do not
71+ re-implement in-memory provider/exporter setup or the VCR pretty-print serializer locally.
72+
73+ ## 6. Examples
74+
75+ New instrumentations must ship a minimal example under the package's ` examples/ ` , with both a
76+ ` manual/ ` and a ` zero-code/ ` (auto-instrumentation) variant.
77+
78+ ## 7. PR description
79+
80+ - Cover which part of the GenAI semconv the change implements or follows (when applicable) and
81+ how instrumentations should consume it.
4882
4983See also [ AGENTS.md] ( ../../AGENTS.md ) for general repo rules.
0 commit comments