@@ -21,13 +21,13 @@ internal static ZipkinSpan ToZipkinSpan(this Activity activity, ZipkinEndpoint l
2121 {
2222 var context = activity . Context ;
2323
24- string parentId = activity . ParentSpanId == default ?
24+ string ? parentId = activity . ParentSpanId == default ?
2525 null
2626 : EncodeSpanId ( activity . ParentSpanId ) ;
2727
2828 var tagState = new TagEnumerationState
2929 {
30- Tags = PooledList < KeyValuePair < string , object > > . Create ( ) ,
30+ Tags = PooledList < KeyValuePair < string , object ? > > . Create ( ) ,
3131 } ;
3232
3333 tagState . EnumerateTags ( activity ) ;
@@ -38,26 +38,26 @@ internal static ZipkinSpan ToZipkinSpan(this Activity activity, ZipkinEndpoint l
3838 {
3939 if ( activity . Status == ActivityStatusCode . Ok )
4040 {
41- PooledList < KeyValuePair < string , object > > . Add (
41+ PooledList < KeyValuePair < string , object ? > > . Add (
4242 ref tagState . Tags ,
43- new KeyValuePair < string , object > (
43+ new KeyValuePair < string , object ? > (
4444 SpanAttributeConstants . StatusCodeKey ,
4545 "OK" ) ) ;
4646 }
4747
4848 // activity.Status is Error
4949 else
5050 {
51- PooledList < KeyValuePair < string , object > > . Add (
51+ PooledList < KeyValuePair < string , object ? > > . Add (
5252 ref tagState . Tags ,
53- new KeyValuePair < string , object > (
53+ new KeyValuePair < string , object ? > (
5454 SpanAttributeConstants . StatusCodeKey ,
5555 "ERROR" ) ) ;
5656
5757 // Error flag rule from https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/zipkin.md#status
58- PooledList < KeyValuePair < string , object > > . Add (
58+ PooledList < KeyValuePair < string , object ? > > . Add (
5959 ref tagState . Tags ,
60- new KeyValuePair < string , object > (
60+ new KeyValuePair < string , object ? > (
6161 ZipkinErrorFlagTagName ,
6262 activity . StatusDescription ?? string . Empty ) ) ;
6363 }
@@ -67,18 +67,18 @@ internal static ZipkinSpan ToZipkinSpan(this Activity activity, ZipkinEndpoint l
6767 // activity status takes precedence over status tag.
6868 else if ( tagState . StatusCode . HasValue && tagState . StatusCode != StatusCode . Unset )
6969 {
70- PooledList < KeyValuePair < string , object > > . Add (
70+ PooledList < KeyValuePair < string , object ? > > . Add (
7171 ref tagState . Tags ,
72- new KeyValuePair < string , object > (
72+ new KeyValuePair < string , object ? > (
7373 SpanAttributeConstants . StatusCodeKey ,
7474 StatusHelper . GetTagValueForStatusCode ( tagState . StatusCode . Value ) ) ) ;
7575
7676 // Error flag rule from https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/zipkin.md#status
7777 if ( tagState . StatusCode == StatusCode . Error )
7878 {
79- PooledList < KeyValuePair < string , object > > . Add (
79+ PooledList < KeyValuePair < string , object ? > > . Add (
8080 ref tagState . Tags ,
81- new KeyValuePair < string , object > (
81+ new KeyValuePair < string , object ? > (
8282 ZipkinErrorFlagTagName ,
8383 tagState . StatusDescription ?? string . Empty ) ) ;
8484 }
@@ -87,30 +87,30 @@ internal static ZipkinSpan ToZipkinSpan(this Activity activity, ZipkinEndpoint l
8787 var activitySource = activity . Source ;
8888 if ( ! string . IsNullOrEmpty ( activitySource . Name ) )
8989 {
90- PooledList < KeyValuePair < string , object > > . Add ( ref tagState . Tags , new KeyValuePair < string , object > ( "otel.scope.name" , activitySource . Name ) ) ;
90+ PooledList < KeyValuePair < string , object ? > > . Add ( ref tagState . Tags , new KeyValuePair < string , object ? > ( "otel.scope.name" , activitySource . Name ) ) ;
9191
9292 // otel.library.name is deprecated, but has to be propagated according to https://github.com/open-telemetry/opentelemetry-specification/blob/v1.31.0/specification/common/mapping-to-non-otlp.md#instrumentationscope
93- PooledList < KeyValuePair < string , object > > . Add ( ref tagState . Tags , new KeyValuePair < string , object > ( "otel.library.name" , activitySource . Name ) ) ;
93+ PooledList < KeyValuePair < string , object ? > > . Add ( ref tagState . Tags , new KeyValuePair < string , object ? > ( "otel.library.name" , activitySource . Name ) ) ;
9494 if ( ! string . IsNullOrEmpty ( activitySource . Version ) )
9595 {
96- PooledList < KeyValuePair < string , object > > . Add ( ref tagState . Tags , new KeyValuePair < string , object > ( "otel.scope.version" , activitySource . Version ) ) ;
96+ PooledList < KeyValuePair < string , object ? > > . Add ( ref tagState . Tags , new KeyValuePair < string , object ? > ( "otel.scope.version" , activitySource . Version ) ) ;
9797
9898 // otel.library.version is deprecated, but has to be propagated according to https://github.com/open-telemetry/opentelemetry-specification/blob/v1.31.0/specification/common/mapping-to-non-otlp.md#instrumentationscope
99- PooledList < KeyValuePair < string , object > > . Add ( ref tagState . Tags , new KeyValuePair < string , object > ( "otel.library.version" , activitySource . Version ) ) ;
99+ PooledList < KeyValuePair < string , object ? > > . Add ( ref tagState . Tags , new KeyValuePair < string , object ? > ( "otel.library.version" , activitySource . Version ) ) ;
100100 }
101101 }
102102
103- ZipkinEndpoint remoteEndpoint = null ;
103+ ZipkinEndpoint ? remoteEndpoint = null ;
104104 if ( activity . Kind == ActivityKind . Client || activity . Kind == ActivityKind . Producer )
105105 {
106- PeerServiceResolver . Resolve ( ref tagState , out string peerServiceName , out bool addAsTag ) ;
106+ PeerServiceResolver . Resolve ( ref tagState , out string ? peerServiceName , out bool addAsTag ) ;
107107
108108 if ( peerServiceName != null )
109109 {
110110 remoteEndpoint = RemoteEndpointCache . GetOrAdd ( ( peerServiceName , default ) , ZipkinEndpoint . Create ) ;
111111 if ( addAsTag )
112112 {
113- PooledList < KeyValuePair < string , object > > . Add ( ref tagState . Tags , new KeyValuePair < string , object > ( SemanticConventions . AttributePeerService , peerServiceName ) ) ;
113+ PooledList < KeyValuePair < string , object ? > > . Add ( ref tagState . Tags , new KeyValuePair < string , object ? > ( SemanticConventions . AttributePeerService , peerServiceName ) ) ;
114114 }
115115 }
116116 }
@@ -172,7 +172,7 @@ private static string EncodeTraceId(ActivityTraceId traceId, bool useShortTraceI
172172 return id ;
173173 }
174174
175- private static string ToActivityKind ( Activity activity )
175+ private static string ? ToActivityKind ( Activity activity )
176176 {
177177 return activity . Kind switch
178178 {
@@ -186,15 +186,15 @@ private static string ToActivityKind(Activity activity)
186186
187187 internal struct TagEnumerationState : PeerServiceResolver . IPeerServiceState
188188 {
189- public PooledList < KeyValuePair < string , object > > Tags ;
189+ public PooledList < KeyValuePair < string , object ? > > Tags ;
190190
191- public string PeerService { get ; set ; }
191+ public string ? PeerService { get ; set ; }
192192
193193 public int ? PeerServicePriority { get ; set ; }
194194
195- public string HostName { get ; set ; }
195+ public string ? HostName { get ; set ; }
196196
197- public string IpAddress { get ; set ; }
197+ public string ? IpAddress { get ; set ; }
198198
199199 public long Port { get ; set ; }
200200
@@ -239,7 +239,7 @@ public void EnumerateTags(Activity activity)
239239 PeerServiceResolver . InspectTag ( ref this , key , intVal ) ;
240240 }
241241
242- PooledList < KeyValuePair < string , object > > . Add ( ref this . Tags , tag ) ;
242+ PooledList < KeyValuePair < string , object ? > > . Add ( ref this . Tags , tag ) ;
243243 }
244244 }
245245 }
0 commit comments