From 4f2c6abe36abdc179d96c25144fa9e3941f2825a Mon Sep 17 00:00:00 2001 From: Eric Gustin <34000337+EricGustin@users.noreply.github.com> Date: Mon, 24 Nov 2025 18:13:28 -0800 Subject: [PATCH] Update OTEL resource attributes (#695) Co-authored-by: Wils Dawson --- libs/arcade-serve/arcade_serve/fastapi/telemetry.py | 9 +++++++-- libs/arcade-serve/pyproject.toml | 2 +- libs/tests/worker/test_telemetry.py | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/libs/arcade-serve/arcade_serve/fastapi/telemetry.py b/libs/arcade-serve/arcade_serve/fastapi/telemetry.py index 16ca07a4..aee48a73 100644 --- a/libs/arcade-serve/arcade_serve/fastapi/telemetry.py +++ b/libs/arcade-serve/arcade_serve/fastapi/telemetry.py @@ -14,9 +14,11 @@ from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler from opentelemetry.sdk._logs.export import BatchLogRecordProcessor from opentelemetry.sdk.metrics import MeterProvider from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader -from opentelemetry.sdk.resources import SERVICE_NAME, Resource +from opentelemetry.sdk.resources import Resource from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor +from opentelemetry.semconv._incubating.attributes import deployment_attributes +from opentelemetry.semconv.attributes import service_attributes class ShutdownError(Exception): @@ -42,7 +44,10 @@ class OTELHandler: "🔎 Initializing OpenTelemetry. Use environment variables to configure the connection" ) self.resource = Resource( - attributes={SERVICE_NAME: "arcade-worker", "environment": self.environment} + attributes={ + service_attributes.SERVICE_NAME: "worker", + deployment_attributes.DEPLOYMENT_ENVIRONMENT_NAME: self.environment, + } ) self._init_tracer() diff --git a/libs/arcade-serve/pyproject.toml b/libs/arcade-serve/pyproject.toml index b3ef31c6..093110d8 100644 --- a/libs/arcade-serve/pyproject.toml +++ b/libs/arcade-serve/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "arcade-serve" -version = "3.1.0" +version = "3.1.1" description = "Arcade Serve - Serving infrastructure for Arcade tools and workers" readme = "README.md" license = {text = "MIT"} diff --git a/libs/tests/worker/test_telemetry.py b/libs/tests/worker/test_telemetry.py index 1c4984d2..f772de4f 100644 --- a/libs/tests/worker/test_telemetry.py +++ b/libs/tests/worker/test_telemetry.py @@ -38,8 +38,8 @@ def test_init_with_enable_true( handler.instrument_app(app) # Verify that the resource is set correctly - assert handler.resource.attributes["service.name"] == "arcade-worker" - assert "environment" in handler.resource.attributes + assert handler.resource.attributes["service.name"] == "worker" + assert "deployment.environment.name" in handler.resource.attributes # Verify that initialization methods are called assert handler._tracer_provider is not None