Skip to content

Commit 303542a

Browse files
authored
Upgrade to OpenTelemetry SDK 1.32.0 (#991)
1 parent 9eb4e26 commit 303542a

File tree

13 files changed

+276
-243
lines changed

13 files changed

+276
-243
lines changed

logfire/_internal/async_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def _callback_attributes(callback: Any) -> _CallbackAttributes:
8787
# `callback` is a bound method of a Task.
8888
# This is the common case for typical user code.
8989
# In particular this method is usually for advancing an async function (coroutine) to the next `await`.
90-
coro: Any = task.get_coro()
90+
coro: Any = task.get_coro() # type: ignore
9191
result: _CallbackAttributes = {'name': f'task {task.get_name()}'}
9292
if not isinstance(coro, CoroutineType): # pragma: no cover
9393
return result

logfire/_internal/auto_trace/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def install_auto_tracing(
2424
See `Logfire.install_auto_tracing` for more information.
2525
"""
2626
if isinstance(modules, Sequence):
27-
modules = modules_func_from_sequence(modules)
27+
modules = modules_func_from_sequence(modules) # type: ignore
2828

2929
if not callable(modules):
3030
raise TypeError('modules must be a list of strings or a callable')

logfire/_internal/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ class PydanticPlugin:
221221
* `failure`: Send metrics for all validations and traces only for validation failures.
222222
* `metrics`: Send only metrics.
223223
"""
224-
include: set[str] = field(default_factory=set)
224+
include: set[str] = field(default_factory=set) # type: ignore[reportUnknownVariableType]
225225
"""By default, third party modules are not instrumented. This option allows you to include specific modules."""
226-
exclude: set[str] = field(default_factory=set)
226+
exclude: set[str] = field(default_factory=set) # type: ignore[reportUnknownVariableType]
227227
"""Exclude specific modules from instrumentation."""
228228

229229

logfire/_internal/logs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ class ProxyLoggerProvider(LoggerProvider):
1717

1818
provider: LoggerProvider
1919

20-
loggers: WeakSet[ProxyLogger] = dataclasses.field(default_factory=WeakSet)
20+
loggers: WeakSet[ProxyLogger] = dataclasses.field(default_factory=WeakSet) # type: ignore[reportUnknownVariableType]
2121
lock: Lock = dataclasses.field(default_factory=Lock)
22-
suppressed_scopes: set[str] = dataclasses.field(default_factory=set)
22+
suppressed_scopes: set[str] = dataclasses.field(default_factory=set) # type: ignore[reportUnknownVariableType]
2323

2424
def get_logger(
2525
self, name: str, version: str | None = None, schema_url: str | None = None, attributes: Attributes | None = None

logfire/_internal/metrics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
@dataclasses.dataclass
3636
class ProxyMeterProvider(MeterProvider):
3737
provider: MeterProvider
38-
meters: WeakSet[_ProxyMeter] = dataclasses.field(default_factory=WeakSet)
38+
meters: WeakSet[_ProxyMeter] = dataclasses.field(default_factory=WeakSet) # type: ignore[reportUnknownVariableType]
3939
lock: Lock = dataclasses.field(default_factory=Lock)
40-
suppressed_scopes: set[str] = dataclasses.field(default_factory=set)
40+
suppressed_scopes: set[str] = dataclasses.field(default_factory=set) # type: ignore[reportUnknownVariableType]
4141

4242
def get_meter(
4343
self,

logfire/_internal/tracer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ class ProxyTracerProvider(TracerProvider):
5353

5454
provider: TracerProvider
5555
config: LogfireConfig
56-
tracers: WeakKeyDictionary[_ProxyTracer, Callable[[], Tracer]] = field(default_factory=WeakKeyDictionary)
56+
tracers: WeakKeyDictionary[_ProxyTracer, Callable[[], Tracer]] = field(default_factory=WeakKeyDictionary) # type: ignore[reportUnknownVariableType]
5757
lock: Lock = field(default_factory=Lock)
58-
suppressed_scopes: set[str] = field(default_factory=set)
58+
suppressed_scopes: set[str] = field(default_factory=set) # type: ignore[reportUnknownVariableType]
5959

6060
def set_provider(self, provider: SDKTracerProvider) -> None:
6161
with self.lock:

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ classifiers = [
4646
"Framework :: OpenTelemetry :: Instrumentations",
4747
]
4848
dependencies = [
49-
"opentelemetry-sdk >= 1.21.0, < 1.32.0",
50-
"opentelemetry-exporter-otlp-proto-http >= 1.21.0, < 1.32.0",
49+
"opentelemetry-sdk >= 1.21.0, < 1.33.0",
50+
"opentelemetry-exporter-otlp-proto-http >= 1.21.0, < 1.33.0",
5151
"opentelemetry-instrumentation >= 0.41b0",
5252
"rich >= 13.4.2",
5353
"protobuf >= 4.23.4",

tests/conftest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
# Emit both new and old semantic convention attribute names
2525
os.environ['OTEL_SEMCONV_STABILITY_OPT_IN'] = 'http/dup'
2626

27+
# Ensure that LOGFIRE_TOKEN in the environment doesn't interfere
28+
os.environ['LOGFIRE_TOKEN'] = ''
29+
2730
try:
2831
from agents.tracing.setup import GLOBAL_TRACE_PROVIDER
2932

tests/otel_integrations/test_asgi.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ def homepage(_: Request):
6464
'http.scheme': 'http',
6565
'url.scheme': 'http',
6666
'http.host': 'testserver',
67-
'client.address': 'testserver',
67+
'server.address': 'testserver',
68+
'client.address': 'testclient',
6869
'net.host.port': 80,
6970
'server.port': 80,
7071
'http.flavor': '1.1',

tests/otel_integrations/test_fastapi.py

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ def test_404(client: TestClient, exporter: TestExporter) -> None:
174174
'http.scheme': 'http',
175175
'url.scheme': 'http',
176176
'http.host': 'testserver',
177+
'server.address': 'testserver',
177178
'net.host.port': 80,
178179
'server.port': 80,
179180
'http.flavor': '1.1',
@@ -187,7 +188,7 @@ def test_404(client: TestClient, exporter: TestExporter) -> None:
187188
'http.user_agent': 'testclient',
188189
'user_agent.original': 'testclient',
189190
'net.peer.ip': 'testclient',
190-
'client.address': 'testserver',
191+
'client.address': 'testclient',
191192
'net.peer.port': 50000,
192193
'client.port': 50000,
193194
'http.status_code': 404,
@@ -235,6 +236,7 @@ def test_path_param(client: TestClient, exporter: TestExporter) -> None:
235236
'http.scheme': 'http',
236237
'url.scheme': 'http',
237238
'http.host': 'testserver',
239+
'server.address': 'testserver',
238240
'net.host.port': 80,
239241
'server.port': 80,
240242
'http.flavor': '1.1',
@@ -248,7 +250,7 @@ def test_path_param(client: TestClient, exporter: TestExporter) -> None:
248250
'http.user_agent': 'testclient',
249251
'user_agent.original': 'testclient',
250252
'net.peer.ip': 'testclient',
251-
'client.address': 'testserver',
253+
'client.address': 'testclient',
252254
'net.peer.port': 50000,
253255
'client.port': 50000,
254256
'http.route': '/with_path_param/{param}',
@@ -393,6 +395,7 @@ def test_path_param(client: TestClient, exporter: TestExporter) -> None:
393395
'http.scheme': 'http',
394396
'url.scheme': 'http',
395397
'http.host': 'testserver',
398+
'server.address': 'testserver',
396399
'net.host.port': 80,
397400
'server.port': 80,
398401
'http.flavor': '1.1',
@@ -406,7 +409,7 @@ def test_path_param(client: TestClient, exporter: TestExporter) -> None:
406409
'http.user_agent': 'testclient',
407410
'user_agent.original': 'testclient',
408411
'net.peer.ip': 'testclient',
409-
'client.address': 'testserver',
412+
'client.address': 'testclient',
410413
'net.peer.port': 50000,
411414
'client.port': 50000,
412415
'http.route': '/with_path_param/{param}',
@@ -458,6 +461,7 @@ def test_fastapi_instrumentation(client: TestClient, exporter: TestExporter) ->
458461
'http.scheme': 'http',
459462
'url.scheme': 'http',
460463
'http.host': 'testserver',
464+
'server.address': 'testserver',
461465
'net.host.port': 80,
462466
'server.port': 80,
463467
'http.flavor': '1.1',
@@ -471,7 +475,7 @@ def test_fastapi_instrumentation(client: TestClient, exporter: TestExporter) ->
471475
'http.user_agent': 'testclient',
472476
'user_agent.original': 'testclient',
473477
'net.peer.ip': 'testclient',
474-
'client.address': 'testserver',
478+
'client.address': 'testclient',
475479
'net.peer.port': 50000,
476480
'client.port': 50000,
477481
'http.route': '/',
@@ -632,6 +636,7 @@ def test_fastapi_instrumentation(client: TestClient, exporter: TestExporter) ->
632636
'http.scheme': 'http',
633637
'url.scheme': 'http',
634638
'http.host': 'testserver',
639+
'server.address': 'testserver',
635640
'net.host.port': 80,
636641
'server.port': 80,
637642
'http.flavor': '1.1',
@@ -645,7 +650,7 @@ def test_fastapi_instrumentation(client: TestClient, exporter: TestExporter) ->
645650
'http.user_agent': 'testclient',
646651
'user_agent.original': 'testclient',
647652
'net.peer.ip': 'testclient',
648-
'client.address': 'testserver',
653+
'client.address': 'testclient',
649654
'net.peer.port': 50000,
650655
'client.port': 50000,
651656
'http.route': '/',
@@ -760,6 +765,7 @@ def test_fastapi_arguments(client: TestClient, exporter: TestExporter) -> None:
760765
'http.scheme': 'http',
761766
'url.scheme': 'http',
762767
'http.host': 'testserver',
768+
'server.address': 'testserver',
763769
'net.host.port': 80,
764770
'server.port': 80,
765771
'http.flavor': '1.1',
@@ -774,7 +780,7 @@ def test_fastapi_arguments(client: TestClient, exporter: TestExporter) -> None:
774780
'http.user_agent': 'testclient',
775781
'user_agent.original': 'testclient',
776782
'net.peer.ip': 'testclient',
777-
'client.address': 'testserver',
783+
'client.address': 'testclient',
778784
'net.peer.port': 50000,
779785
'client.port': 50000,
780786
'http.route': '/other',
@@ -891,6 +897,7 @@ def test_get_fastapi_arguments(client: TestClient, exporter: TestExporter) -> No
891897
'http.scheme': 'http',
892898
'url.scheme': 'http',
893899
'http.host': 'testserver',
900+
'server.address': 'testserver',
894901
'net.host.port': 80,
895902
'server.port': 80,
896903
'http.flavor': '1.1',
@@ -905,7 +912,7 @@ def test_get_fastapi_arguments(client: TestClient, exporter: TestExporter) -> No
905912
'http.user_agent': 'testclient',
906913
'user_agent.original': 'testclient',
907914
'net.peer.ip': 'testclient',
908-
'client.address': 'testserver',
915+
'client.address': 'testclient',
909916
'net.peer.port': 50000,
910917
'client.port': 50000,
911918
'http.route': '/other',
@@ -1022,6 +1029,7 @@ def test_first_lvl_subapp_fastapi_arguments(client: TestClient, exporter: TestEx
10221029
'http.scheme': 'http',
10231030
'url.scheme': 'http',
10241031
'http.host': 'testserver',
1032+
'server.address': 'testserver',
10251033
'net.host.port': 80,
10261034
'server.port': 80,
10271035
'http.flavor': '1.1',
@@ -1036,7 +1044,7 @@ def test_first_lvl_subapp_fastapi_arguments(client: TestClient, exporter: TestEx
10361044
'http.user_agent': 'testclient',
10371045
'user_agent.original': 'testclient',
10381046
'net.peer.ip': 'testclient',
1039-
'client.address': 'testserver',
1047+
'client.address': 'testclient',
10401048
'net.peer.port': 50000,
10411049
'client.port': 50000,
10421050
'http.route': '/first_lvl',
@@ -1153,6 +1161,7 @@ def test_second_lvl_subapp_fastapi_arguments(client: TestClient, exporter: TestE
11531161
'http.scheme': 'http',
11541162
'url.scheme': 'http',
11551163
'http.host': 'testserver',
1164+
'server.address': 'testserver',
11561165
'net.host.port': 80,
11571166
'server.port': 80,
11581167
'http.flavor': '1.1',
@@ -1167,7 +1176,7 @@ def test_second_lvl_subapp_fastapi_arguments(client: TestClient, exporter: TestE
11671176
'http.user_agent': 'testclient',
11681177
'user_agent.original': 'testclient',
11691178
'net.peer.ip': 'testclient',
1170-
'client.address': 'testserver',
1179+
'client.address': 'testclient',
11711180
'net.peer.port': 50000,
11721181
'client.port': 50000,
11731182
'http.route': '/first_lvl',
@@ -1252,6 +1261,7 @@ def test_fastapi_unhandled_exception(client: TestClient, exporter: TestExporter)
12521261
'http.scheme': 'http',
12531262
'url.scheme': 'http',
12541263
'http.host': 'testserver',
1264+
'server.address': 'testserver',
12551265
'net.host.port': 80,
12561266
'server.port': 80,
12571267
'http.flavor': '1.1',
@@ -1265,7 +1275,7 @@ def test_fastapi_unhandled_exception(client: TestClient, exporter: TestExporter)
12651275
'http.user_agent': 'testclient',
12661276
'user_agent.original': 'testclient',
12671277
'net.peer.ip': 'testclient',
1268-
'client.address': 'testserver',
1278+
'client.address': 'testclient',
12691279
'net.peer.port': 50000,
12701280
'client.port': 50000,
12711281
'http.route': '/exception',
@@ -1388,6 +1398,7 @@ def test_fastapi_handled_exception(client: TestClient, exporter: TestExporter) -
13881398
'http.scheme': 'http',
13891399
'url.scheme': 'http',
13901400
'http.host': 'testserver',
1401+
'server.address': 'testserver',
13911402
'net.host.port': 80,
13921403
'server.port': 80,
13931404
'http.flavor': '1.1',
@@ -1401,7 +1412,7 @@ def test_fastapi_handled_exception(client: TestClient, exporter: TestExporter) -
14011412
'http.user_agent': 'testclient',
14021413
'user_agent.original': 'testclient',
14031414
'net.peer.ip': 'testclient',
1404-
'client.address': 'testserver',
1415+
'client.address': 'testclient',
14051416
'net.peer.port': 50000,
14061417
'client.port': 50000,
14071418
'http.route': '/validation_error',
@@ -1521,6 +1532,7 @@ def test_scrubbing(client: TestClient, exporter: TestExporter) -> None:
15211532
'http.scheme': 'http',
15221533
'url.scheme': 'http',
15231534
'http.host': 'testserver',
1535+
'server.address': 'testserver',
15241536
'net.host.port': 80,
15251537
'server.port': 80,
15261538
'http.flavor': '1.1',
@@ -1535,7 +1547,7 @@ def test_scrubbing(client: TestClient, exporter: TestExporter) -> None:
15351547
'http.user_agent': 'testclient',
15361548
'user_agent.original': 'testclient',
15371549
'net.peer.ip': 'testclient',
1538-
'client.address': 'testserver',
1550+
'client.address': 'testclient',
15391551
'net.peer.port': 50000,
15401552
'client.port': 50000,
15411553
'http.route': '/secret/{path_param}',
@@ -1718,6 +1730,7 @@ def test_request_hooks_without_send_receiev_spans(exporter: TestExporter):
17181730
'http.scheme': 'http',
17191731
'url.scheme': 'http',
17201732
'http.host': 'testserver',
1733+
'server.address': 'testserver',
17211734
'net.host.port': 80,
17221735
'server.port': 80,
17231736
'http.flavor': '1.1',
@@ -1731,7 +1744,7 @@ def test_request_hooks_without_send_receiev_spans(exporter: TestExporter):
17311744
'http.user_agent': 'testclient',
17321745
'user_agent.original': 'testclient',
17331746
'net.peer.ip': 'testclient',
1734-
'client.address': 'testserver',
1747+
'client.address': 'testclient',
17351748
'net.peer.port': 50000,
17361749
'client.port': 50000,
17371750
'http.route': '/echo_body',
@@ -1908,6 +1921,7 @@ def test_request_hooks_with_send_receive_spans(exporter: TestExporter):
19081921
'http.scheme': 'http',
19091922
'url.scheme': 'http',
19101923
'http.host': 'testserver',
1924+
'server.address': 'testserver',
19111925
'net.host.port': 80,
19121926
'server.port': 80,
19131927
'http.flavor': '1.1',
@@ -1921,7 +1935,7 @@ def test_request_hooks_with_send_receive_spans(exporter: TestExporter):
19211935
'http.user_agent': 'testclient',
19221936
'user_agent.original': 'testclient',
19231937
'net.peer.ip': 'testclient',
1924-
'client.address': 'testserver',
1938+
'client.address': 'testclient',
19251939
'net.peer.port': 50000,
19261940
'client.port': 50000,
19271941
'http.route': '/echo_body',
@@ -2062,7 +2076,8 @@ def test_websocket(client: TestClient, exporter: TestExporter) -> None:
20622076
'http.scheme': 'ws',
20632077
'url.scheme': 'ws',
20642078
'http.host': 'testserver',
2065-
'client.address': 'testserver',
2079+
'server.address': 'testserver',
2080+
'client.address': 'testclient',
20662081
'net.host.port': 80,
20672082
'server.port': 80,
20682083
'http.target': '/ws/foo',

tests/otel_integrations/test_starlette.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def test_websocket(client: TestClient, exporter: TestExporter) -> None:
140140
'http.scheme': 'ws',
141141
'url.scheme': 'ws',
142142
'http.host': 'testserver',
143+
'server.address': 'testserver',
143144
'net.host.port': 80,
144145
'server.port': 80,
145146
'http.target': '/ws/foo',
@@ -149,7 +150,7 @@ def test_websocket(client: TestClient, exporter: TestExporter) -> None:
149150
'http.user_agent': 'testclient',
150151
'user_agent.original': 'testclient',
151152
'net.peer.ip': 'testclient',
152-
'client.address': 'testserver',
153+
'client.address': 'testclient',
153154
'net.peer.port': 50000,
154155
'client.port': 50000,
155156
'http.route': '/ws/{name}',
@@ -193,6 +194,7 @@ def test_scrubbing(client: TestClient, exporter: TestExporter) -> None:
193194
'http.scheme': 'http',
194195
'url.scheme': 'http',
195196
'http.host': 'testserver',
197+
'server.address': 'testserver',
196198
'net.host.port': 80,
197199
'server.port': 80,
198200
'http.flavor': '1.1',
@@ -207,7 +209,7 @@ def test_scrubbing(client: TestClient, exporter: TestExporter) -> None:
207209
'http.user_agent': 'testclient',
208210
'user_agent.original': 'testclient',
209211
'net.peer.ip': 'testclient',
210-
'client.address': 'testserver',
212+
'client.address': 'testclient',
211213
'net.peer.port': 50000,
212214
'client.port': 50000,
213215
'http.route': '/secret/{path_param}',

tests/test_sampling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
@dataclass
1717
class SpanNode:
1818
name: str | None = None
19-
children: list[SpanNode] = field(default_factory=list)
19+
children: list[SpanNode] = field(default_factory=list) # type: ignore[reportUnknownVariableType]
2020

2121

2222
# TODO(Marcelo): Remove pragma when this file is covered by tests.

0 commit comments

Comments
 (0)