Rename `newInstrumenter()` into `buildInstrumenter()` (#6363)

* Rename newInstrumenter() into buildInstrumenter()

* spotless
This commit is contained in:
Mateusz Rzeszutek 2022-07-25 21:02:46 +02:00 committed by GitHub
parent c0cacb8544
commit 82b39b1012
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
120 changed files with 258 additions and 180 deletions

View File

@ -23,7 +23,7 @@ class HttpRouteHolderTest {
Instrumenter<String, Void> instrumenter =
Instrumenter.<String, Void>builder(testing.getOpenTelemetry(), "test", s -> s)
.addContextCustomizer(HttpRouteHolder.get())
.newInstrumenter();
.buildInstrumenter();
Context context = instrumenter.start(Context.root(), "test");

View File

@ -45,7 +45,7 @@ public class InstrumenterBenchmark {
HttpClientAttributesExtractor.create(ConstantHttpAttributesGetter.INSTANCE))
.addAttributesExtractor(
NetServerAttributesExtractor.create(new ConstantNetAttributesGetter()))
.newInstrumenter();
.buildInstrumenter();
@Benchmark
public Context start() {

View File

@ -183,9 +183,83 @@ public final class InstrumenterBuilder<REQUEST, RESPONSE> {
/**
* Returns a new {@link Instrumenter} which will create {@linkplain SpanKind#CLIENT client} spans
* and inject context into requests.
*
* @deprecated Use {@link #buildClientInstrumenter(TextMapSetter)} instead.
*/
@Deprecated
public Instrumenter<REQUEST, RESPONSE> newClientInstrumenter(TextMapSetter<REQUEST> setter) {
return newInstrumenter(
return buildInstrumenter(
InstrumenterConstructor.propagatingToDownstream(setter), SpanKindExtractor.alwaysClient());
}
/**
* Returns a new {@link Instrumenter} which will create {@linkplain SpanKind#SERVER server} spans
* and extract context from requests.
*
* @deprecated Use {@link #buildServerInstrumenter(TextMapGetter)} instead.
*/
@Deprecated
public Instrumenter<REQUEST, RESPONSE> newServerInstrumenter(TextMapGetter<REQUEST> getter) {
return buildInstrumenter(
InstrumenterConstructor.propagatingFromUpstream(getter), SpanKindExtractor.alwaysServer());
}
/**
* Returns a new {@link Instrumenter} which will create {@linkplain SpanKind#PRODUCER producer}
* spans and inject context into requests.
*
* @deprecated Use {@link #buildProducerInstrumenter(TextMapSetter)} instead.
*/
@Deprecated
public Instrumenter<REQUEST, RESPONSE> newProducerInstrumenter(TextMapSetter<REQUEST> setter) {
return buildInstrumenter(
InstrumenterConstructor.propagatingToDownstream(setter),
SpanKindExtractor.alwaysProducer());
}
/**
* Returns a new {@link Instrumenter} which will create {@linkplain SpanKind#CONSUMER consumer}
* spans and extract context from requests.
*
* @deprecated Use {@link #buildConsumerInstrumenter(TextMapGetter)} instead.
*/
@Deprecated
public Instrumenter<REQUEST, RESPONSE> newConsumerInstrumenter(TextMapGetter<REQUEST> getter) {
return buildInstrumenter(
InstrumenterConstructor.propagatingFromUpstream(getter),
SpanKindExtractor.alwaysConsumer());
}
/**
* Returns a new {@link Instrumenter} which will create {@linkplain SpanKind#INTERNAL internal}
* spans and do no context propagation.
*
* @deprecated Use {@link #buildInstrumenter()} instead.
*/
@Deprecated
public Instrumenter<REQUEST, RESPONSE> newInstrumenter() {
return buildInstrumenter(
InstrumenterConstructor.internal(), SpanKindExtractor.alwaysInternal());
}
/**
* Returns a new {@link Instrumenter} which will create spans with kind determined by the passed
* {@link SpanKindExtractor} and do no context propagation.
*
* @deprecated Use {@link #buildInstrumenter(SpanKindExtractor)} instead.
*/
@Deprecated
public Instrumenter<REQUEST, RESPONSE> newInstrumenter(
SpanKindExtractor<? super REQUEST> spanKindExtractor) {
return buildInstrumenter(InstrumenterConstructor.internal(), spanKindExtractor);
}
/**
* Returns a new {@link Instrumenter} which will create {@linkplain SpanKind#CLIENT client} spans
* and inject context into requests.
*/
public Instrumenter<REQUEST, RESPONSE> buildClientInstrumenter(TextMapSetter<REQUEST> setter) {
return buildInstrumenter(
InstrumenterConstructor.propagatingToDownstream(setter), SpanKindExtractor.alwaysClient());
}
@ -193,8 +267,8 @@ public final class InstrumenterBuilder<REQUEST, RESPONSE> {
* Returns a new {@link Instrumenter} which will create {@linkplain SpanKind#SERVER server} spans
* and extract context from requests.
*/
public Instrumenter<REQUEST, RESPONSE> newServerInstrumenter(TextMapGetter<REQUEST> getter) {
return newInstrumenter(
public Instrumenter<REQUEST, RESPONSE> buildServerInstrumenter(TextMapGetter<REQUEST> getter) {
return buildInstrumenter(
InstrumenterConstructor.propagatingFromUpstream(getter), SpanKindExtractor.alwaysServer());
}
@ -202,8 +276,8 @@ public final class InstrumenterBuilder<REQUEST, RESPONSE> {
* Returns a new {@link Instrumenter} which will create {@linkplain SpanKind#PRODUCER producer}
* spans and inject context into requests.
*/
public Instrumenter<REQUEST, RESPONSE> newProducerInstrumenter(TextMapSetter<REQUEST> setter) {
return newInstrumenter(
public Instrumenter<REQUEST, RESPONSE> buildProducerInstrumenter(TextMapSetter<REQUEST> setter) {
return buildInstrumenter(
InstrumenterConstructor.propagatingToDownstream(setter),
SpanKindExtractor.alwaysProducer());
}
@ -212,8 +286,8 @@ public final class InstrumenterBuilder<REQUEST, RESPONSE> {
* Returns a new {@link Instrumenter} which will create {@linkplain SpanKind#CONSUMER consumer}
* spans and extract context from requests.
*/
public Instrumenter<REQUEST, RESPONSE> newConsumerInstrumenter(TextMapGetter<REQUEST> getter) {
return newInstrumenter(
public Instrumenter<REQUEST, RESPONSE> buildConsumerInstrumenter(TextMapGetter<REQUEST> getter) {
return buildInstrumenter(
InstrumenterConstructor.propagatingFromUpstream(getter),
SpanKindExtractor.alwaysConsumer());
}
@ -222,20 +296,21 @@ public final class InstrumenterBuilder<REQUEST, RESPONSE> {
* Returns a new {@link Instrumenter} which will create {@linkplain SpanKind#INTERNAL internal}
* spans and do no context propagation.
*/
public Instrumenter<REQUEST, RESPONSE> newInstrumenter() {
return newInstrumenter(InstrumenterConstructor.internal(), SpanKindExtractor.alwaysInternal());
public Instrumenter<REQUEST, RESPONSE> buildInstrumenter() {
return buildInstrumenter(
InstrumenterConstructor.internal(), SpanKindExtractor.alwaysInternal());
}
/**
* Returns a new {@link Instrumenter} which will create spans with kind determined by the passed
* {@link SpanKindExtractor} and do no context propagation.
*/
public Instrumenter<REQUEST, RESPONSE> newInstrumenter(
public Instrumenter<REQUEST, RESPONSE> buildInstrumenter(
SpanKindExtractor<? super REQUEST> spanKindExtractor) {
return newInstrumenter(InstrumenterConstructor.internal(), spanKindExtractor);
return buildInstrumenter(InstrumenterConstructor.internal(), spanKindExtractor);
}
private Instrumenter<REQUEST, RESPONSE> newInstrumenter(
private Instrumenter<REQUEST, RESPONSE> buildInstrumenter(
InstrumenterConstructor<REQUEST, RESPONSE> constructor,
SpanKindExtractor<? super REQUEST> spanKindExtractor) {
this.spanKindExtractor = spanKindExtractor;

View File

@ -156,7 +156,7 @@ class InstrumenterTest {
otelTesting.getOpenTelemetry(), "test", unused -> "span")
.addAttributesExtractors(new AttributesExtractor1(), new AttributesExtractor2())
.addSpanLinksExtractor(new LinksExtractor())
.newServerInstrumenter(new MapGetter());
.buildServerInstrumenter(new MapGetter());
Context context = instrumenter.start(Context.root(), REQUEST);
SpanContext spanContext = Span.fromContext(context).getSpanContext();
@ -196,7 +196,7 @@ class InstrumenterTest {
Instrumenter.<Map<String, String>, Map<String, String>>builder(
otelTesting.getOpenTelemetry(), "test", unused -> "span")
.addAttributesExtractors(new AttributesExtractor1(), new AttributesExtractor2())
.newServerInstrumenter(new MapGetter());
.buildServerInstrumenter(new MapGetter());
Context context = instrumenter.start(Context.root(), REQUEST);
assertThat(Span.fromContext(context).getSpanContext().isValid()).isTrue();
@ -217,7 +217,7 @@ class InstrumenterTest {
Instrumenter.<Map<String, String>, Map<String, String>>builder(
otelTesting.getOpenTelemetry(), "test", unused -> "span")
.addAttributesExtractors(new AttributesExtractor1(), new AttributesExtractor2())
.newServerInstrumenter(new MapGetter());
.buildServerInstrumenter(new MapGetter());
Map<String, String> request = new HashMap<>(REQUEST);
W3CTraceContextPropagator.getInstance()
@ -258,7 +258,7 @@ class InstrumenterTest {
otelTesting.getOpenTelemetry(), "test", unused -> "span")
.addAttributesExtractors(new AttributesExtractor1(), new AttributesExtractor2())
.addSpanLinksExtractor(new LinksExtractor())
.newClientInstrumenter(Map::put);
.buildClientInstrumenter(Map::put);
Map<String, String> request = new HashMap<>(REQUEST);
Context context = instrumenter.start(Context.root(), request);
@ -301,7 +301,7 @@ class InstrumenterTest {
Instrumenter.<Map<String, String>, Map<String, String>>builder(
otelTesting.getOpenTelemetry(), "test", unused -> "span")
.addAttributesExtractors(new AttributesExtractor1(), new AttributesExtractor2())
.newClientInstrumenter(Map::put);
.buildClientInstrumenter(Map::put);
Map<String, String> request = new HashMap<>(REQUEST);
Context context = instrumenter.start(Context.root(), request);
@ -326,7 +326,7 @@ class InstrumenterTest {
Instrumenter.<Map<String, String>, Map<String, String>>builder(
otelTesting.getOpenTelemetry(), "test", unused -> "span")
.addAttributesExtractors(new AttributesExtractor1(), new AttributesExtractor2())
.newClientInstrumenter(Map::put);
.buildClientInstrumenter(Map::put);
Context parent =
Context.root()
@ -383,7 +383,7 @@ class InstrumenterTest {
Instrumenter.<Map<String, String>, Map<String, String>>builder(
otelTesting.getOpenTelemetry(), "test", unused -> "span")
.addOperationListener(operationListener)
.newServerInstrumenter(new MapGetter());
.buildServerInstrumenter(new MapGetter());
Context context = instrumenter.start(Context.root(), REQUEST);
instrumenter.end(context, REQUEST, RESPONSE, null);
@ -415,7 +415,7 @@ class InstrumenterTest {
Instrumenter.<Map<String, String>, Map<String, String>>builder(
otelTesting.getOpenTelemetry(), "test", unused -> "span")
.addOperationMetrics(meter -> operationListener)
.newServerInstrumenter(new MapGetter());
.buildServerInstrumenter(new MapGetter());
Context context = instrumenter.start(Context.root(), REQUEST);
instrumenter.end(context, REQUEST, RESPONSE, null);
@ -432,7 +432,7 @@ class InstrumenterTest {
otelTesting.getOpenTelemetry(), "test", request -> "test span")
.addSpanLinksExtractor(
(spanLinks, parentContext, request) -> spanLinks.addLink(SpanContext.getInvalid()))
.newInstrumenter();
.buildInstrumenter();
// when
Context context = instrumenter.start(Context.root(), "request");
@ -456,7 +456,7 @@ class InstrumenterTest {
otelTesting.getOpenTelemetry(), "test", request -> "test span")
.addContextCustomizer(
(context, request, attributes) -> context.with(testKey, "testVal"))
.newInstrumenter();
.buildInstrumenter();
// when
Context context = instrumenter.start(Context.root(), "request");
@ -471,7 +471,7 @@ class InstrumenterTest {
Instrumenter.<String, String>builder(
otelTesting.getOpenTelemetry(), "test", request -> "test span")
.setEnabled(false)
.newInstrumenter();
.buildInstrumenter();
assertThat(instrumenter.shouldStart(Context.root(), "request")).isFalse();
}
@ -482,7 +482,8 @@ class InstrumenterTest {
Instrumenter.builder(
otelTesting.getOpenTelemetry(), "test-instrumentation", name -> "span");
Instrumenter<Map<String, String>, Map<String, String>> instrumenter = builder.newInstrumenter();
Instrumenter<Map<String, String>, Map<String, String>> instrumenter =
builder.buildInstrumenter();
Context context = instrumenter.start(Context.root(), Collections.emptyMap());
assertThat(Span.fromContext(context)).isNotNull();
@ -507,7 +508,7 @@ class InstrumenterTest {
Instrumenter.<Map<String, String>, Map<String, String>>builder(
otelTesting.getOpenTelemetry(), "test", name -> "span")
.setInstrumentationVersion("1.0")
.newInstrumenter();
.buildInstrumenter();
Context context = instrumenter.start(Context.root(), Collections.emptyMap());
assertThat(Span.fromContext(context)).isNotNull();
@ -532,7 +533,7 @@ class InstrumenterTest {
Instrumenter.<Map<String, String>, Map<String, String>>builder(
otelTesting.getOpenTelemetry(), "test", name -> "span")
.setSchemaUrl("https://opentelemetry.io/schemas/1.0.0")
.newInstrumenter();
.buildInstrumenter();
Context context = instrumenter.start(Context.root(), Collections.emptyMap());
assertThat(Span.fromContext(context)).isNotNull();
@ -564,7 +565,7 @@ class InstrumenterTest {
mockHttpClientAttributes,
mockNetClientAttributes,
mockDbClientAttributes)
.newInstrumenter();
.buildInstrumenter();
Context context = instrumenter.start(Context.root(), REQUEST);

View File

@ -44,7 +44,7 @@ public class AkkaHttpClientSingletons {
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.addOperationMetrics(HttpClientMetrics.get())
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
public static Instrumenter<HttpRequest, HttpResponse> instrumenter() {

View File

@ -36,7 +36,7 @@ public class AkkaHttpServerSingletons {
.build())
.addOperationMetrics(HttpServerMetrics.get())
.addContextCustomizer(HttpRouteHolder.get())
.newServerInstrumenter(AkkaHttpServerHeaders.INSTANCE);
.buildServerInstrumenter(AkkaHttpServerHeaders.INSTANCE);
}
public static Instrumenter<HttpRequest, HttpResponse> instrumenter() {

View File

@ -74,7 +74,7 @@ public final class CamelSingletons {
builder.addAttributesExtractor(attributesExtractor);
builder.setSpanStatusExtractor(spanStatusExtractor);
INSTRUMENTER = builder.newInstrumenter(request -> request.getSpanKind());
INSTRUMENTER = builder.buildInstrumenter(request -> request.getSpanKind());
}
public static Instrumenter<CamelRequest, Void> instrumenter() {

View File

@ -82,7 +82,7 @@ public final class DubboTelemetryBuilder {
}
return new DubboTelemetry(
serverInstrumenterBuilder.newServerInstrumenter(DubboHeadersGetter.INSTANCE),
clientInstrumenterBuilder.newClientInstrumenter(DubboHeadersSetter.INSTANCE));
serverInstrumenterBuilder.buildServerInstrumenter(DubboHeadersGetter.INSTANCE),
clientInstrumenterBuilder.buildClientInstrumenter(DubboHeadersSetter.INSTANCE));
}
}

View File

@ -43,7 +43,7 @@ public final class ApacheHttpAsyncClientSingletons {
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.addOperationMetrics(HttpClientMetrics.get())
.newClientInstrumenter(HttpHeaderSetter.INSTANCE);
.buildClientInstrumenter(HttpHeaderSetter.INSTANCE);
}
public static Instrumenter<ApacheHttpClientRequest, HttpResponse> instrumenter() {

View File

@ -43,7 +43,7 @@ public final class ApacheHttpClientSingletons {
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.addOperationMetrics(HttpClientMetrics.get())
.newClientInstrumenter(HttpHeaderSetter.INSTANCE);
.buildClientInstrumenter(HttpHeaderSetter.INSTANCE);
}
public static Instrumenter<HttpMethod, HttpMethod> instrumenter() {

View File

@ -43,7 +43,7 @@ public final class ApacheHttpClientSingletons {
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.addOperationMetrics(HttpClientMetrics.get())
.newClientInstrumenter(HttpHeaderSetter.INSTANCE);
.buildClientInstrumenter(HttpHeaderSetter.INSTANCE);
}
public static Instrumenter<ApacheHttpClientRequest, HttpResponse> instrumenter() {

View File

@ -86,7 +86,7 @@ public final class ApacheHttpClientTelemetryBuilder {
.addAttributesExtractor(NetClientAttributesExtractor.create(netAttributesGetter))
.addAttributesExtractors(additionalExtractors)
// We manually inject because we need to inject internal requests for redirects.
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
return new ApacheHttpClientTelemetry(instrumenter, openTelemetry.getPropagators());
}

View File

@ -44,7 +44,7 @@ public final class ApacheHttpClientSingletons {
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.addOperationMetrics(HttpClientMetrics.get())
.newClientInstrumenter(HttpHeaderSetter.INSTANCE);
.buildClientInstrumenter(HttpHeaderSetter.INSTANCE);
}
public static Instrumenter<HttpRequest, HttpResponse> instrumenter() {

View File

@ -186,7 +186,7 @@ public final class ArmeriaTelemetryBuilder {
}
return new ArmeriaTelemetry(
clientInstrumenterBuilder.newClientInstrumenter(ClientRequestContextSetter.INSTANCE),
serverInstrumenterBuilder.newServerInstrumenter(RequestContextGetter.INSTANCE));
clientInstrumenterBuilder.buildClientInstrumenter(ClientRequestContextSetter.INSTANCE),
serverInstrumenterBuilder.buildServerInstrumenter(RequestContextGetter.INSTANCE));
}
}

View File

@ -44,7 +44,7 @@ public final class AsyncHttpClientSingletons {
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.addOperationMetrics(HttpClientMetrics.get())
.newClientInstrumenter(HttpHeaderSetter.INSTANCE);
.buildClientInstrumenter(HttpHeaderSetter.INSTANCE);
}
public static Instrumenter<Request, Response> instrumenter() {

View File

@ -44,7 +44,7 @@ public final class AsyncHttpClientSingletons {
netAttributeGetter, CommonConfig.get().getPeerServiceMapping()))
.addAttributesExtractor(new AsyncHttpClientAdditionalAttributesExtractor())
.addOperationMetrics(HttpClientMetrics.get())
.newClientInstrumenter(HttpHeaderSetter.INSTANCE);
.buildClientInstrumenter(HttpHeaderSetter.INSTANCE);
}
public static Instrumenter<RequestContext, Response> instrumenter() {

View File

@ -24,7 +24,7 @@ public class AwsLambdaFunctionInstrumenterFactory {
"io.opentelemetry.aws-lambda-core-1.0",
AwsLambdaFunctionInstrumenterFactory::spanName)
.addAttributesExtractors(new AwsLambdaFunctionAttributesExtractor())
.newInstrumenter(SpanKindExtractor.alwaysServer()));
.buildInstrumenter(SpanKindExtractor.alwaysServer()));
}
private static String spanName(AwsLambdaRequest input) {

View File

@ -29,7 +29,7 @@ public class AwsLambdaEventsInstrumenterFactory {
.addAttributesExtractors(
new AwsLambdaFunctionAttributesExtractor(),
new ApiGatewayProxyAttributesExtractor())
.newInstrumenter(SpanKindExtractor.alwaysServer()));
.buildInstrumenter(SpanKindExtractor.alwaysServer()));
}
private static String spanName(AwsLambdaRequest input) {

View File

@ -24,7 +24,7 @@ public class AwsLambdaSqsInstrumenterFactory {
AwsLambdaSqsInstrumenterFactory::spanName)
.addAttributesExtractors(new SqsEventAttributesExtractor())
.addSpanLinksExtractor(new SqsEventSpanLinksExtractor())
.newInstrumenter(SpanKindExtractor.alwaysConsumer());
.buildInstrumenter(SpanKindExtractor.alwaysConsumer());
}
public static Instrumenter<SQSMessage, Void> forMessage(OpenTelemetry openTelemetry) {
@ -34,7 +34,7 @@ public class AwsLambdaSqsInstrumenterFactory {
message -> message.getEventSource() + " process")
.addAttributesExtractors(new SqsMessageAttributesExtractor())
.addSpanLinksExtractor(new SqsMessageSpanLinksExtractor())
.newInstrumenter(SpanKindExtractor.alwaysConsumer());
.buildInstrumenter(SpanKindExtractor.alwaysConsumer());
}
private static String spanName(SQSEvent event) {

View File

@ -68,7 +68,7 @@ final class AwsSdkInstrumenterFactory {
captureExperimentalSpanAttributes
? extendedAttributesExtractors
: defaultAttributesExtractors)
.newInstrumenter(kindExtractor);
.buildInstrumenter(kindExtractor);
}
private AwsSdkInstrumenterFactory() {}

View File

@ -73,7 +73,7 @@ final class AwsSdkInstrumenterFactory {
captureExperimentalSpanAttributes
? extendedAttributesExtractors
: defaultAttributesExtractors)
.newInstrumenter(spanKindExtractor);
.buildInstrumenter(spanKindExtractor);
}
private static String spanName(ExecutionAttributes attributes) {

View File

@ -38,7 +38,7 @@ public final class CassandraSingletons {
.build())
.addAttributesExtractor(
NetClientAttributesExtractor.create(new CassandraNetAttributesGetter()))
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
public static Instrumenter<CassandraRequest, ExecutionInfo> instrumenter() {

View File

@ -38,7 +38,7 @@ public final class CassandraSingletons {
.addAttributesExtractor(
NetClientAttributesExtractor.create(new CassandraNetAttributesGetter()))
.addAttributesExtractor(new CassandraAttributesExtractor())
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
public static Instrumenter<CassandraRequest, ExecutionInfo> instrumenter() {

View File

@ -46,7 +46,7 @@ public final class CouchbaseSingletons {
builder.addAttributesExtractor(new ExperimentalAttributesExtractor());
}
INSTRUMENTER = builder.newInstrumenter(SpanKindExtractor.alwaysClient());
INSTRUMENTER = builder.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
public static Instrumenter<CouchbaseRequestInfo, Void> instrumenter() {

View File

@ -18,7 +18,7 @@ public final class DropwizardSingletons {
Instrumenter.<View, Void>builder(
GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, DropwizardSingletons::spanName)
.setEnabled(ExperimentalConfig.get().controllerTelemetryEnabled())
.newInstrumenter();
.buildInstrumenter();
private static String spanName(View view) {
return "Render " + view.getTemplateName();

View File

@ -33,7 +33,7 @@ public final class ElasticsearchRestInstrumenterFactory {
.addAttributesExtractor(
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
private ElasticsearchRestInstrumenterFactory() {}

View File

@ -40,7 +40,7 @@ public final class ElasticsearchTransportInstrumenterFactory {
instrumenterBuilder.addAttributesExtractor(experimentalAttributesExtractor);
}
return instrumenterBuilder.newInstrumenter(SpanKindExtractor.alwaysClient());
return instrumenterBuilder.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
private ElasticsearchTransportInstrumenterFactory() {}

View File

@ -26,7 +26,7 @@ public final class ExternalAnnotationSingletons {
"io.opentelemetry.external-annotations",
CodeSpanNameExtractor.create(codeAttributesGetter))
.addAttributesExtractor(CodeAttributesExtractor.create(codeAttributesGetter))
.newInstrumenter();
.buildInstrumenter();
}
public static Instrumenter<ClassAndMethod, Void> instrumenter() {

View File

@ -18,7 +18,7 @@ public final class FinatraSingletons {
private static final Instrumenter<Class<?>, Void> INSTRUMENTER =
Instrumenter.<Class<?>, Void>builder(
GlobalOpenTelemetry.get(), "io.opentelemetry.finatra-2.9", ClassNames::simpleName)
.newInstrumenter();
.buildInstrumenter();
public static Instrumenter<Class<?>, Void> instrumenter() {
return INSTRUMENTER;

View File

@ -25,7 +25,7 @@ public final class GeodeSingletons {
INSTRUMENTATION_NAME,
DbClientSpanNameExtractor.create(dbClientAttributesGetter))
.addAttributesExtractor(DbClientAttributesExtractor.create(dbClientAttributesGetter))
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
public static Instrumenter<GeodeRequest, Void> instrumenter() {

View File

@ -44,7 +44,7 @@ public class GoogleHttpClientSingletons {
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.addOperationMetrics(HttpClientMetrics.get())
.newClientInstrumenter(HttpHeaderSetter.INSTANCE);
.buildClientInstrumenter(HttpHeaderSetter.INSTANCE);
}
public static Instrumenter<HttpRequest, HttpResponse> instrumenter() {

View File

@ -19,7 +19,7 @@ public final class GrailsSingletons {
Instrumenter.<HandlerData, Void>builder(
GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, HandlerData::spanName)
.setEnabled(ExperimentalConfig.get().controllerTelemetryEnabled())
.newInstrumenter();
.buildInstrumenter();
}
public static Instrumenter<HandlerData, Void> instrumenter() {

View File

@ -52,7 +52,7 @@ public final class GraphQLTelemetry {
});
builder.addAttributesExtractor(new GraphqlAttributesExtractor());
this.instrumenter = builder.newInstrumenter();
this.instrumenter = builder.buildInstrumenter();
this.sanitizeQuery = sanitizeQuery;
}

View File

@ -48,7 +48,7 @@ public final class GrizzlySingletons {
.addContextCustomizer(
(context, httpRequestPacket, startAttributes) -> GrizzlyErrorHolder.init(context))
.addContextCustomizer(HttpRouteHolder.get())
.newServerInstrumenter(HttpRequestHeadersGetter.INSTANCE);
.buildServerInstrumenter(HttpRequestHeadersGetter.INSTANCE);
}
public static Instrumenter<HttpRequestPacket, HttpResponsePacket> instrumenter() {

View File

@ -155,10 +155,10 @@ public final class GrpcTelemetryBuilder {
}
return new GrpcTelemetry(
serverInstrumenterBuilder.newServerInstrumenter(GrpcRequestGetter.INSTANCE),
serverInstrumenterBuilder.buildServerInstrumenter(GrpcRequestGetter.INSTANCE),
// gRPC client interceptors require two phases, one to set up request and one to execute.
// So we go ahead and inject manually in this instrumentation.
clientInstrumenterBuilder.newInstrumenter(SpanKindExtractor.alwaysClient()),
clientInstrumenterBuilder.buildInstrumenter(SpanKindExtractor.alwaysClient()),
openTelemetry.getPropagators(),
captureExperimentalSpanAttributes);
}

View File

@ -31,7 +31,7 @@ public final class GwtSingletons {
.addAttributesExtractor(RpcServerAttributesExtractor.create(rpcAttributesGetter))
// TODO(anuraaga): This should be a server span, but we currently have no way to merge
// with the HTTP instrumentation's server span.
.newInstrumenter();
.buildInstrumenter();
}
public static Instrumenter<Method, Void> instrumenter() {

View File

@ -25,7 +25,7 @@ public final class HibernateInstrumenterFactory {
instrumenterBuilder.addAttributesExtractor(new HibernateExperimentalAttributesExtractor());
}
return instrumenterBuilder.newInstrumenter();
return instrumenterBuilder.buildInstrumenter();
}
private HibernateInstrumenterFactory() {}

View File

@ -44,7 +44,7 @@ public final class HttpUrlConnectionSingletons {
(context, httpRequestPacket, startAttributes) ->
GetOutputStreamContext.init(context))
.addOperationMetrics(HttpClientMetrics.get())
.newClientInstrumenter(RequestPropertySetter.INSTANCE);
.buildClientInstrumenter(RequestPropertySetter.INSTANCE);
}
public static Instrumenter<HttpURLConnection, Integer> instrumenter() {

View File

@ -26,7 +26,7 @@ public final class HystrixSingletons {
builder.addAttributesExtractor(new ExperimentalAttributesExtractor());
}
INSTRUMENTER = builder.newInstrumenter();
INSTRUMENTER = builder.buildInstrumenter();
}
public static Instrumenter<HystrixRequest, Void> instrumenter() {

View File

@ -44,7 +44,7 @@ public class JdkHttpClientSingletons {
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.addOperationMetrics(HttpClientMetrics.get())
.newClientInstrumenter(SETTER);
.buildClientInstrumenter(SETTER);
}
public static Instrumenter<HttpRequest, HttpResponse<?>> instrumenter() {

View File

@ -42,7 +42,7 @@ public class JaxRsClientSingletons {
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.addOperationMetrics(HttpClientMetrics.get())
.newClientInstrumenter(ClientRequestHeaderSetter.INSTANCE);
.buildClientInstrumenter(ClientRequestHeaderSetter.INSTANCE);
}
public static Instrumenter<ClientRequest, ClientResponse> instrumenter() {

View File

@ -32,7 +32,7 @@ public final class JaxrsSingletons {
CodeSpanNameExtractor.create(codeAttributesGetter))
.addAttributesExtractor(CodeAttributesExtractor.create(codeAttributesGetter))
.setEnabled(ExperimentalConfig.get().controllerTelemetryEnabled())
.newInstrumenter();
.buildInstrumenter();
}
public static Instrumenter<HandlerData, Void> instrumenter() {

View File

@ -22,7 +22,7 @@ public final class JaxrsInstrumenterFactory {
CodeSpanNameExtractor.create(codeAttributesGetter))
.addAttributesExtractor(CodeAttributesExtractor.create(codeAttributesGetter))
.setEnabled(ExperimentalConfig.get().controllerTelemetryEnabled())
.newInstrumenter();
.buildInstrumenter();
}
private JaxrsInstrumenterFactory() {}

View File

@ -19,7 +19,7 @@ public class Axis2Singletons {
Instrumenter.<Axis2Request, Void>builder(
GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, Axis2Request::spanName)
.setEnabled(ExperimentalConfig.get().controllerTelemetryEnabled())
.newInstrumenter();
.buildInstrumenter();
}
public static Instrumenter<Axis2Request, Void> instrumenter() {

View File

@ -19,7 +19,7 @@ public class CxfSingletons {
Instrumenter.<CxfRequest, Void>builder(
GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, CxfRequest::spanName)
.setEnabled(ExperimentalConfig.get().controllerTelemetryEnabled())
.newInstrumenter();
.buildInstrumenter();
}
public static Instrumenter<CxfRequest, Void> instrumenter() {

View File

@ -19,7 +19,7 @@ public class MetroSingletons {
Instrumenter.<MetroRequest, Void>builder(
GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, MetroRequest::spanName)
.setEnabled(ExperimentalConfig.get().controllerTelemetryEnabled())
.newInstrumenter();
.buildInstrumenter();
}
public static Instrumenter<MetroRequest, Void> instrumenter() {

View File

@ -22,7 +22,7 @@ public final class JaxWsInstrumenterFactory {
CodeSpanNameExtractor.create(codeAttributesGetter))
.addAttributesExtractor(CodeAttributesExtractor.create(codeAttributesGetter))
.setEnabled(ExperimentalConfig.get().controllerTelemetryEnabled())
.newInstrumenter();
.buildInstrumenter();
}
private JaxWsInstrumenterFactory() {}

View File

@ -40,7 +40,7 @@ public final class JdbcSingletons {
.addAttributesExtractor(
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
public static Instrumenter<DbRequest, Void> instrumenter() {

View File

@ -29,7 +29,7 @@ public final class DataSourceSingletons {
INSTRUMENTATION_NAME,
CodeSpanNameExtractor.create(codeAttributesGetter))
.addAttributesExtractor(CodeAttributesExtractor.create(codeAttributesGetter))
.newInstrumenter();
.buildInstrumenter();
}
public static Instrumenter<DataSource, Void> instrumenter() {

View File

@ -38,7 +38,7 @@ public final class JdbcSingletons {
"otel.instrumentation.common.db-statement-sanitizer.enabled", true))
.build())
.addAttributesExtractor(NetClientAttributesExtractor.create(netAttributesGetter))
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
public static Instrumenter<DbRequest, Void> instrumenter() {

View File

@ -33,7 +33,7 @@ public final class JedisSingletons {
.addAttributesExtractor(
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
public static Instrumenter<JedisRequest, Void> instrumenter() {

View File

@ -33,7 +33,7 @@ public final class JedisSingletons {
.addAttributesExtractor(
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
public static Instrumenter<JedisRequest, Void> instrumenter() {

View File

@ -33,7 +33,7 @@ public final class JedisSingletons {
.addAttributesExtractor(
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
public static Instrumenter<JedisRequest, Void> instrumenter() {

View File

@ -69,6 +69,6 @@ public final class JettyClientInstrumenterBuilder {
.addAttributesExtractor(NetClientAttributesExtractor.create(netAttributesGetter))
.addAttributesExtractors(additionalExtractors)
.addOperationMetrics(HttpClientMetrics.get())
.newClientInstrumenter(HttpHeaderSetter.INSTANCE);
.buildClientInstrumenter(HttpHeaderSetter.INSTANCE);
}
}

View File

@ -32,7 +32,7 @@ public final class JmsSingletons {
INSTRUMENTATION_NAME,
MessagingSpanNameExtractor.create(getter, operation))
.addAttributesExtractor(MessagingAttributesExtractor.create(getter, operation))
.newProducerInstrumenter(MessagePropertySetter.INSTANCE);
.buildProducerInstrumenter(MessagePropertySetter.INSTANCE);
}
private static Instrumenter<MessageWithDestination, Void> buildConsumerInstrumenter() {
@ -46,7 +46,7 @@ public final class JmsSingletons {
MessagingSpanNameExtractor.create(getter, operation))
.addAttributesExtractor(MessagingAttributesExtractor.create(getter, operation))
.setEnabled(ExperimentalConfig.get().messagingReceiveInstrumentationEnabled())
.newInstrumenter(SpanKindExtractor.alwaysConsumer());
.buildInstrumenter(SpanKindExtractor.alwaysConsumer());
}
private static Instrumenter<MessageWithDestination, Void> buildListenerInstrumenter() {
@ -58,7 +58,7 @@ public final class JmsSingletons {
INSTRUMENTATION_NAME,
MessagingSpanNameExtractor.create(getter, operation))
.addAttributesExtractor(MessagingAttributesExtractor.create(getter, operation))
.newConsumerInstrumenter(MessagePropertyGetter.INSTANCE);
.buildConsumerInstrumenter(MessagePropertyGetter.INSTANCE);
}
public static Instrumenter<MessageWithDestination, Void> producerInstrumenter() {

View File

@ -22,7 +22,7 @@ public class MojarraSingletons {
GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, JsfRequest::spanName)
.setErrorCauseExtractor(new JsfErrorCauseExtractor())
.setEnabled(ExperimentalConfig.get().controllerTelemetryEnabled())
.newInstrumenter();
.buildInstrumenter();
}
public static Instrumenter<JsfRequest, Void> instrumenter() {

View File

@ -21,7 +21,7 @@ public class MyFacesSingletons {
GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, JsfRequest::spanName)
.setErrorCauseExtractor(new MyFacesErrorCauseExtractor())
.setEnabled(ExperimentalConfig.get().controllerTelemetryEnabled())
.newInstrumenter();
.buildInstrumenter();
}
public static Instrumenter<JsfRequest, Void> instrumenter() {

View File

@ -36,7 +36,7 @@ public class HttpJspPageInstrumentationSingletons {
"io.opentelemetry.jsp-2.3",
HttpJspPageInstrumentationSingletons::spanNameOnRender)
.addAttributesExtractor(new RenderAttributesExtractor())
.newInstrumenter(SpanKindExtractor.alwaysInternal());
.buildInstrumenter(SpanKindExtractor.alwaysInternal());
}
private static String spanNameOnRender(HttpServletRequest req) {

View File

@ -30,7 +30,7 @@ public class JspCompilationContextInstrumentationSingletons {
"io.opentelemetry.jsp-2.3",
JspCompilationContextInstrumentationSingletons::spanNameOnCompile)
.addAttributesExtractor(new CompilationAttributesExtractor())
.newInstrumenter(SpanKindExtractor.alwaysInternal());
.buildInstrumenter(SpanKindExtractor.alwaysInternal());
}
public static String spanNameOnCompile(JspCompilationContext jspCompilationContext) {

View File

@ -78,7 +78,7 @@ public final class KafkaInstrumenterFactory {
.addAttributesExtractors(extractors)
.addAttributesExtractor(new KafkaProducerAdditionalAttributesExtractor())
.setErrorCauseExtractor(errorCauseExtractor)
.newInstrumenter(SpanKindExtractor.alwaysProducer());
.buildInstrumenter(SpanKindExtractor.alwaysProducer());
}
public Instrumenter<ConsumerRecords<?, ?>, Void> createConsumerReceiveInstrumenter() {
@ -92,7 +92,7 @@ public final class KafkaInstrumenterFactory {
.addAttributesExtractor(MessagingAttributesExtractor.create(getter, operation))
.setErrorCauseExtractor(errorCauseExtractor)
.setEnabled(messagingReceiveInstrumentationEnabled)
.newInstrumenter(SpanKindExtractor.alwaysConsumer());
.buildInstrumenter(SpanKindExtractor.alwaysConsumer());
}
public Instrumenter<ConsumerRecord<?, ?>, Void> createConsumerProcessInstrumenter() {
@ -119,15 +119,15 @@ public final class KafkaInstrumenterFactory {
}
if (!propagationEnabled) {
return builder.newInstrumenter(SpanKindExtractor.alwaysConsumer());
return builder.buildInstrumenter(SpanKindExtractor.alwaysConsumer());
} else if (messagingReceiveInstrumentationEnabled) {
builder.addSpanLinksExtractor(
SpanLinksExtractor.extractFromRequest(
openTelemetry.getPropagators().getTextMapPropagator(),
KafkaConsumerRecordGetter.INSTANCE));
return builder.newInstrumenter(SpanKindExtractor.alwaysConsumer());
return builder.buildInstrumenter(SpanKindExtractor.alwaysConsumer());
} else {
return builder.newConsumerInstrumenter(KafkaConsumerRecordGetter.INSTANCE);
return builder.buildConsumerInstrumenter(KafkaConsumerRecordGetter.INSTANCE);
}
}
@ -144,6 +144,6 @@ public final class KafkaInstrumenterFactory {
new KafkaBatchProcessSpanLinksExtractor(
openTelemetry.getPropagators().getTextMapPropagator()))
.setErrorCauseExtractor(errorCauseExtractor)
.newInstrumenter(SpanKindExtractor.alwaysConsumer());
.buildInstrumenter(SpanKindExtractor.alwaysConsumer());
}
}

View File

@ -109,7 +109,7 @@ class KtorServerTracing private constructor(
addContextCustomizer(HttpRouteHolder.get())
}
val instrumenter = instrumenterBuilder.newServerInstrumenter(ApplicationRequestGetter)
val instrumenter = instrumenterBuilder.buildServerInstrumenter(ApplicationRequestGetter)
val feature = KtorServerTracing(instrumenter)

View File

@ -109,7 +109,7 @@ class KtorServerTracing private constructor(
addContextCustomizer(HttpRouteHolder.get())
}
val instrumenter = instrumenterBuilder.newServerInstrumenter(ApplicationRequestGetter)
val instrumenter = instrumenterBuilder.buildServerInstrumenter(ApplicationRequestGetter)
val feature = KtorServerTracing(instrumenter)

View File

@ -54,7 +54,7 @@ public class KubernetesClientSingletons {
// Initialize with .newInstrumenter(alwaysClient()) instead of .newClientInstrumenter(..)
// because Request is immutable so context must be injected manually
INSTRUMENTER = instrumenterBuilder.newInstrumenter(alwaysClient());
INSTRUMENTER = instrumenterBuilder.buildInstrumenter(alwaysClient());
CONTEXT_PROPAGATORS = GlobalOpenTelemetry.getPropagators();
}

View File

@ -36,7 +36,7 @@ public final class LettuceSingletons {
INSTRUMENTATION_NAME,
DbClientSpanNameExtractor.create(dbAttributesGetter))
.addAttributesExtractor(DbClientAttributesExtractor.create(dbAttributesGetter))
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
LettuceConnectNetAttributesGetter netAttributesGetter = new LettuceConnectNetAttributesGetter();
@ -48,7 +48,7 @@ public final class LettuceSingletons {
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.addAttributesExtractor(new LettuceConnectAttributesExtractor())
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
public static Instrumenter<RedisCommand<?, ?, ?>, Void> instrumenter() {

View File

@ -36,7 +36,7 @@ public final class LettuceSingletons {
INSTRUMENTATION_NAME,
DbClientSpanNameExtractor.create(dbAttributesGetter))
.addAttributesExtractor(DbClientAttributesExtractor.create(dbAttributesGetter))
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
LettuceConnectNetAttributesGetter connectNetAttributesGetter =
new LettuceConnectNetAttributesGetter();
@ -49,7 +49,7 @@ public final class LettuceSingletons {
PeerServiceAttributesExtractor.create(
connectNetAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.addAttributesExtractor(new LettuceConnectAttributesExtractor())
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
public static Instrumenter<RedisCommand<?, ?, ?>, Void> instrumenter() {

View File

@ -40,7 +40,7 @@ public final class LibertyDispatcherSingletons {
.addAttributesExtractor(NetServerAttributesExtractor.create(netAttributesGetter))
.addContextCustomizer(HttpRouteHolder.get())
.addOperationMetrics(HttpServerMetrics.get())
.newServerInstrumenter(LibertyDispatcherRequestGetter.INSTANCE);
.buildServerInstrumenter(LibertyDispatcherRequestGetter.INSTANCE);
}
public static Instrumenter<LibertyRequest, LibertyResponse> instrumenter() {

View File

@ -23,7 +23,7 @@ public final class MethodSingletons {
INSTRUMENTER =
Instrumenter.<ClassAndMethod, Void>builder(
GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, spanName)
.newInstrumenter(SpanKindExtractor.alwaysInternal());
.buildInstrumenter(SpanKindExtractor.alwaysInternal());
}
public static Instrumenter<ClassAndMethod, Void> instrumenter() {

View File

@ -33,6 +33,6 @@ class MongoInstrumenterFactory {
.addAttributesExtractor(DbClientAttributesExtractor.create(dbAttributesGetter))
.addAttributesExtractor(netAttributesExtractor)
.addAttributesExtractor(attributesExtractor)
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
}

View File

@ -52,7 +52,7 @@ public final class NettyClientSingletons {
.addOperationMetrics(HttpClientMetrics.get())
.addContextCustomizer(
(context, requestAndChannel, startAttributes) -> NettyErrorHolder.init(context))
.newClientInstrumenter(HttpRequestHeadersSetter.INSTANCE);
.buildClientInstrumenter(HttpRequestHeadersSetter.INSTANCE);
NettyConnectNetAttributesGetter nettyConnectAttributesGetter =
new NettyConnectNetAttributesGetter();
@ -66,7 +66,7 @@ public final class NettyClientSingletons {
.addAttributesExtractor(
PeerServiceAttributesExtractor.create(
nettyConnectAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
public static Instrumenter<HttpRequestAndChannel, HttpResponse> instrumenter() {

View File

@ -43,7 +43,7 @@ final class NettyServerSingletons {
.addContextCustomizer(
(context, requestAndChannel, startAttributes) -> NettyErrorHolder.init(context))
.addContextCustomizer(HttpRouteHolder.get())
.newServerInstrumenter(NettyHeadersGetter.INSTANCE);
.buildServerInstrumenter(NettyHeadersGetter.INSTANCE);
}
public static Instrumenter<HttpRequestAndChannel, HttpResponse> instrumenter() {

View File

@ -55,7 +55,7 @@ public final class NettyClientInstrumenterFactory {
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.addOperationMetrics(HttpClientMetrics.get())
.newClientInstrumenter(HttpRequestHeadersSetter.INSTANCE);
.buildClientInstrumenter(HttpRequestHeadersSetter.INSTANCE);
}
public NettyConnectionInstrumenter createConnectionInstrumenter() {
@ -80,7 +80,7 @@ public final class NettyClientInstrumenterFactory {
}
Instrumenter<NettyConnectionRequest, Channel> instrumenter =
instrumenterBuilder.newInstrumenter(
instrumenterBuilder.buildInstrumenter(
connectionTelemetryEnabled
? SpanKindExtractor.alwaysInternal()
: SpanKindExtractor.alwaysClient());
@ -99,7 +99,7 @@ public final class NettyClientInstrumenterFactory {
.addAttributesExtractor(
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.newInstrumenter(
.buildInstrumenter(
sslTelemetryEnabled
? SpanKindExtractor.alwaysInternal()
: SpanKindExtractor.alwaysClient());

View File

@ -40,7 +40,7 @@ public final class NettyServerInstrumenterFactory {
.addOperationMetrics(HttpServerMetrics.get())
.addContextCustomizer((context, request, attributes) -> NettyErrorHolder.init(context))
.addContextCustomizer(HttpRouteHolder.get())
.newServerInstrumenter(HttpRequestHeadersGetter.INSTANCE);
.buildServerInstrumenter(HttpRequestHeadersGetter.INSTANCE);
}
private NettyServerInstrumenterFactory() {}

View File

@ -49,7 +49,7 @@ public final class OkHttp2Singletons {
PeerServiceAttributesExtractor.create(
netClientAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.addOperationMetrics(HttpClientMetrics.get())
.newInstrumenter(alwaysClient());
.buildInstrumenter(alwaysClient());
TRACING_INTERCEPTOR = new TracingInterceptor(INSTRUMENTER, openTelemetry.getPropagators());
}

View File

@ -84,7 +84,7 @@ public final class OkHttpTelemetryBuilder {
.addAttributesExtractor(NetClientAttributesExtractor.create(attributesGetter))
.addAttributesExtractors(additionalExtractors)
.addOperationMetrics(HttpClientMetrics.get())
.newInstrumenter(alwaysClient());
.buildInstrumenter(alwaysClient());
return new OkHttpTelemetry(instrumenter, openTelemetry.getPropagators());
}
}

View File

@ -36,7 +36,7 @@ public final class WithSpanSingletons {
private static Instrumenter<Method, Object> createInstrumenter() {
return Instrumenter.builder(
GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, WithSpanSingletons::spanNameFromMethod)
.newInstrumenter(WithSpanSingletons::spanKindFromMethod);
.buildInstrumenter(WithSpanSingletons::spanKindFromMethod);
}
private static Instrumenter<MethodRequest, Object> createInstrumenterWithAttributes() {
@ -49,7 +49,7 @@ public final class WithSpanSingletons {
MethodRequest::method,
WithSpanParameterAttributeNamesExtractor.INSTANCE,
MethodRequest::args))
.newInstrumenter(WithSpanSingletons::spanKindFromMethodRequest);
.buildInstrumenter(WithSpanSingletons::spanKindFromMethodRequest);
}
private static SpanKind spanKindFromMethodRequest(MethodRequest request) {

View File

@ -36,7 +36,7 @@ public final class WithSpanSingletons {
private static Instrumenter<Method, Object> createInstrumenter() {
return Instrumenter.builder(
GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, WithSpanSingletons::spanNameFromMethod)
.newInstrumenter(WithSpanSingletons::spanKindFromMethod);
.buildInstrumenter(WithSpanSingletons::spanKindFromMethod);
}
private static Instrumenter<MethodRequest, Object> createInstrumenterWithAttributes() {
@ -49,7 +49,7 @@ public final class WithSpanSingletons {
MethodRequest::method,
WithSpanParameterAttributeNamesExtractor.INSTANCE,
MethodRequest::args))
.newInstrumenter(WithSpanSingletons::spanKindFromMethodRequest);
.buildInstrumenter(WithSpanSingletons::spanKindFromMethodRequest);
}
private static SpanKind spanKindFromMethodRequest(MethodRequest request) {

View File

@ -25,7 +25,7 @@ public final class AgentSpanTestingInstrumenter {
Instrumenter.<String, Void>builder(GlobalOpenTelemetry.get(), "test", request -> request)
.addContextCustomizer(
(context, request, startAttributes) -> context.with(REQUEST_CONTEXT_KEY, request))
.newInstrumenter(SpanKindExtractor.alwaysInternal());
.buildInstrumenter(SpanKindExtractor.alwaysInternal());
private static final Instrumenter<String, Void> HTTP_SERVER_INSTRUMENTER =
Instrumenter.<String, Void>builder(GlobalOpenTelemetry.get(), "test", request -> request)
@ -34,7 +34,7 @@ public final class AgentSpanTestingInstrumenter {
.addContextCustomizer(HttpRouteHolder.get())
.addContextCustomizer(
(context, request, startAttributes) -> context.with(REQUEST_CONTEXT_KEY, request))
.newInstrumenter(SpanKindExtractor.alwaysServer());
.buildInstrumenter(SpanKindExtractor.alwaysServer());
public static Context startHttpServerSpan(String name) {
Context context = HTTP_SERVER_INSTRUMENTER.start(Context.current(), name);

View File

@ -19,7 +19,7 @@ public final class Play24Singletons {
private static final Instrumenter<Void, Void> INSTRUMENTER =
Instrumenter.<Void, Void>builder(
GlobalOpenTelemetry.get(), "io.opentelemetry.play-mvc-2.4", s -> SPAN_NAME)
.newInstrumenter();
.buildInstrumenter();
public static Instrumenter<Void, Void> instrumenter() {
return INSTRUMENTER;

View File

@ -25,7 +25,7 @@ public final class Play26Singletons {
private static final Instrumenter<Void, Void> INSTRUMENTER =
Instrumenter.<Void, Void>builder(
GlobalOpenTelemetry.get(), "io.opentelemetry.play-mvc-2.6", s -> SPAN_NAME)
.newInstrumenter();
.buildInstrumenter();
@Nullable private static final Method typedKeyGetUnderlying;

View File

@ -38,7 +38,7 @@ public final class PlayWsClientInstrumenterFactory {
PeerServiceAttributesExtractor.create(
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.addOperationMetrics(HttpClientMetrics.get())
.newClientInstrumenter(HttpHeaderSetter.INSTANCE);
.buildClientInstrumenter(HttpHeaderSetter.INSTANCE);
}
private PlayWsClientInstrumenterFactory() {}

View File

@ -50,6 +50,6 @@ public final class QuartzTelemetryBuilder {
CodeAttributesExtractor.create(new QuartzCodeAttributesGetter()));
instrumenter.addAttributesExtractors(additionalExtractors);
return new QuartzTelemetry(new TracingJobListener(instrumenter.newInstrumenter()));
return new QuartzTelemetry(new TracingJobListener(instrumenter.buildInstrumenter()));
}
}

View File

@ -55,7 +55,7 @@ public class RabbitSingletons {
RabbitChannelAttributesGetter.INSTANCE, MessageOperation.SEND))
.addAttributesExtractor(
NetClientAttributesExtractor.create(new RabbitChannelNetAttributesGetter()))
.newInstrumenter(
.buildInstrumenter(
channelAndMethod ->
channelAndMethod.getMethod().equals("Channel.basicPublish") ? PRODUCER : CLIENT);
}
@ -73,7 +73,7 @@ public class RabbitSingletons {
return Instrumenter.<ReceiveRequest, GetResponse>builder(
GlobalOpenTelemetry.get(), instrumentationName, ReceiveRequest::spanName)
.addAttributesExtractors(extractors)
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
private static Instrumenter<DeliveryRequest, Void> createDeliverInstrumenter() {
@ -89,6 +89,6 @@ public class RabbitSingletons {
return Instrumenter.<DeliveryRequest, Void>builder(
GlobalOpenTelemetry.get(), instrumentationName, DeliveryRequest::spanName)
.addAttributesExtractors(extractors)
.newConsumerInstrumenter(DeliveryRequestGetter.INSTANCE);
.buildConsumerInstrumenter(DeliveryRequestGetter.INSTANCE);
}
}

View File

@ -19,7 +19,7 @@ public final class RatpackSingletons {
private static final Instrumenter<String, Void> INSTRUMENTER =
Instrumenter.<String, Void>builder(
GlobalOpenTelemetry.get(), "io.opentelemetry.ratpack-1.4", s -> s)
.newInstrumenter();
.buildInstrumenter();
public static Instrumenter<String, Void> instrumenter() {
return INSTRUMENTER;

View File

@ -118,7 +118,7 @@ public final class RatpackTelemetryBuilder {
.addAttributesExtractor(httpServerAttributesExtractorBuilder.build())
.addAttributesExtractors(additionalExtractors)
.addOperationMetrics(HttpServerMetrics.get())
.newServerInstrumenter(RatpackGetter.INSTANCE);
.buildServerInstrumenter(RatpackGetter.INSTANCE);
return new RatpackTelemetry(instrumenter, httpClientInstrumenter());
}
@ -134,6 +134,6 @@ public final class RatpackTelemetryBuilder {
.addAttributesExtractor(httpClientAttributesExtractorBuilder.build())
.addAttributesExtractors(additionalHttpClientExtractors)
.addOperationMetrics(HttpServerMetrics.get())
.newClientInstrumenter(RequestHeaderSetter.INSTANCE);
.buildClientInstrumenter(RequestHeaderSetter.INSTANCE);
}
}

View File

@ -68,7 +68,7 @@ public final class ReactorNettySingletons {
netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))
.addOperationMetrics(HttpClientMetrics.get())
// headers are injected in ResponseReceiverInstrumenter
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
NettyClientInstrumenterFactory instrumenterFactory =
new NettyClientInstrumenterFactory(INSTRUMENTATION_NAME, connectionTelemetryEnabled, false);

View File

@ -27,7 +27,7 @@ public final class RediscalaSingletons {
INSTRUMENTATION_NAME,
DbClientSpanNameExtractor.create(dbAttributesGetter))
.addAttributesExtractor(DbClientAttributesExtractor.create(dbAttributesGetter))
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
public static Instrumenter<RedisCommand<?, ?>, Void> instrumenter() {

View File

@ -24,7 +24,7 @@ public final class RedissonInstrumenterFactory {
DbClientSpanNameExtractor.create(dbAttributesGetter))
.addAttributesExtractor(DbClientAttributesExtractor.create(dbAttributesGetter))
.addAttributesExtractor(NetClientAttributesExtractor.create(netAttributesGetter))
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
private RedissonInstrumenterFactory() {}

View File

@ -83,7 +83,7 @@ public final class RestletTelemetryBuilder {
.addAttributesExtractor(NetServerAttributesExtractor.create(netAttributesGetter))
.addAttributesExtractors(additionalExtractors)
.addOperationMetrics(HttpServerMetrics.get())
.newServerInstrumenter(RestletHeadersGetter.INSTANCE);
.buildServerInstrumenter(RestletHeadersGetter.INSTANCE);
return new RestletTelemetry(instrumenter);
}

View File

@ -40,6 +40,6 @@ public class RestletInstrumenterFactory {
.addAttributesExtractor(NetServerAttributesExtractor.create(netAttributesGetter))
.addAttributesExtractors(additionalExtractors)
.addOperationMetrics(HttpServerMetrics.get())
.newServerInstrumenter(new RestletHeadersGetter());
.buildServerInstrumenter(new RestletHeadersGetter());
}
}

View File

@ -25,7 +25,7 @@ public final class RmiClientSingletons {
"io.opentelemetry.rmi",
RpcSpanNameExtractor.create(rpcAttributesGetter))
.addAttributesExtractor(RpcClientAttributesExtractor.create(rpcAttributesGetter))
.newInstrumenter(SpanKindExtractor.alwaysClient());
.buildInstrumenter(SpanKindExtractor.alwaysClient());
}
public static Instrumenter<Method, Void> instrumenter() {

View File

@ -25,7 +25,7 @@ public final class RmiServerSingletons {
"io.opentelemetry.rmi",
RpcSpanNameExtractor.create(rpcAttributesGetter))
.addAttributesExtractor(RpcServerAttributesExtractor.create(rpcAttributesGetter))
.newInstrumenter(SpanKindExtractor.alwaysServer());
.buildInstrumenter(SpanKindExtractor.alwaysServer());
}
public static Instrumenter<ClassAndMethod, Void> instrumenter() {

View File

@ -44,9 +44,9 @@ class RocketMqInstrumenterFactory {
}
if (propagationEnabled) {
return instrumenterBuilder.newProducerInstrumenter(MapSetter.INSTANCE);
return instrumenterBuilder.buildProducerInstrumenter(MapSetter.INSTANCE);
} else {
return instrumenterBuilder.newInstrumenter(SpanKindExtractor.alwaysProducer());
return instrumenterBuilder.buildInstrumenter(SpanKindExtractor.alwaysProducer());
}
}
@ -66,7 +66,7 @@ class RocketMqInstrumenterFactory {
openTelemetry, captureExperimentalSpanAttributes, propagationEnabled, false),
createProcessInstrumenter(
openTelemetry, captureExperimentalSpanAttributes, propagationEnabled, true),
batchReceiveInstrumenterBuilder.newInstrumenter(SpanKindExtractor.alwaysConsumer()));
batchReceiveInstrumenterBuilder.buildInstrumenter(SpanKindExtractor.alwaysConsumer()));
}
private static Instrumenter<MessageExt, Void> createProcessInstrumenter(
@ -90,7 +90,7 @@ class RocketMqInstrumenterFactory {
}
if (!propagationEnabled) {
return builder.newInstrumenter(SpanKindExtractor.alwaysConsumer());
return builder.buildInstrumenter(SpanKindExtractor.alwaysConsumer());
}
if (batch) {
@ -101,9 +101,9 @@ class RocketMqInstrumenterFactory {
return builder
.addSpanLinksExtractor(spanLinksExtractor)
.newInstrumenter(SpanKindExtractor.alwaysConsumer());
.buildInstrumenter(SpanKindExtractor.alwaysConsumer());
} else {
return builder.newConsumerInstrumenter(TextMapExtractAdapter.INSTANCE);
return builder.buildConsumerInstrumenter(TextMapExtractAdapter.INSTANCE);
}
}

View File

@ -76,7 +76,7 @@ public final class ServletInstrumenterBuilder<REQUEST, RESPONSE> {
contextCustomizers) {
builder.addContextCustomizer(contextCustomizer);
}
return builder.newServerInstrumenter(new ServletRequestGetter<>(accessor));
return builder.buildServerInstrumenter(new ServletRequestGetter<>(accessor));
}
public Instrumenter<ServletRequestContext<REQUEST>, ServletResponseContext<RESPONSE>> build(

View File

@ -15,7 +15,7 @@ public final class ResponseInstrumenterFactory {
public static Instrumenter<ClassAndMethod, Void> createInstrumenter(String instrumentationName) {
return Instrumenter.<ClassAndMethod, Void>builder(
GlobalOpenTelemetry.get(), instrumentationName, SpanNames::fromMethod)
.newInstrumenter();
.buildInstrumenter();
}
private ResponseInstrumenterFactory() {}

View File

@ -32,7 +32,7 @@ public class ChunkSingletons {
instrumenterBuilder.addSpanLinksExtractor(ChunkSingletons::extractSpanLinks);
}
INSTRUMENTER = instrumenterBuilder.newInstrumenter();
INSTRUMENTER = instrumenterBuilder.buildInstrumenter();
}
public static Instrumenter<ChunkContextAndBuilder, Void> chunkInstrumenter() {

View File

@ -22,7 +22,7 @@ public class ItemSingletons {
private static final Instrumenter<String, Void> INSTRUMENTER =
Instrumenter.<String, Void>builder(
GlobalOpenTelemetry.get(), instrumentationName(), str -> str)
.newInstrumenter();
.buildInstrumenter();
public static Instrumenter<String, Void> itemInstrumenter() {
return INSTRUMENTER;

View File

@ -16,7 +16,7 @@ public class JobSingletons {
private static final Instrumenter<JobExecution, Void> INSTRUMENTER =
Instrumenter.<JobExecution, Void>builder(
GlobalOpenTelemetry.get(), instrumentationName(), JobSingletons::extractSpanName)
.newInstrumenter();
.buildInstrumenter();
private static String extractSpanName(JobExecution jobExecution) {
return "BatchJob " + jobExecution.getJobInstance().getJobName();

View File

@ -16,7 +16,7 @@ public class StepSingletons {
private static final Instrumenter<StepExecution, Void> INSTRUMENTER =
Instrumenter.<StepExecution, Void>builder(
GlobalOpenTelemetry.get(), instrumentationName(), StepSingletons::spanName)
.newInstrumenter();
.buildInstrumenter();
public static Instrumenter<StepExecution, Void> stepInstrumenter() {
return INSTRUMENTER;

View File

@ -49,7 +49,7 @@ public class WithSpanAspect {
JoinPointRequest::method,
parameterAttributeNamesExtractor,
JoinPointRequest::args))
.newInstrumenter(WithSpanAspect::spanKind);
.buildInstrumenter(WithSpanAspect::spanKind);
}
private static String spanName(JoinPointRequest request) {

View File

@ -15,7 +15,7 @@ public final class SpringDataSingletons {
private static final Instrumenter<ClassAndMethod, Void> INSTRUMENTER =
Instrumenter.<ClassAndMethod, Void>builder(
GlobalOpenTelemetry.get(), "io.opentelemetry.spring-data-1.8", SpanNames::fromMethod)
.newInstrumenter();
.buildInstrumenter();
public static Instrumenter<ClassAndMethod, Void> instrumenter() {
return INSTRUMENTER;

Some files were not shown because too many files have changed in this diff Show More