io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpServerInstrumenters Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of opentelemetry-javaagent-extension-api Show documentation
Show all versions of opentelemetry-javaagent-extension-api Show documentation
Instrumentation of Java libraries using OpenTelemetry.
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.bootstrap.internal;
import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.context.propagation.TextMapGetter;
import io.opentelemetry.instrumentation.api.incubator.builder.internal.DefaultHttpServerInstrumenterBuilder;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder;
import io.opentelemetry.instrumentation.api.semconv.http.HttpServerAttributesGetter;
import java.util.function.Consumer;
/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
public final class JavaagentHttpServerInstrumenters {
private JavaagentHttpServerInstrumenters() {}
public static Instrumenter create(
String instrumentationName,
HttpServerAttributesGetter httpAttributesGetter,
TextMapGetter headerGetter) {
return create(instrumentationName, httpAttributesGetter, headerGetter, customizer -> {});
}
public static Instrumenter create(
DefaultHttpServerInstrumenterBuilder builder) {
return create(builder, customizer -> {});
}
public static Instrumenter create(
String instrumentationName,
HttpServerAttributesGetter httpAttributesGetter,
TextMapGetter headerGetter,
Consumer> instrumenterBuilderConsumer) {
return create(
DefaultHttpServerInstrumenterBuilder.create(
instrumentationName, GlobalOpenTelemetry.get(), httpAttributesGetter, headerGetter),
instrumenterBuilderConsumer);
}
public static Instrumenter create(
DefaultHttpServerInstrumenterBuilder builder,
Consumer> builderCustomizer) {
return builder
.configure(AgentCommonConfig.get())
.setBuilderCustomizer(builderCustomizer)
.build();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy