5353from opentelemetry .sdk .trace .export import BatchSpanProcessor , SimpleSpanProcessor
5454from opentelemetry .sdk .trace .id_generator import IdGenerator
5555from opentelemetry .sdk .trace .sampling import ParentBasedTraceIdRatio , Sampler
56- from opentelemetry .semconv .resource import ResourceAttributes
5756from rich .console import Console
5857from rich .prompt import Confirm , IntPrompt , Prompt
5958from typing_extensions import Self , Unpack
@@ -574,10 +573,6 @@ def _load_configuration(
574573 self .inspect_arguments = param_manager .load_param ('inspect_arguments' , inspect_arguments )
575574 self .distributed_tracing = param_manager .load_param ('distributed_tracing' , distributed_tracing )
576575 self .ignore_no_config = param_manager .load_param ('ignore_no_config' )
577- if self .inspect_arguments and sys .version_info [:2 ] <= (3 , 8 ):
578- raise LogfireConfigError (
579- 'Inspecting arguments is only supported in Python 3.9+ and only recommended in Python 3.11+.'
580- )
581576
582577 # We save `scrubbing` just so that it can be serialized and deserialized.
583578 if isinstance (scrubbing , dict ):
@@ -765,12 +760,12 @@ def _initialize(self) -> None:
765760
766761 with suppress_instrumentation ():
767762 otel_resource_attributes : dict [str , Any ] = {
768- ResourceAttributes . SERVICE_NAME : self .service_name ,
769- ResourceAttributes . PROCESS_PID : os .getpid (),
763+ 'service.name' : self .service_name ,
764+ 'process.pid' : os .getpid (),
770765 # https://opentelemetry.io/docs/specs/semconv/resource/process/#python-runtimes
771- ResourceAttributes . PROCESS_RUNTIME_NAME : sys .implementation .name ,
772- ResourceAttributes . PROCESS_RUNTIME_VERSION : get_runtime_version (),
773- ResourceAttributes . PROCESS_RUNTIME_DESCRIPTION : sys .version ,
766+ 'process.runtime.name' : sys .implementation .name ,
767+ 'process.runtime.version' : get_runtime_version (),
768+ 'process.runtime.description' : sys .version ,
774769 # Having this giant blob of data associated with every span/metric causes various problems so it's
775770 # disabled for now, but we may want to re-enable something like it in the future
776771 # RESOURCE_ATTRIBUTES_PACKAGE_VERSIONS: json.dumps(collect_package_info(), separators=(',', ':')),
@@ -785,7 +780,7 @@ def _initialize(self) -> None:
785780 if self .code_source .root_path :
786781 otel_resource_attributes [RESOURCE_ATTRIBUTES_CODE_ROOT_PATH ] = self .code_source .root_path
787782 if self .service_version :
788- otel_resource_attributes [ResourceAttributes . SERVICE_VERSION ] = self .service_version
783+ otel_resource_attributes ['service.version' ] = self .service_version
789784 if self .environment :
790785 otel_resource_attributes [RESOURCE_ATTRIBUTES_DEPLOYMENT_ENVIRONMENT_NAME ] = self .environment
791786 otel_resource_attributes_from_env = os .getenv (OTEL_RESOURCE_ATTRIBUTES )
@@ -813,7 +808,7 @@ def _initialize(self) -> None:
813808 # Currently there's a newer version with some differences here:
814809 # https://github.com/open-telemetry/semantic-conventions/blob/e44693245eef815071402b88c3a44a8f7f8f24c8/docs/resource/README.md#service-experimental
815810 # Both recommend generating a UUID.
816- resource = Resource ({ResourceAttributes . SERVICE_INSTANCE_ID : uuid4 ().hex }).merge (resource )
811+ resource = Resource ({'service.instance.id' : uuid4 ().hex }).merge (resource )
817812
818813 head = self .sampling .head
819814 sampler : Sampler | None = None
@@ -843,12 +838,8 @@ def _initialize(self) -> None:
843838
844839 def add_span_processor (span_processor : SpanProcessor ) -> None :
845840 main_multiprocessor .add_span_processor (span_processor )
846- inner_span_processor = span_processor
847- while isinstance (p := getattr (inner_span_processor , 'processor' , None ), SpanProcessor ):
848- inner_span_processor = p
849-
850841 has_pending = isinstance (
851- getattr (inner_span_processor , 'span_exporter' , None ),
842+ getattr (span_processor , 'span_exporter' , None ),
852843 (TestExporter , RemovePendingSpansExporter , SimpleConsoleSpanExporter ),
853844 )
854845 if has_pending :
@@ -1038,7 +1029,7 @@ def check_token():
10381029
10391030 def fix_pid (): # pragma: no cover
10401031 with handle_internal_errors :
1041- new_resource = resource .merge (Resource ({ResourceAttributes . PROCESS_PID : os .getpid ()}))
1032+ new_resource = resource .merge (Resource ({'process.pid' : os .getpid ()}))
10421033 tracer_provider ._resource = new_resource # type: ignore
10431034 meter_provider ._resource = new_resource # type: ignore
10441035 logger_provider ._resource = new_resource # type: ignore
0 commit comments