Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent naming of addAttributesExtractor #12860

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static <REQUEST, RESPONSE> DefaultHttpClientInstrumenterBuilder<REQUEST,
* items. The {@link AttributesExtractor} will be executed after all default extractors.
*/
@CanIgnoreReturnValue
public DefaultHttpClientInstrumenterBuilder<REQUEST, RESPONSE> addAttributeExtractor(
public DefaultHttpClientInstrumenterBuilder<REQUEST, RESPONSE> addAttributesExtractor(
AttributesExtractor<? super REQUEST, ? super RESPONSE> attributesExtractor) {
additionalExtractors.add(attributesExtractor);
return this;
Expand Down Expand Up @@ -190,15 +190,15 @@ public DefaultHttpClientInstrumenterBuilder<REQUEST, RESPONSE> setSpanNameExtrac
@CanIgnoreReturnValue
public DefaultHttpClientInstrumenterBuilder<REQUEST, RESPONSE> setPeerServiceResolver(
PeerServiceResolver peerServiceResolver) {
return addAttributeExtractor(
return addAttributesExtractor(
HttpClientPeerServiceAttributesExtractor.create(attributesGetter, peerServiceResolver));
}

/** Sets the {@code peer.service} attribute for http client spans. */
@CanIgnoreReturnValue
public DefaultHttpClientInstrumenterBuilder<REQUEST, RESPONSE> setPeerService(
String peerService) {
return addAttributeExtractor(AttributesExtractor.constant(PEER_SERVICE, peerService));
return addAttributesExtractor(AttributesExtractor.constant(PEER_SERVICE, peerService));
}

@CanIgnoreReturnValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,27 @@ public final class ApacheHttpClientTelemetryBuilder {
/**
* Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
* items. The {@link AttributesExtractor} will be executed after all default extractors.
*
* @deprecated Use {@link #addAttributesExtractor(AttributesExtractor)} instead.
*/
@Deprecated
@CanIgnoreReturnValue
public ApacheHttpClientTelemetryBuilder addAttributeExtractor(
AttributesExtractor<? super ApacheHttpClientRequest, ? super HttpResponse>
attributesExtractor) {
builder.addAttributeExtractor(attributesExtractor);
builder.addAttributesExtractor(attributesExtractor);
return this;
}

/**
* Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
* items. The {@link AttributesExtractor} will be executed after all default extractors.
*/
@CanIgnoreReturnValue
public ApacheHttpClientTelemetryBuilder addAttributesExtractor(
AttributesExtractor<? super ApacheHttpClientRequest, ? super HttpResponse>
attributesExtractor) {
builder.addAttributesExtractor(attributesExtractor);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public final class ApacheHttpClient5TelemetryBuilder {
public ApacheHttpClient5TelemetryBuilder addAttributeExtractor(
AttributesExtractor<? super ApacheHttpClient5Request, ? super HttpResponse>
attributesExtractor) {
builder.addAttributeExtractor(attributesExtractor);
builder.addAttributesExtractor(attributesExtractor);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public ArmeriaTelemetryBuilder setServerStatusExtractor(
@CanIgnoreReturnValue
public ArmeriaTelemetryBuilder addAttributeExtractor(
AttributesExtractor<? super RequestContext, ? super RequestLog> attributesExtractor) {
clientBuilder.addAttributeExtractor(attributesExtractor);
clientBuilder.addAttributesExtractor(attributesExtractor);
serverBuilder.addAttributesExtractor(attributesExtractor);
return this;
}
Expand All @@ -108,7 +108,7 @@ public ArmeriaTelemetryBuilder addAttributeExtractor(
@CanIgnoreReturnValue
public ArmeriaTelemetryBuilder addClientAttributeExtractor(
AttributesExtractor<? super ClientRequestContext, ? super RequestLog> attributesExtractor) {
clientBuilder.addAttributeExtractor(attributesExtractor);
clientBuilder.addAttributesExtractor(attributesExtractor);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,28 @@ public final class GrpcTelemetryBuilder {
/**
* Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
* items. The {@link AttributesExtractor} will be executed after all default extractors.
*
* @deprecated Use {@link #addAttributesExtractor(AttributesExtractor)} instead.
*/
@Deprecated
@CanIgnoreReturnValue
public GrpcTelemetryBuilder addAttributeExtractor(
AttributesExtractor<? super GrpcRequest, ? super Status> attributesExtractor) {
additionalExtractors.add(attributesExtractor);
return this;
}

/**
* Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
* items. The {@link AttributesExtractor} will be executed after all default extractors.
*/
@CanIgnoreReturnValue
public GrpcTelemetryBuilder addAttributesExtractor(
AttributesExtractor<? super GrpcRequest, ? super Status> attributesExtractor) {
additionalExtractors.add(attributesExtractor);
return this;
}

/**
* Adds an extra client-only {@link AttributesExtractor} to invoke to set attributes to
* instrumented items. The {@link AttributesExtractor} will be executed after all default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void sayHello(
.addService(greeter)
.intercept(
GrpcTelemetry.builder(testing.getOpenTelemetry())
.addAttributeExtractor(new CustomAttributesExtractor())
.addAttributesExtractor(new CustomAttributesExtractor())
.addServerAttributeExtractor(new CustomAttributesExtractorV2("serverSideValue"))
.build()
.newServerInterceptor())
Expand All @@ -103,7 +103,7 @@ public void sayHello(
ManagedChannelBuilder.forAddress("localhost", server.getPort())
.intercept(
GrpcTelemetry.builder(testing.getOpenTelemetry())
.addAttributeExtractor(new CustomAttributesExtractor())
.addAttributesExtractor(new CustomAttributesExtractor())
.addClientAttributeExtractor(
new CustomAttributesExtractorV2("clientSideValue"))
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,25 @@ public final class JavaHttpClientTelemetryBuilder {
/**
* Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
* items. The {@link AttributesExtractor} will be executed after all default extractors.
*
* @deprecated Use {@link #addAttributesExtractor(AttributesExtractor)} instead.
*/
@Deprecated
@CanIgnoreReturnValue
public JavaHttpClientTelemetryBuilder addAttributeExtractor(
AttributesExtractor<? super HttpRequest, ? super HttpResponse<?>> attributesExtractor) {
builder.addAttributeExtractor(attributesExtractor);
builder.addAttributesExtractor(attributesExtractor);
return this;
}

/**
* Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
* items. The {@link AttributesExtractor} will be executed after all default extractors.
*/
@CanIgnoreReturnValue
public JavaHttpClientTelemetryBuilder addAttributesExtractor(
AttributesExtractor<? super HttpRequest, ? super HttpResponse<?>> attributesExtractor) {
builder.addAttributesExtractor(attributesExtractor);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,25 @@ public JettyClientTelemetryBuilder setSslContextFactory(
/**
* Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
* items.
*
* @deprecated Use {@link #addAttributesExtractor(AttributesExtractor)} instead.
*/
@Deprecated
@CanIgnoreReturnValue
public JettyClientTelemetryBuilder addAttributeExtractor(
AttributesExtractor<? super Request, ? super Response> attributesExtractor) {
builder.addAttributeExtractor(attributesExtractor);
builder.addAttributesExtractor(attributesExtractor);
return this;
}

/**
* Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
* items.
*/
@CanIgnoreReturnValue
public JettyClientTelemetryBuilder addAttributesExtractor(
AttributesExtractor<? super Request, ? super Response> attributesExtractor) {
builder.addAttributesExtractor(attributesExtractor);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,25 @@ public JettyClientTelemetryBuilder setSslContextFactory(SslContextFactory sslCon
/**
* Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
* items.
*
* @deprecated Use {@link #addAttributesExtractor(AttributesExtractor)} instead.
*/
@Deprecated
@CanIgnoreReturnValue
public JettyClientTelemetryBuilder addAttributeExtractor(
AttributesExtractor<? super Request, ? super Response> attributesExtractor) {
builder.addAttributeExtractor(attributesExtractor);
builder.addAttributesExtractor(attributesExtractor);
return this;
}

/**
* Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
* items.
*/
@CanIgnoreReturnValue
public JettyClientTelemetryBuilder addAttributesExtractor(
AttributesExtractor<? super Request, ? super Response> attributesExtractor) {
builder.addAttributesExtractor(attributesExtractor);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ abstract class AbstractKtorClientTracingBuilder(

fun attributeExtractor(extractorBuilder: ExtractorBuilder.() -> Unit = {}) {
val builder = ExtractorBuilder().apply(extractorBuilder).build()
this.clientBuilder.addAttributeExtractor(
this.clientBuilder.addAttributesExtractor(
object : AttributesExtractor<HttpRequestData, HttpResponse> {
override fun onStart(attributes: AttributesBuilder, parentContext: Context, request: HttpRequestData) {
builder.onStart(OnStartData(attributes, parentContext, request))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public NettyClientTelemetryBuilder setCapturedResponseHeaders(
@CanIgnoreReturnValue
public NettyClientTelemetryBuilder addAttributesExtractor(
AttributesExtractor<HttpRequestAndChannel, HttpResponse> attributesExtractor) {
builder.addAttributeExtractor(attributesExtractor);
builder.addAttributesExtractor(attributesExtractor);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,25 @@ public final class OkHttpTelemetryBuilder {
/**
* Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
* items.
*
* @deprecated Use {@link #addAttributesExtractor(AttributesExtractor)} instead.
*/
@Deprecated
@CanIgnoreReturnValue
public OkHttpTelemetryBuilder addAttributeExtractor(
AttributesExtractor<? super Interceptor.Chain, ? super Response> attributesExtractor) {
builder.addAttributeExtractor(attributesExtractor);
builder.addAttributesExtractor(attributesExtractor);
return this;
}

/**
* Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
* items.
*/
@CanIgnoreReturnValue
public OkHttpTelemetryBuilder addAttributesExtractor(
AttributesExtractor<? super Interceptor.Chain, ? super Response> attributesExtractor) {
builder.addAttributesExtractor(attributesExtractor);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,28 @@ public final class QuartzTelemetryBuilder {
/**
* Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
* items. The {@link AttributesExtractor} will be executed after all default extractors.
*
* @deprecated Use {@link #addAttributesExtractor(AttributesExtractor)} instead.
*/
@Deprecated
@CanIgnoreReturnValue
public QuartzTelemetryBuilder addAttributeExtractor(
AttributesExtractor<? super JobExecutionContext, ? super Void> attributesExtractor) {
additionalExtractors.add(attributesExtractor);
return this;
}

/**
* Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
* items. The {@link AttributesExtractor} will be executed after all default extractors.
*/
@CanIgnoreReturnValue
public QuartzTelemetryBuilder addAttributesExtractor(
AttributesExtractor<? super JobExecutionContext, ? super Void> attributesExtractor) {
additionalExtractors.add(attributesExtractor);
return this;
}

/**
* Sets whether experimental attributes should be set to spans. These attributes may be changed or
* removed in the future, so only enable this if you know you do not require attributes filled by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public final class R2dbcSingletons {
.getBoolean(
"otel.instrumentation.r2dbc.statement-sanitizer.enabled",
AgentCommonConfig.get().isStatementSanitizationEnabled()))
.addAttributeExtractor(
.addAttributesExtractor(
PeerServiceAttributesExtractor.create(
R2dbcNetAttributesGetter.INSTANCE,
AgentCommonConfig.get().getPeerServiceResolver()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,21 @@ public final class R2dbcTelemetryBuilder {
instrumenterBuilder = new R2dbcInstrumenterBuilder(openTelemetry);
}

/**
* @deprecated Use {@link #addAttributesExtractor(AttributesExtractor)} instead.
*/
@Deprecated
@CanIgnoreReturnValue
public R2dbcTelemetryBuilder addAttributeExtractor(
AttributesExtractor<DbExecution, Void> attributesExtractor) {
instrumenterBuilder.addAttributeExtractor(attributesExtractor);
instrumenterBuilder.addAttributesExtractor(attributesExtractor);
return this;
}

@CanIgnoreReturnValue
public R2dbcTelemetryBuilder addAttributesExtractor(
AttributesExtractor<DbExecution, Void> attributesExtractor) {
instrumenterBuilder.addAttributesExtractor(attributesExtractor);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public R2dbcInstrumenterBuilder(OpenTelemetry openTelemetry) {
}

@CanIgnoreReturnValue
public R2dbcInstrumenterBuilder addAttributeExtractor(
public R2dbcInstrumenterBuilder addAttributesExtractor(
AttributesExtractor<DbExecution, Void> attributesExtractor) {
additionalExtractors.add(attributesExtractor);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public RatpackTelemetryBuilder addAttributeExtractor(
@CanIgnoreReturnValue
public RatpackTelemetryBuilder addClientAttributeExtractor(
AttributesExtractor<? super RequestSpec, ? super HttpResponse> attributesExtractor) {
clientBuilder.addAttributeExtractor(attributesExtractor);
clientBuilder.addAttributesExtractor(attributesExtractor);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,25 @@ private DefaultHttpClientInstrumenterBuilder<HttpRequest, ClientHttpResponse> ge
/**
* Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
* items.
*
* @deprecated Use {@link #addAttributesExtractor(AttributesExtractor)} instead.
*/
@Deprecated
@CanIgnoreReturnValue
public SpringWebTelemetryBuilder addAttributeExtractor(
AttributesExtractor<? super HttpRequest, ? super ClientHttpResponse> attributesExtractor) {
builder.addAttributeExtractor(attributesExtractor);
builder.addAttributesExtractor(attributesExtractor);
return this;
}

/**
* Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
* items.
*/
@CanIgnoreReturnValue
public SpringWebTelemetryBuilder addAttributesExtractor(
AttributesExtractor<? super HttpRequest, ? super ClientHttpResponse> attributesExtractor) {
builder.addAttributesExtractor(attributesExtractor);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public final class SpringWebfluxTelemetryBuilder {
@CanIgnoreReturnValue
public SpringWebfluxTelemetryBuilder addClientAttributesExtractor(
AttributesExtractor<ClientRequest, ClientResponse> attributesExtractor) {
clientBuilder.addAttributeExtractor(attributesExtractor);
clientBuilder.addAttributesExtractor(attributesExtractor);
return this;
}

Expand Down
Loading