@@ -37,15 +37,15 @@ public TracerTests()
37
37
[ Fact ]
38
38
public void StartActive_SetOperationName_OperationNameIsSet ( )
39
39
{
40
- var scope = _tracer . StartActive ( "Operation" , null ) ;
40
+ var scope = _tracer . StartActive ( "Operation" ) ;
41
41
42
42
Assert . Equal ( "Operation" , scope . Span . OperationName ) ;
43
43
}
44
44
45
45
[ Fact ]
46
46
public void StartActive_SetOperationName_ActiveScopeIsSet ( )
47
47
{
48
- var scope = _tracer . StartActive ( "Operation" , null ) ;
48
+ var scope = _tracer . StartActive ( "Operation" ) ;
49
49
50
50
var activeScope = _tracer . ActiveScope ;
51
51
Assert . Equal ( scope , activeScope ) ;
@@ -54,7 +54,7 @@ public void StartActive_SetOperationName_ActiveScopeIsSet()
54
54
[ Fact ]
55
55
public void StartActive_NoActiveScope_RootSpan ( )
56
56
{
57
- var scope = ( Scope ) _tracer . StartActive ( "Operation" , null ) ;
57
+ var scope = ( Scope ) _tracer . StartActive ( "Operation" ) ;
58
58
var span = scope . Span ;
59
59
60
60
Assert . True ( span . IsRootSpan ) ;
@@ -113,7 +113,8 @@ public void StartActive_FinishOnClose_SpanIsFinishedWhenScopeIsDisposed()
113
113
[ Fact ]
114
114
public void StartActive_NoFinishOnClose_SpanIsNotFinishedWhenScopeIsClosed ( )
115
115
{
116
- var scope = ( Scope ) _tracer . StartActive ( "Operation" , finishOnClose : false ) ;
116
+ var spanCreationSettings = new SpanCreationSettings ( ) { FinishOnClose = false } ;
117
+ var scope = ( Scope ) _tracer . StartActive ( "Operation" , spanCreationSettings ) ;
117
118
var span = scope . Span ;
118
119
Assert . False ( span . IsFinished ) ;
119
120
@@ -127,7 +128,9 @@ public void StartActive_NoFinishOnClose_SpanIsNotFinishedWhenScopeIsClosed()
127
128
public void StartActive_SetParentManually_ParentIsSet ( )
128
129
{
129
130
var parent = _tracer . StartSpan ( "Parent" ) ;
130
- var childScope = ( Scope ) _tracer . StartActive ( "Child" , parent . Context ) ;
131
+
132
+ var spanCreationSettings = new SpanCreationSettings ( ) { Parent = parent . Context } ;
133
+ var childScope = ( Scope ) _tracer . StartActive ( "Child" , spanCreationSettings ) ;
131
134
var childSpan = childScope . Span ;
132
135
133
136
Assert . Equal ( parent . Context , childSpan . Context . Parent ) ;
@@ -141,7 +144,8 @@ public void StartActive_SetParentManuallyFromExternalContext_ParentIsSet()
141
144
const SamplingPriority samplingPriority = SamplingPriority . UserKeep ;
142
145
143
146
var parent = new SpanContext ( traceId , parentId , samplingPriority ) ;
144
- var child = ( Scope ) _tracer . StartActive ( "Child" , parent ) ;
147
+ var spanCreationSettings = new SpanCreationSettings ( ) { Parent = parent } ;
148
+ var child = ( Scope ) _tracer . StartActive ( "Child" , spanCreationSettings ) ;
145
149
var childSpan = child . Span ;
146
150
147
151
Assert . True ( childSpan . IsRootSpan ) ;
@@ -165,15 +169,17 @@ public void StartActive_NoServiceName_DefaultServiceName()
165
169
[ Fact ]
166
170
public void StartActive_SetServiceName_ServiceNameIsSet ( )
167
171
{
168
- var scope = _tracer . StartActive ( "Operation" , serviceName : "MyAwesomeService" ) ;
172
+ var scope = _tracer . StartActive ( "Operation" ) ;
173
+ scope . Span . ServiceName = "MyAwesomeService" ;
169
174
170
175
Assert . Equal ( "MyAwesomeService" , scope . Span . ServiceName ) ;
171
176
}
172
177
173
178
[ Fact ]
174
179
public void StartActive_SetParentServiceName_ChildServiceNameIsDefaultServiceName ( )
175
180
{
176
- var parent = _tracer . StartActive ( "Parent" , serviceName : "MyAwesomeService" ) ;
181
+ var parent = _tracer . StartActive ( "Parent" ) ;
182
+ parent . Span . ServiceName = "MyAwesomeService" ;
177
183
var child = _tracer . StartActive ( "Child" ) ;
178
184
179
185
Assert . NotEqual ( "MyAwesomeService" , child . Span . ServiceName ) ;
@@ -184,7 +190,8 @@ public void StartActive_SetParentServiceName_ChildServiceNameIsDefaultServiceNam
184
190
public void StartActive_SetStartTime_StartTimeIsProperlySet ( )
185
191
{
186
192
var startTime = new DateTimeOffset ( 2017 , 01 , 01 , 0 , 0 , 0 , TimeSpan . Zero ) ;
187
- var scope = _tracer . StartActive ( "Operation" , startTime : startTime ) ;
193
+ var spanCreationSettings = new SpanCreationSettings ( ) { StartTime = startTime } ;
194
+ var scope = _tracer . StartActive ( "Operation" , spanCreationSettings ) ;
188
195
var span = ( Span ) scope . Span ;
189
196
190
197
Assert . Equal ( startTime , span . StartTime ) ;
@@ -360,14 +367,16 @@ public void OriginHeader_RootSpanTag()
360
367
var propagatedContext = new SpanContext ( traceId , spanId , samplingPriority , null , origin ) ;
361
368
Assert . Equal ( origin , propagatedContext . Origin ) ;
362
369
363
- using var firstScope = ( Scope ) _tracer . StartActive ( "First Span" , propagatedContext ) ;
370
+ var spanCreationSettings = new SpanCreationSettings ( ) { Parent = propagatedContext } ;
371
+ using var firstScope = ( Scope ) _tracer . StartActive ( "First Span" , spanCreationSettings ) ;
364
372
var firstSpan = ( Span ) firstScope . Span ;
365
373
366
374
Assert . True ( firstSpan . IsRootSpan ) ;
367
375
Assert . Equal ( origin , firstSpan . Context . Origin ) ;
368
376
Assert . Equal ( origin , firstSpan . GetTag ( Tags . Origin ) ) ;
369
377
370
- using var secondScope = ( Scope ) _tracer . StartActive ( "Child" , firstSpan . Context ) ;
378
+ var spanCreationSettings2 = new SpanCreationSettings ( ) { Parent = firstSpan . Context } ;
379
+ using var secondScope = ( Scope ) _tracer . StartActive ( "Child" , spanCreationSettings2 ) ;
371
380
var secondSpan = ( Span ) secondScope . Span ;
372
381
373
382
Assert . False ( secondSpan . IsRootSpan ) ;
@@ -385,10 +394,12 @@ public void OriginHeader_InjectFromChildSpan()
385
394
386
395
var propagatedContext = new SpanContext ( traceId , spanId , samplingPriority , null , origin ) ;
387
396
388
- using var firstScope = ( Scope ) _tracer . StartActive ( "First Span" , propagatedContext ) ;
397
+ var spanCreationSettings = new SpanCreationSettings ( ) { Parent = propagatedContext } ;
398
+ using var firstScope = ( Scope ) _tracer . StartActive ( "First Span" , spanCreationSettings ) ;
389
399
var firstSpan = firstScope . Span ;
390
400
391
- using var secondScope = ( Scope ) _tracer . StartActive ( "Child" , firstSpan . Context ) ;
401
+ var spanCreationSettings2 = new SpanCreationSettings ( ) { Parent = firstSpan . Context } ;
402
+ using var secondScope = ( Scope ) _tracer . StartActive ( "Child" , spanCreationSettings2 ) ;
392
403
var secondSpan = secondScope . Span ;
393
404
394
405
IHeadersCollection headers = WebRequest . CreateHttp ( "http://localhost" ) . Headers . Wrap ( ) ;
0 commit comments