1414// limitations under the License.
1515// </copyright>
1616
17+ #nullable enable
18+
1719using System . Diagnostics ;
1820using System . Diagnostics . Tracing ;
1921
@@ -39,15 +41,6 @@ public void SpanProcessorException(string evnt, Exception ex)
3941 }
4042 }
4143
42- [ NonEvent ]
43- public void TracestateExtractException ( Exception ex )
44- {
45- if ( this . IsEnabled ( EventLevel . Warning , EventKeywords . All ) )
46- {
47- this . TracestateExtractError ( ex . ToInvariantString ( ) ) ;
48- }
49- }
50-
5144 [ NonEvent ]
5245 public void MetricObserverCallbackException ( Exception exception )
5346 {
@@ -147,12 +140,6 @@ public void DroppedExportProcessorItems(string exportProcessorName, string expor
147140 }
148141 }
149142
150- [ Event ( 3 , Message = "Exporter returned error '{0}'." , Level = EventLevel . Warning ) ]
151- public void ExporterErrorResult ( ExportResult exportResult )
152- {
153- this . WriteEvent ( 3 , exportResult ) ;
154- }
155-
156143 [ Event ( 4 , Message = "Unknown error in SpanProcessor event '{0}': '{1}'." , Level = EventLevel . Error ) ]
157144 public void SpanProcessorException ( string evnt , string ex )
158145 {
@@ -165,12 +152,6 @@ public void InvalidArgument(string methodName, string argumentName, string issue
165152 this . WriteEvent ( 8 , methodName , argumentName , issue ) ;
166153 }
167154
168- [ Event ( 14 , Message = "Tracestate parse error: '{0}'" , Level = EventLevel . Warning ) ]
169- public void TracestateExtractError ( string error )
170- {
171- this . WriteEvent ( 14 , error ) ;
172- }
173-
174155 [ Event ( 16 , Message = "Exception occurred while invoking Observable instrument callback. Exception: '{0}'" , Level = EventLevel . Warning ) ]
175156 public void ObservableInstrumentCallbackException ( string exception )
176157 {
@@ -184,7 +165,7 @@ public void ActivityStarted(string name, string id)
184165 }
185166
186167 [ Event ( 25 , Message = "Activity stopped. Name = '{0}', Id = '{1}'." , Level = EventLevel . Verbose ) ]
187- public void ActivityStopped ( string name , string id )
168+ public void ActivityStopped ( string name , string ? id )
188169 {
189170 this . WriteEvent ( 25 , name , id ) ;
190171 }
@@ -298,7 +279,7 @@ public void TracerProviderSdkEvent(string message)
298279 }
299280
300281 [ Event ( 47 , Message = "{0} environment variable has an invalid value: '{1}'" , Level = EventLevel . Warning ) ]
301- public void InvalidEnvironmentVariable ( string key , string value )
282+ public void InvalidEnvironmentVariable ( string key , string ? value )
302283 {
303284 this . WriteEvent ( 47 , key , value ) ;
304285 }
@@ -321,7 +302,7 @@ public override void Dispose()
321302
322303 protected override void OnEventSourceCreated ( EventSource eventSource )
323304 {
324- if ( eventSource ? . Name . StartsWith ( "OpenTelemetry" , StringComparison . OrdinalIgnoreCase ) == true )
305+ if ( eventSource . Name . StartsWith ( "OpenTelemetry" , StringComparison . OrdinalIgnoreCase ) )
325306 {
326307 this . eventSources . Add ( eventSource ) ;
327308 this . EnableEvents ( eventSource , EventLevel . Verbose , EventKeywords . All ) ;
@@ -332,8 +313,8 @@ protected override void OnEventSourceCreated(EventSource eventSource)
332313
333314 protected override void OnEventWritten ( EventWrittenEventArgs e )
334315 {
335- string message ;
336- if ( e . Message != null && ( e . Payload ? . Count ?? 0 ) > 0 )
316+ string ? message ;
317+ if ( e . Message != null && e . Payload != null && e . Payload . Count > 0 )
337318 {
338319 message = string . Format ( e . Message , e . Payload . ToArray ( ) ) ;
339320 }
0 commit comments