Update OTEL resource attributes (#695)

Co-authored-by: Wils Dawson <wils@arcade-ai.com>
This commit is contained in:
Eric Gustin 2025-11-24 18:13:28 -08:00 committed by GitHub
parent 7fb097f20f
commit 4f2c6abe36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 5 deletions

View file

@ -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()

View file

@ -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"}

View file

@ -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