Update OTEL resource attributes (#695)
Co-authored-by: Wils Dawson <wils@arcade-ai.com>
This commit is contained in:
parent
7fb097f20f
commit
4f2c6abe36
3 changed files with 10 additions and 5 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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"}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue