-
Notifications
You must be signed in to change notification settings - Fork 879
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor HTTP attributes extractors to use composition over inheritan…
…ce (#5267) * Refactor HTTP attributes extractors to use composition over inheritance * Rename remaining variables: *Extractor to *Getter
- Loading branch information
Mateusz Rzeszutek
authored
Jan 31, 2022
1 parent
cf6f9b7
commit 8b767ac
Showing
109 changed files
with
1,293 additions
and
1,388 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
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
37 changes: 37 additions & 0 deletions
37
...va/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesGetter.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,37 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.api.instrumenter.http; | ||
|
||
import io.opentelemetry.context.Context; | ||
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; | ||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* An interface for getting HTTP client attributes. | ||
* | ||
* <p>Instrumentation authors will create implementations of this interface for their specific | ||
* library/framework. It will be used by the {@link HttpClientAttributesExtractor} to obtain the | ||
* various HTTP client attributes in a type-generic way. | ||
*/ | ||
public interface HttpClientAttributesGetter<REQUEST, RESPONSE> | ||
extends HttpCommonAttributesGetter<REQUEST, RESPONSE> { | ||
|
||
// Attributes that always exist in a request | ||
|
||
@Nullable | ||
String url(REQUEST request); | ||
|
||
// Attributes which are not always available when the request is ready. | ||
|
||
/** | ||
* Extracts the {@code http.flavor} span attribute. | ||
* | ||
* <p>This is called from {@link Instrumenter#end(Context, Object, Object, Throwable)}, whether | ||
* {@code response} is {@code null} or not. | ||
*/ | ||
@Nullable | ||
String flavor(REQUEST request, @Nullable RESPONSE response); | ||
} |
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
Oops, something went wrong.