Skip to content

Commit 3c0560b

Browse files
authored
Upgrade deps (#1238)
1 parent 0eb769a commit 3c0560b

File tree

4 files changed

+49
-26
lines changed

4 files changed

+49
-26
lines changed

logfire/_internal/exporters/processor_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ def _default_gen_ai_response_model(span: ReadableSpanDict):
421421

422422
def _transform_google_genai_span(span: ReadableSpanDict):
423423
scope = span['instrumentation_scope']
424-
if not (scope and scope.name == 'opentelemetry.instrumentation.google_genai'):
424+
if not (scope and scope.name == 'opentelemetry.instrumentation.google_genai' and span['events']):
425425
return
426426

427427
new_events: list[Event] = []

logfire/integrations/structlog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __call__(self, logger: WrappedLogger, name: str, event_dict: EventDict) -> E
4242
msg_template = event_dict.get('event') or 'structlog event'
4343
attributes.setdefault(ATTRIBUTES_MESSAGE_KEY, msg_template)
4444
self.logfire_instance.log(
45-
level=level, # type: ignore
45+
level=level,
4646
msg_template=msg_template,
4747
attributes=attributes,
4848
console_log=self.console_log,

tests/otel_integrations/test_google_genai.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pydantic
55
import pytest
6-
from dirty_equals import IsInt, IsPartialDict
6+
from dirty_equals import IsInt, IsPartialDict, IsStr
77
from inline_snapshot import snapshot
88

99
import logfire
@@ -55,12 +55,35 @@ def get_current_weather(location: str) -> str:
5555
assert response.text == snapshot('It is rainy in Boston, MA.\n')
5656
assert exporter.exported_spans_as_dict(parse_json_attributes=True) == snapshot(
5757
[
58+
{
59+
'name': 'execute_tool get_current_weather',
60+
'context': {'trace_id': 1, 'span_id': 3, 'is_remote': False},
61+
'parent': {'trace_id': 1, 'span_id': 1, 'is_remote': False},
62+
'start_time': 3000000000,
63+
'end_time': 4000000000,
64+
'attributes': {
65+
'gen_ai.system': 'gemini',
66+
'gen_ai.operation.name': 'execute_tool',
67+
'gen_ai.tool.name': 'get_current_weather',
68+
'gen_ai.tool.description': IsStr(),
69+
'code.function.name': 'get_current_weather',
70+
'code.module': 'tests.otel_integrations.test_google_genai',
71+
'code.args.positional.count': 0,
72+
'code.args.keyword.count': 1,
73+
'logfire.span_type': 'span',
74+
'logfire.msg': 'execute_tool get_current_weather',
75+
'code.function.parameters.location.type': 'str',
76+
'code.function.parameters.location.value': 'Boston, MA',
77+
'code.function.return.type': 'str',
78+
'code.function.return.value': 'rainy',
79+
},
80+
},
5881
{
5982
'name': 'generate_content gemini-2.0-flash-001',
6083
'context': {'trace_id': 1, 'span_id': 1, 'is_remote': False},
6184
'parent': None,
6285
'start_time': IsInt(),
63-
'end_time': 4000000000,
86+
'end_time': 6000000000,
6487
'attributes': {
6588
'code.function.name': 'google.genai.Models.generate_content',
6689
'gen_ai.system': 'gemini',
@@ -89,6 +112,6 @@ def get_current_weather(location: str) -> str:
89112
'logfire.json_schema': {'type': 'object', 'properties': {'events': {'type': 'array'}}},
90113
'gen_ai.response.model': 'gemini-2.0-flash-001',
91114
},
92-
}
115+
},
93116
]
94117
)

uv.lock

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)