Skip to content

Commit f6aef69

Browse files
committed
Address comments
1 parent d6c106e commit f6aef69

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3232

3333
### Added
3434

35+
- `opentelemetry-util-genai` Add a utility to parse the `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT` environment variable.
36+
Add `gen_ai_latest_experimental` as a new value to the Sem Conv stability flag ([#3716](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3716)).
3537
- `opentelemetry-instrumentation-confluent-kafka` Add support for confluent-kafka <=2.11.0
3638
([#3685](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3685))
3739
- `opentelemetry-instrumentation-system-metrics`: Add `cpython.gc.collected_objects` and `cpython.gc.uncollectable_objects` metrics

util/opentelemetry-util-genai/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## Unreleased
8+
## Unreleased
9+
10+
Repurpose the `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT` environment variable when GEN AI stability mode is set to `gen_ai_latest_experimental`,
11+
to take on an enum (`NO_CONTENT/SPAN_ONLY/EVENT_ONLY/SPAN_AND_EVENT`) instead of a boolean. Add a utility function to help parse this environment variable.

util/opentelemetry-util-genai/src/opentelemetry/util/genai/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929

3030

3131
def get_content_capturing_mode() -> ContentCapturingMode:
32+
"""This function should not be called when GEN_AI stability mode is set to DEFAULT.
33+
34+
When the GEN_AI stability mode is DEFAULT this function will raise a ValueError -- see the code below."""
3235
envvar = os.environ.get(OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT)
3336
if (
3437
_OpenTelemetrySemanticConventionStability._get_opentelemetry_stability_opt_in_mode(
@@ -45,8 +48,9 @@ def get_content_capturing_mode() -> ContentCapturingMode:
4548
return ContentCapturingMode[envvar.upper()]
4649
except KeyError:
4750
logger.warning(
48-
"%s is not a valid option for `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT` environment variable. Must be one of %s. Defaulting to `NO_COTENT`.",
51+
"%s is not a valid option for `%s` environment variable. Must be one of %s. Defaulting to `NO_CONTENT`.",
4952
envvar,
53+
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT,
5054
", ".join(e.name for e in ContentCapturingMode),
5155
)
5256
return ContentCapturingMode.NO_CONTENT

0 commit comments

Comments
 (0)