Skip to content

Commit 0bce4fd

Browse files
authored
Merge branch 'main' into django-issue-fix
2 parents 08e817c + f3d0394 commit 0bce4fd

File tree

38 files changed

+2410
-912
lines changed

38 files changed

+2410
-912
lines changed

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

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

88
## Unreleased
99

10+
- Implement the new semantic convention changes made in https://github.com/open-telemetry/semantic-conventions/pull/2179.
11+
A single event (`gen_ai.client.inference.operation.details`) is used to capture Chat History. This is opt-in,
12+
an environment variable OTEL_SEMCONV_STABILITY_OPT_IN needs to be set to `gen_ai_latest_experimental` to see them ([#3386](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3386))
13+
- Support CompletionHook for upload to cloud storage.
14+
1015
## Version 0.3b0 (2025-07-08)
1116

1217
- Add automatic instrumentation to tool call functions ([#3446](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3446))

instrumentation-genai/opentelemetry-instrumentation-google-genai/pyproject.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ classifiers = [
3838
]
3939
dependencies = [
4040
"opentelemetry-api ~=1.37",
41-
"opentelemetry-instrumentation >=0.52b1, <2",
42-
"opentelemetry-semantic-conventions >=0.52b1, <2"
43-
]
41+
"opentelemetry-instrumentation >=0.58b0, <2",
42+
"opentelemetry-semantic-conventions >=0.58b0, <2",
43+
# TODO https://github.com/open-telemetry/opentelemetry-python-contrib/issues/3786: restrict
44+
# version after the first release
45+
"opentelemetry-util-genai",]
4446

4547
[project.optional-dependencies]
4648
instruments = [
47-
"google-genai >= 1.0.0"
49+
"google-genai >= 1.32.0"
4850
]
4951

5052
[project.entry-points.opentelemetry_instrumentor]

instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/flags.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,25 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import os
15+
from os import environ
16+
from typing import Union
1617

17-
_CONTENT_RECORDING_ENV_VAR = (
18-
"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT"
18+
from opentelemetry.instrumentation._semconv import _StabilityMode
19+
from opentelemetry.util.genai.environment_variables import (
20+
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT,
1921
)
22+
from opentelemetry.util.genai.types import ContentCapturingMode
23+
from opentelemetry.util.genai.utils import get_content_capturing_mode
2024

2125

22-
def is_content_recording_enabled():
23-
return os.getenv(_CONTENT_RECORDING_ENV_VAR, "false").lower() == "true"
26+
def is_content_recording_enabled(
27+
mode: _StabilityMode,
28+
) -> Union[bool, ContentCapturingMode]:
29+
if mode == _StabilityMode.DEFAULT:
30+
capture_content = environ.get(
31+
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT, "false"
32+
)
33+
return capture_content.lower() == "true"
34+
if mode == _StabilityMode.GEN_AI_LATEST_EXPERIMENTAL:
35+
return get_content_capturing_mode()
36+
raise RuntimeError(f"{mode} mode not supported")

0 commit comments

Comments
 (0)