File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 11# Imports
22import logging
33from typing import Optional
4-
54from guardrails .settings import settings
5+ from guardrails .version import GUARDRAILS_VERSION
66from opentelemetry .exporter .otlp .proto .http .trace_exporter import ( # HTTP Exporter
77 OTLPSpanExporter ,
88)
9- from opentelemetry .sdk .resources import SERVICE_NAME , Resource
9+ from opentelemetry .sdk .resources import (
10+ SERVICE_NAME ,
11+ Resource ,
12+ SERVICE_VERSION ,
13+ DEPLOYMENT_ENVIRONMENT ,
14+ )
1015from opentelemetry .sdk .trace import TracerProvider
1116from opentelemetry .sdk .trace .export import ConsoleSpanExporter , BatchSpanProcessor
1217from opentelemetry .trace .propagation .tracecontext import TraceContextTextMapPropagator
@@ -68,7 +73,12 @@ def initialize_tracer(
6873
6974 # Create a resource
7075 # Service name is required for most backends
71- self ._resource = Resource (attributes = {SERVICE_NAME : self ._service_name })
76+ attributes = {
77+ SERVICE_NAME : self ._service_name ,
78+ SERVICE_VERSION : GUARDRAILS_VERSION ,
79+ DEPLOYMENT_ENVIRONMENT : "production" ,
80+ }
81+ self ._resource = Resource (attributes = attributes )
7282
7383 # Create a tracer provider and a processor
7484 self ._tracer_provider = TracerProvider (resource = self ._resource )
You can’t perform that action at this time.
0 commit comments