File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ module Ext
22
22
23
23
TAG_KIND = 'span.kind'
24
24
25
+ # Set this tag to `1.0` if the span is a Service Entry span.
26
+ TAG_TOP_LEVEL = '_dd.top_level'
27
+
25
28
# Defines constants for trace analytics
26
29
# @public_api
27
30
module Analytics
Original file line number Diff line number Diff line change @@ -110,6 +110,9 @@ def initialize(
110
110
@duration = duration
111
111
112
112
@service_entry = service_entry
113
+
114
+ # Mark with the service entry span metric, if applicable
115
+ set_metric ( Metadata ::Ext ::TAG_TOP_LEVEL , 1.0 ) if service_entry
113
116
end
114
117
115
118
# Return whether the duration is started or not
Original file line number Diff line number Diff line change 51
51
end
52
52
end
53
53
end
54
+
55
+ context 'service_entry' do
56
+ context 'with nil' do
57
+ let ( :span_options ) { { service_entry : nil } }
58
+
59
+ it 'does not tag as top-level' do
60
+ expect ( span ) . to_not have_metadata ( '_dd.top_level' )
61
+ end
62
+ end
63
+
64
+ context 'with false' do
65
+ let ( :span_options ) { { service_entry : false } }
66
+
67
+ it 'does not tag as top-level' do
68
+ expect ( span ) . to_not have_metadata ( '_dd.top_level' )
69
+ end
70
+ end
71
+
72
+ context 'with true' do
73
+ let ( :span_options ) { { service_entry : true } }
74
+
75
+ it 'tags as top-level' do
76
+ expect ( span ) . to have_metadata ( '_dd.top_level' => 1.0 )
77
+ end
78
+ end
79
+ end
54
80
end
55
81
56
82
context 'ids' do
You can’t perform that action at this time.
0 commit comments