Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3ac198d
Update google genai instrumentation to latest semantic convention.
argaj Sep 22, 2025
9ea2278
fix: log roles as str, event attrs as objects.
argaj Sep 25, 2025
eeed7d5
fix: proper event name
argaj Sep 25, 2025
e1738c2
refactor: remove unused message models.
argaj Sep 25, 2025
f1feaf7
refactor: use OTel imported semconv attributes.
argaj Sep 25, 2025
ee911f5
refactor: Inject upload_hook in Instrumentor.
argaj Sep 25, 2025
8583327
refactor: rename upload hook to completion hook.
argaj Sep 29, 2025
47d5728
test: add tests for non streaming case and tool_call_wrapper.
argaj Sep 30, 2025
b3a6efb
test: add tool call instrumentation tests and nonstreaming recording …
argaj Sep 30, 2025
2eefc39
fix: remove print
argaj Oct 1, 2025
166c081
feature: add blobpart and filepart to message handling
argaj Oct 1, 2025
ae4da64
fix: encode bytes as base64 when dumping to json string.
argaj Oct 2, 2025
13b6f2e
fix: always call completion hook, independently of recording settings.
argaj Oct 2, 2025
058da13
test: update requirements for instrumentation-google-genai oldest env
argaj Oct 2, 2025
17b9c0a
test: bump google-genai lib version in -oldest test env.
argaj Oct 2, 2025
6276543
Merge branch 'main' into genai-instrumentation-semconv
aabmass Oct 2, 2025
057d956
test: fix event recording test.
argaj Oct 3, 2025
486796a
Update FakeCredentials
DylanRussell Oct 6, 2025
205aa88
Fix tests
DylanRussell Oct 6, 2025
32ae223
Merge branch 'main' into genai-instrumentation-semconv
DylanRussell Oct 6, 2025
05bed52
fix lint issues
DylanRussell Oct 6, 2025
ab39602
fix: aggregate streaming messages into one event.
argaj Oct 8, 2025
0ff51f3
fix: remove gen_ai.system from latest sem_conv
argaj Oct 8, 2025
48ac64b
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
argaj Oct 8, 2025
e51ef37
refactor: import encoder from utils-genai
argaj Oct 8, 2025
5c35853
build: update deps versions.
argaj Oct 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ classifiers = [
]
dependencies = [
"opentelemetry-api >=1.37, <2",
"opentelemetry-instrumentation >=0.52b1, <2",
"opentelemetry-semantic-conventions >=0.52b1, <2"
"opentelemetry-instrumentation >=0.58b0, <2",
"opentelemetry-semantic-conventions >=0.58b0, <2",
"opentelemetry-util-genai >= 0.1b0"
]

[project.optional-dependencies]
instruments = [
"google-genai >= 1.0.0"
"google-genai >= 1.32.0"
]

[project.entry-points.opentelemetry_instrumentor]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os
from os import environ
from typing import Union

_CONTENT_RECORDING_ENV_VAR = (
"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT"
from opentelemetry.instrumentation._semconv import _StabilityMode
from opentelemetry.util.genai.environment_variables import (
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT,
)
from opentelemetry.util.genai.types import ContentCapturingMode
from opentelemetry.util.genai.utils import get_content_capturing_mode


def is_content_recording_enabled():
return os.getenv(_CONTENT_RECORDING_ENV_VAR, "false").lower() == "true"
def is_content_recording_enabled(
mode: _StabilityMode,
) -> Union[bool, ContentCapturingMode]:
if mode == _StabilityMode.DEFAULT:
capture_content = environ.get(
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT, "false"
)
return capture_content.lower() == "true"
if mode == _StabilityMode.GEN_AI_LATEST_EXPERIMENTAL:
return get_content_capturing_mode()
raise RuntimeError(f"{mode} mode not supported")
Loading
Loading