Skip to content

Commit cc1943d

Browse files
committed
up
1 parent 43c9840 commit cc1943d

2 files changed

Lines changed: 31 additions & 11 deletions

File tree

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

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@ Review rules for PRs touching `instrumentation-genai/**`. Flag violations with a
66

77
## 0. Reviewer mindset
88

9-
Review as long-term maintainer. For new instrumentations, consult upstream library docs and
10-
judge:
9+
Review as long-term maintainer.
10+
11+
For new instrumentations, consult upstream library docs and judge:
1112

1213
- Does the library already emit its own telemetry, making this instrumentation redundant?
1314
- Is the library used widely enough to warrant a package in this repo?
1415
- Does it avoid unbounded in-memory accumulation or other side-effects?
15-
- Does it raise errors that affect the user application at runtime?
16+
- Does the library raise exceptions that would reach user code through our wrapping?
1617

17-
Prefer back-compat changes. Break users only for a real reason; prefer opt-in or additive.
18-
Breaking changes need explicit justification in the PR.
18+
For changes to existing instrumentations: prefer back-compat. Break users only for a real reason;
19+
prefer opt-in or additive. Breaking changes need explicit justification in the PR.
1920

2021
## 1. Scope of `instrumentation-genai/`
2122

@@ -33,17 +34,18 @@ in `instrumentation/`, not here.
3334
- New instrumentations must add an entry under the correct folder in
3435
[`component_owners.yml`](../component_owners.yml) in the same PR. Contributor must commit to
3536
long-term maintenance. See
36-
[Expectations from contributors](../../CONTRIBUTING.md#expectations-from-contributors) and
37-
[Guideline for GenAI instrumentations](../../CONTRIBUTING.md#guideline-for-genai-instrumentations).
38-
- General [instrumentation checklist](../../CONTRIBUTING.md#guideline-for-instrumentations) still
39-
applies.
37+
[Expectations from contributors](../../CONTRIBUTING.md#expectations-from-contributors),
38+
[Guideline for GenAI instrumentations](../../CONTRIBUTING.md#guideline-for-genai-instrumentations),
39+
and the general [instrumentation checklist](../../CONTRIBUTING.md#guideline-for-instrumentations).
4040

4141
## 3. Telemetry and configuration via `opentelemetry-util-genai`
4242

43-
- Spans, logs, and metrics must go through `opentelemetry-util-genai`. Direct use of `Tracer`,
44-
`Meter`, or `Logger` APIs is not allowed.
43+
- Spans, logs, metrics, and events must go through `opentelemetry-util-genai`. Direct use of
44+
`Tracer`, `Meter`, `Logger`, or event APIs is not allowed.
4545
- Content capture, hooks, and other cross-cutting configuration are owned by the util.
4646
Instrumentations must not introduce their own env vars, settings, or hook interfaces.
47+
- Message content, prompts, and tool call arguments must only be set through the util's content
48+
capture path — never as unconditional span/log attributes.
4749
- Adding attributes to invocations produced by the util is fine.
4850
- If a capability is missing in `opentelemetry-util-genai`, land it in the util first.
4951

@@ -52,6 +54,13 @@ in `instrumentation/`, not here.
5254
- Attributes, spans, events, and metrics must match the
5355
[GenAI semantic conventions](https://github.com/open-telemetry/semantic-conventions/tree/main/docs/gen-ai).
5456
- If a signal is not in semconv, wait until semconv lands.
57+
- Attribute names must come from the semconv attribute modules, not hardcoded strings:
58+
- `gen_ai.*`: `opentelemetry.semconv._incubating.attributes.gen_ai_attributes`
59+
- `server.*`: `opentelemetry.semconv.attributes.server_attributes`
60+
- `error.*`: `opentelemetry.semconv.attributes.error_attributes`
61+
- other namespaces: corresponding module under `opentelemetry.semconv`
62+
- For attributes with a well-known value set in semconv, use the generated enum from the same
63+
modules (e.g. `GenAiOutputTypeValues` for `gen_ai.output.type`) instead of string literals.
5564

5665
## 5. Exception handling
5766

@@ -68,6 +77,7 @@ in `instrumentation/`, not here.
6877
exist.
6978
- Cover happy path and error scenarios, at minimum: provider error / endpoint unavailable, stream
7079
interrupted by network, stream closed early by the caller.
80+
- Tests must verify exact attribute names **and value types**, checked against the semconv spec.
7181
- Test against oldest and latest supported library versions via `tests/requirements.{oldest,latest}.txt`
7282
and `{oldest,latest}` `tox.ini` factors (see existing GenAI packages).
7383

instrumentation-genai/AGENTS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ Attributes, spans, events, and metrics follow the
3939
[GenAI semantic conventions](https://github.com/open-telemetry/semantic-conventions/tree/main/docs/gen-ai).
4040
Do not emit signals that are not covered by semconv.
4141

42+
Use the semconv attribute modules — do not hardcode attribute name strings:
43+
44+
- `gen_ai.*` attributes: `opentelemetry.semconv._incubating.attributes.gen_ai_attributes`
45+
- `server.*` attributes: `opentelemetry.semconv.attributes.server_attributes`
46+
- `error.*` attributes: `opentelemetry.semconv.attributes.error_attributes`
47+
- Other namespaces: use the corresponding module from `opentelemetry.semconv`
48+
49+
For attributes with a well-known value set, use the generated enum from the same modules
50+
(e.g. `GenAiOutputTypeValues` for `gen_ai.output.type`) instead of string literals.
51+
4252
## 4. Tests
4353

4454
- Use VCR cassettes for provider calls. Do not skip tests when an API key is missing.

0 commit comments

Comments
 (0)