Skip to content

Commit 53b4c30

Browse files
committed
Fix bug in span_event inheritance
1 parent 6fbf25c commit 53b4c30

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

newrelic/core/external_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,4 @@ def span_event(self, settings, base_attrs=None, parent_guid=None, attr_class=dic
180180
if self.method:
181181
_, i_attrs["http.method"] = attribute.process_user_attribute("http.method", self.method)
182182

183-
return super().span_event(settings, base_attrs=base_attrs, parent_guid=parent_guid, attr_class=attr_class, *args, **kwargs)
183+
return super().span_event(settings, base_attrs=i_attrs, parent_guid=parent_guid, attr_class=attr_class, *args, **kwargs)

newrelic/core/function_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,4 @@ def span_event(self, settings, base_attrs=None, parent_guid=None, attr_class=dic
118118
i_attrs = base_attrs and base_attrs.copy() or attr_class()
119119
i_attrs["name"] = f"{self.group}/{self.name}"
120120

121-
return super().span_event(settings, base_attrs=base_attrs, parent_guid=parent_guid, attr_class=attr_class, *args, **kwargs)
121+
return super().span_event(settings, base_attrs=i_attrs, parent_guid=parent_guid, attr_class=attr_class, *args, **kwargs)

newrelic/core/loop_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ def span_event(self, settings, base_attrs=None, parent_guid=None, attr_class=dic
8383
i_attrs = base_attrs and base_attrs.copy() or attr_class()
8484
i_attrs["name"] = f"EventLoop/Wait/{self.name}"
8585

86-
return super().span_event(settings, base_attrs=base_attrs, parent_guid=parent_guid, attr_class=attr_class, *args, **kwargs)
86+
return super().span_event(settings, base_attrs=i_attrs, parent_guid=parent_guid, attr_class=attr_class, *args, **kwargs)

newrelic/core/node_mixin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ def span_event(self, settings, base_attrs=None, parent_guid=None, attr_class=dic
5757
ct_exit_spans = {}
5858
i_attrs = base_attrs and base_attrs.copy() or attr_class()
5959
i_attrs["type"] = "Span"
60-
i_attrs["name"] = self.name
60+
i_attrs["name"] = i_attrs.get("name") or self.name
6161
i_attrs["guid"] = self.guid
6262
i_attrs["timestamp"] = int(self.start_time * 1000)
6363
i_attrs["duration"] = self.duration
64-
i_attrs["category"] = "generic"
64+
i_attrs["category"] = i_attrs.get("category") or "generic"
6565
# TODO: limit intrinsic attributes but this likely requires changes in the pipeline.
6666
#if settings.distributed_tracing.minimize_attributes.enabled:
6767
# i_ct_attrs = {"type", "name", "guid", "parentId", "transaction.name", "traceId", "timestamp", "duration", "nr.entryPoint", "transactionId"}
@@ -86,7 +86,7 @@ def span_event(self, settings, base_attrs=None, parent_guid=None, attr_class=dic
8686
if settings.distributed_tracing.drop_inprocess_spans.enabled or settings.distributed_tracing.unique_spans.enabled:
8787
exit_span_attrs_present = attribute.SPAN_ENTITY_RELATIONSHIP_ATTRIBUTES & set(a_attrs)
8888
# If this is the entry node, always return it.
89-
if self.__class__.__name__ == "RootNode":
89+
if i_attrs.get("nr.entryPoint"):
9090
ct_processing_time[0] += (time.time() - start_time)
9191
return [i_attrs, u_attrs, {}] if settings.distributed_tracing.minimize_attributes.enabled else [i_attrs, u_attrs, a_attrs]
9292
# If the span is not an exit span, skip it by returning None.
@@ -192,4 +192,4 @@ def span_event(self, settings, base_attrs=None, parent_guid=None, attr_class=dic
192192
except Exception:
193193
pass
194194

195-
return super().span_event(settings, base_attrs=base_attrs, parent_guid=parent_guid, attr_class=attr_class, *args, **kwargs)
195+
return super().span_event(settings, i_attrs=base_attrs, parent_guid=parent_guid, attr_class=attr_class, *args, **kwargs)

newrelic/core/root_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def span_event(self, settings, base_attrs=None, parent_guid=None, attr_class=dic
4646
if self.tracing_vendors:
4747
i_attrs["tracingVendors"] = self.tracing_vendors
4848

49-
return super().span_event(settings, base_attrs=base_attrs, parent_guid=parent_guid, attr_class=attr_class, *args, **kwargs)
49+
return super().span_event(settings, base_attrs=i_attrs, parent_guid=parent_guid, attr_class=attr_class, *args, **kwargs)
5050

5151
def trace_node(self, stats, root, connections):
5252
name = self.path

0 commit comments

Comments
 (0)