@@ -155,7 +155,7 @@ public override Task<TResponse> RequestAsync<TResponse>(
155155 in OpenTelemetryData openTelemetryData ,
156156 CancellationToken cancellationToken = default )
157157 => RequestCoreAsync < TResponse > ( true , method , path , data , requestParameters , openTelemetryData , cancellationToken ) . AsTask ( ) ;
158-
158+
159159 private async ValueTask < TResponse > RequestCoreAsync < TResponse > (
160160 bool isAsync ,
161161 HttpMethod method ,
@@ -185,28 +185,28 @@ private async ValueTask<TResponse> RequestCoreAsync<TResponse>(
185185 Settings . OnRequestDataCreated ? . Invoke ( requestData ) ;
186186 TResponse response = null ;
187187
188- if ( OpenTelemetry . ElasticTransportActivitySource . HasListeners ( ) && activity . IsAllDataRequested )
188+ if ( activity is { IsAllDataRequested : true } )
189189 {
190190 if ( activity . IsAllDataRequested )
191191 OpenTelemetry . SetCommonAttributes ( activity , openTelemetryData , Settings ) ;
192192
193193 if ( Settings . Authentication is BasicAuthentication basicAuthentication )
194- activity ? . SetTag ( SemanticConventions . DbUser , basicAuthentication . Username ) ;
194+ activity . SetTag ( SemanticConventions . DbUser , basicAuthentication . Username ) ;
195195
196- activity ? . SetTag ( OpenTelemetryAttributes . ElasticTransportProductName , Settings . ProductRegistration . Name ) ;
197- activity ? . SetTag ( OpenTelemetryAttributes . ElasticTransportProductVersion , Settings . ProductRegistration . ProductAssemblyVersion ) ;
198- activity ? . SetTag ( OpenTelemetryAttributes . ElasticTransportVersion , TransportVersion ) ;
199- activity ? . SetTag ( SemanticConventions . UserAgentOriginal , Settings . UserAgent . ToString ( ) ) ;
196+ activity . SetTag ( OpenTelemetryAttributes . ElasticTransportProductName , Settings . ProductRegistration . Name ) ;
197+ activity . SetTag ( OpenTelemetryAttributes . ElasticTransportProductVersion , Settings . ProductRegistration . ProductAssemblyVersion ) ;
198+ activity . SetTag ( OpenTelemetryAttributes . ElasticTransportVersion , TransportVersion ) ;
199+ activity . SetTag ( SemanticConventions . UserAgentOriginal , Settings . UserAgent . ToString ( ) ) ;
200200
201201 if ( openTelemetryData . SpanAttributes is not null )
202202 {
203- foreach ( var attribute in requestData . OpenTelemetryData . SpanAttributes )
203+ foreach ( var attribute in openTelemetryData . SpanAttributes )
204204 {
205- activity ? . SetTag ( attribute . Key , attribute . Value ) ;
205+ activity . SetTag ( attribute . Key , attribute . Value ) ;
206206 }
207207 }
208208
209- activity ? . SetTag ( SemanticConventions . HttpRequestMethod , requestData . Method . GetStringValue ( ) ) ;
209+ activity . SetTag ( SemanticConventions . HttpRequestMethod , requestData . Method . GetStringValue ( ) ) ;
210210 }
211211
212212 List < PipelineException > ? seenExceptions = null ;
0 commit comments