Skip to content

Commit 3e8b874

Browse files
committed
Add attr to compressed spans
1 parent 179eb12 commit 3e8b874

File tree

2 files changed

+39
-7
lines changed

2 files changed

+39
-7
lines changed

newrelic/_version.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# file generated by setuptools-scm
2+
# don't change, don't track in version control
3+
4+
__all__ = [
5+
"__version__",
6+
"__version_tuple__",
7+
"version",
8+
"version_tuple",
9+
"__commit_id__",
10+
"commit_id",
11+
]
12+
13+
TYPE_CHECKING = False
14+
if TYPE_CHECKING:
15+
from typing import Tuple
16+
from typing import Union
17+
18+
VERSION_TUPLE = Tuple[Union[int, str], ...]
19+
COMMIT_ID = Union[str, None]
20+
else:
21+
VERSION_TUPLE = object
22+
COMMIT_ID = object
23+
24+
version: str
25+
__version__: str
26+
__version_tuple__: VERSION_TUPLE
27+
version_tuple: VERSION_TUPLE
28+
commit_id: COMMIT_ID
29+
__commit_id__: COMMIT_ID
30+
31+
__version__ = version = '11.0.1.dev11+g9c04efa33'
32+
__version_tuple__ = version_tuple = (11, 0, 1, 'dev11', 'g9c04efa33')
33+
34+
__commit_id__ = commit_id = 'g9c04efa33'

newrelic/core/node_mixin.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717

1818

1919
class GenericNodeMixin:
20-
def __init__(self, *args, **kwargs):
21-
self.ids = []
22-
2320
@property
2421
def processed_user_attributes(self):
2522
if hasattr(self, "_processed_user_attributes"):
@@ -76,7 +73,7 @@ def span_event(self, settings, base_attrs=None, parent_guid=None, attr_class=dic
7673
u_attrs = self.processed_user_attributes
7774
if settings.distributed_tracing.unique_spans.enabled:
7875
# ids is the list of span guids that share this unqiue exit span.
79-
u_attrs["nr.ids"] = self.ids
76+
u_attrs["nr.ids"] = []
8077

8178
u_attrs = attribute.resolve_user_attributes(
8279
u_attrs, settings.attribute_filter, DST_SPAN_EVENTS, attr_class=attr_class
@@ -108,14 +105,15 @@ def span_event(self, settings, base_attrs=None, parent_guid=None, attr_class=dic
108105
new_exit_span = span_attrs not in ct_exit_spans
109106
# If this is a new exit span, add it to the known ct_exit_spans and return it.
110107
if new_exit_span:
111-
ct_exit_spans[span_attrs] = [self.ids, i_attrs]
108+
u_attrs["nr.durations"] = self.duration
109+
ct_exit_spans[span_attrs] = [u_attrs]
112110
ct_processing_time[0] += (time.time() - start_time)
113111
return [i_attrs, u_attrs, a_minimized_attrs] if settings.distributed_tracing.minimize_attributes.enabled else [i_attrs, u_attrs, a_attrs]
114112
# If this is an exit span we've already seen, add it's guid to the list
115113
# of ids on the seen span and return None.
116114
# For now add ids to user attributes list
117-
ct_exit_spans[span_attrs][0].append(self.guid)
118-
ct_exit_spans[span_attrs][1]["duration"] += self.duration
115+
ct_exit_spans[span_attrs][0]["nr.ids"].append(self.guid)
116+
ct_exit_spans[span_attrs][0]["nr.durations"] += self.duration
119117

120118
ct_processing_time[0] += (time.time() - start_time)
121119
return None

0 commit comments

Comments
 (0)