@@ -155,7 +155,7 @@ public override Task<TResponse> RequestAsync<TResponse>(
155
155
in OpenTelemetryData openTelemetryData ,
156
156
CancellationToken cancellationToken = default )
157
157
=> RequestCoreAsync < TResponse > ( true , method , path , data , requestParameters , openTelemetryData , cancellationToken ) . AsTask ( ) ;
158
-
158
+
159
159
private async ValueTask < TResponse > RequestCoreAsync < TResponse > (
160
160
bool isAsync ,
161
161
HttpMethod method ,
@@ -185,28 +185,28 @@ private async ValueTask<TResponse> RequestCoreAsync<TResponse>(
185
185
Settings . OnRequestDataCreated ? . Invoke ( requestData ) ;
186
186
TResponse response = null ;
187
187
188
- if ( OpenTelemetry . ElasticTransportActivitySource . HasListeners ( ) && activity . IsAllDataRequested )
188
+ if ( activity is { IsAllDataRequested : true } )
189
189
{
190
190
if ( activity . IsAllDataRequested )
191
191
OpenTelemetry . SetCommonAttributes ( activity , openTelemetryData , Settings ) ;
192
192
193
193
if ( Settings . Authentication is BasicAuthentication basicAuthentication )
194
- activity ? . SetTag ( SemanticConventions . DbUser , basicAuthentication . Username ) ;
194
+ activity . SetTag ( SemanticConventions . DbUser , basicAuthentication . Username ) ;
195
195
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 ( ) ) ;
200
200
201
201
if ( openTelemetryData . SpanAttributes is not null )
202
202
{
203
- foreach ( var attribute in requestData . OpenTelemetryData . SpanAttributes )
203
+ foreach ( var attribute in openTelemetryData . SpanAttributes )
204
204
{
205
- activity ? . SetTag ( attribute . Key , attribute . Value ) ;
205
+ activity . SetTag ( attribute . Key , attribute . Value ) ;
206
206
}
207
207
}
208
208
209
- activity ? . SetTag ( SemanticConventions . HttpRequestMethod , requestData . Method . GetStringValue ( ) ) ;
209
+ activity . SetTag ( SemanticConventions . HttpRequestMethod , requestData . Method . GetStringValue ( ) ) ;
210
210
}
211
211
212
212
List < PipelineException > ? seenExceptions = null ;
0 commit comments