-
Notifications
You must be signed in to change notification settings - Fork 881
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suppress nested http client spans in aws2 instrumentation (#9634)
- Loading branch information
Showing
3 changed files
with
58 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...telemetry/instrumentation/awssdk/v2_2/AwsSdkHttpClientSuppressionAttributesExtractor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.awssdk.v2_2; | ||
|
||
import io.opentelemetry.api.common.AttributesBuilder; | ||
import io.opentelemetry.context.Context; | ||
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; | ||
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesExtractor; | ||
import io.opentelemetry.instrumentation.api.internal.SpanKey; | ||
import io.opentelemetry.instrumentation.api.internal.SpanKeyProvider; | ||
import javax.annotation.Nullable; | ||
import software.amazon.awssdk.core.interceptor.ExecutionAttributes; | ||
import software.amazon.awssdk.http.SdkHttpResponse; | ||
|
||
/** | ||
* An attribute extractor that reports implementing HTTP client semantic conventions. Adding this | ||
* extractor suppresses nested HTTP client instrumentations similarly to how using {@link | ||
* HttpClientAttributesExtractor} would. | ||
*/ | ||
class AwsSdkHttpClientSuppressionAttributesExtractor | ||
implements AttributesExtractor<ExecutionAttributes, SdkHttpResponse>, SpanKeyProvider { | ||
|
||
@Override | ||
public void onStart( | ||
AttributesBuilder attributes, | ||
Context parentContext, | ||
ExecutionAttributes executionAttributes) {} | ||
|
||
@Override | ||
public void onEnd( | ||
AttributesBuilder attributes, | ||
Context context, | ||
ExecutionAttributes executionAttributes, | ||
@Nullable SdkHttpResponse sdkHttpResponse, | ||
@Nullable Throwable error) {} | ||
|
||
@Nullable | ||
@Override | ||
public SpanKey internalGetSpanKey() { | ||
return SpanKey.HTTP_CLIENT; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters