@@ -70,6 +70,12 @@ def tag_root_span_with_error(self, exception):
7070 be implemented for OTEL.
7171 """
7272
73+ @abstractmethod
74+ def set_local_root_span_name (self , name , group = None , priority = None ):
75+ """
76+ Sets the name, group, and priority for a span.
77+ """
78+
7379
7480class NewRelicBackend (TelemetryBackend ):
7581 """
@@ -108,6 +114,9 @@ def tag_root_span_with_error(self, exception):
108114 # Does not need to be implemented for NewRelic, because it is handled automatically.
109115 pass
110116
117+ def set_local_root_span_name (self , name , group = None , priority = None ):
118+ newrelic .agent .set_transaction_name (name , group , priority )
119+
111120
112121class OpenTelemetryBackend (TelemetryBackend ):
113122 """
@@ -137,6 +146,10 @@ def tag_root_span_with_error(self, exception):
137146 # Currently, this is not implemented for OTel
138147 pass
139148
149+ def set_local_root_span_name (self , name , group = None , priority = None ):
150+ # Currently this is not implemented
151+ pass
152+
140153
141154class DatadogBackend (TelemetryBackend ):
142155 """
@@ -165,6 +178,11 @@ def tag_root_span_with_error(self, exception):
165178 root_span = self .dd_tracer .current_root_span ()
166179 root_span .set_exc_info (type (exception ), exception , exception .__traceback__ )
167180
181+ def set_local_root_span_name (self , name , group = None , priority = None ):
182+ # For Datadog, this updates the 'resource_name' to the given name.
183+ local_root_span = self .dd_tracer .current_root_span ()
184+ local_root_span .resource = name
185+
168186
169187# We're using an lru_cache instead of assigning the result to a variable on
170188# module load. With the default settings (pointing to a TelemetryBackend
0 commit comments