Skip to content
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
11 changes: 11 additions & 0 deletions instrumentation/netty/netty-4.1/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,54 +10,65 @@ semantic_conventions:
library_link: https://netty.io/
configurations:
- name: otel.instrumentation.http.known-methods
declarative_name: java.common.http.known_methods
description: >
Configures the instrumentation to recognize an alternative set of HTTP request methods. All
other methods will be treated as `_OTHER`.
type: list
default: "CONNECT,DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT,TRACE"
- name: otel.instrumentation.http.client.capture-request-headers
declarative_name: general.http.client.request_captured_headers
description: List of HTTP request headers to capture in HTTP client telemetry.
type: list
default: ""
- name: otel.instrumentation.http.client.capture-response-headers
declarative_name: general.http.client.response_captured_headers
description: List of HTTP response headers to capture in HTTP client telemetry.
type: list
default: ""
- name: otel.instrumentation.common.peer-service-mapping
declarative_name: java.common.peer_service_mapping
description: Used to specify a mapping from host names or IP addresses to peer services.
type: map
default: ""
- name: otel.instrumentation.http.client.emit-experimental-telemetry
declarative_name: java.common.http.client.emit_experimental_telemetry/development
description: >
Enable the capture of experimental HTTP client telemetry. Adds the `http.request.body.size`
and `http.response.body.size` attributes to spans, and records `http.client.request.size` and
`http.client.response.size` metrics.
type: boolean
default: false
- name: otel.instrumentation.http.server.capture-request-headers
declarative_name: general.http.server.request_captured_headers
description: List of HTTP request headers to capture in HTTP server telemetry.
type: list
default: ""
- name: otel.instrumentation.http.server.capture-response-headers
declarative_name: general.http.server.response_captured_headers
description: List of HTTP response headers to capture in HTTP server telemetry.
type: list
default: ""
- name: otel.instrumentation.http.server.emit-experimental-telemetry
declarative_name: java.common.http.server.emit_experimental_telemetry/development
description: >
Enable the capture of experimental HTTP server telemetry. Adds the `http.request.body.size`
and `http.response.body.size` attributes to spans, and records `http.server.request.size` and
`http.server.response.size` metrics.
type: boolean
default: false
- name: otel.instrumentation.netty.connection-telemetry.enabled
declarative_name: java.netty.connection_telemetry.enabled
description: Enable the creation of Connect and DNS spans.
type: boolean
default: false
- name: otel.instrumentation.netty.ssl-telemetry.enabled
declarative_name: java.netty.ssl_telemetry.enabled
description: Enable SSL telemetry.
type: boolean
default: false
- name: otel.instrumentation.sanitization.url.experimental.sensitive-query-parameters
declarative_name: general.sanitization.url.sensitive_query_parameters/development
description: List of URL query parameter names whose values are redacted in URL attributes. See https://opentelemetry.io/docs/specs/semconv/http/http-spans.
type: list
default: "AWSAccessKeyId,Signature,sig,X-Goog-Signature"
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public ClientHandler(CompletableFuture<Integer> responseCode) {
}

@Override
public void channelRead0(ChannelHandlerContext ctx, HttpObject msg) {
protected void channelRead0(ChannelHandlerContext ctx, HttpObject msg) {
if (msg instanceof FullHttpResponse) {
ctx.pipeline().remove(this);
FullHttpResponse response = (FullHttpResponse) msg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public final class HttpSchemeUtil {

@Nullable
private static final Class<? extends ChannelHandler> sslHandlerClass = getSslHandlerClass();
private static final Class<? extends ChannelHandler> SSL_HANDLER_CLASS = getSslHandlerClass();

@Nullable
private static Class<? extends ChannelHandler> getSslHandlerClass() {
Expand All @@ -33,8 +33,8 @@ public static String getScheme(NettyCommonRequest requestAndChannel) {
}

private static boolean isHttps(NettyCommonRequest requestAndChannel) {
return sslHandlerClass != null
&& requestAndChannel.getChannel().pipeline().get(sslHandlerClass) != null;
return SSL_HANDLER_CLASS != null
&& requestAndChannel.getChannel().pipeline().get(SSL_HANDLER_CLASS) != null;
}

private HttpSchemeUtil() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
* any time.
*/
public final class NettyClientInstrumenterBuilderFactory {
private NettyClientInstrumenterBuilderFactory() {}

public static DefaultHttpClientInstrumenterBuilder<NettyCommonRequest, HttpResponse> create(
String instrumentationName, OpenTelemetry openTelemetry) {

Expand All @@ -26,4 +24,6 @@ public static DefaultHttpClientInstrumenterBuilder<NettyCommonRequest, HttpRespo
new NettyHttpClientAttributesGetter(),
new HttpRequestHeadersSetter());
}

private NettyClientInstrumenterBuilderFactory() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public final class NettySslInstrumentationHandler extends ChannelDuplexHandler {

// this is used elsewhere to manage the link between the underlying (user) handler and our handler
// which is needed below so that we can unlink this handler when we remove it below
private static final VirtualField<ChannelHandler, ChannelHandler> instrumentationHandlerField =
private static final VirtualField<ChannelHandler, ChannelHandler> INSTRUMENTATION_HANDLER_FIELD =
VirtualField.find(ChannelHandler.class, ChannelHandler.class);

static {
Expand All @@ -45,7 +45,7 @@ public final class NettySslInstrumentationHandler extends ChannelDuplexHandler {
MethodHandles.lookup()
.findVirtual(
sslHandshakeCompletionEvent, "cause", MethodType.methodType(Throwable.class));
} catch (Throwable t) {
} catch (Throwable ignored) {
// no SSL classes on classpath
}
SSL_HANDSHAKE_COMPLETION_EVENT = sslHandshakeCompletionEvent;
Expand All @@ -70,7 +70,7 @@ public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
// are on classpath); checking just to be extra safe
if (SSL_HANDSHAKE_COMPLETION_EVENT == null) {
ctx.pipeline().remove(this);
instrumentationHandlerField.set(realHandler, null);
INSTRUMENTATION_HANDLER_FIELD.set(realHandler, null);
super.channelRegistered(ctx);
return;
}
Expand Down Expand Up @@ -113,7 +113,7 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exc
if (sslHandshakeCompletionEvent != null && sslHandshakeCompletionEvent.isInstance(evt)) {
if (ctx.pipeline().context(this) != null) {
ctx.pipeline().remove(this);
instrumentationHandlerField.set(realHandler, null);
INSTRUMENTATION_HANDLER_FIELD.set(realHandler, null);
}

if (context != null && request != null) {
Expand All @@ -132,7 +132,7 @@ private static Throwable getCause(Object evt) {
}
try {
return (Throwable) getCause.invoke(evt);
} catch (Throwable e) {
} catch (Throwable ignored) {
// should not ever happen
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ public final class Timer implements ImplicitContextKeyed {

private static final ContextKey<Timer> KEY = ContextKey.named("opentelemetry-timer-key");

private final Instant startTime;
private final long startNanoTime;

public static Timer start() {
return new Timer(Instant.now(), System.nanoTime());
}

private final Instant startTime;
private final long startNanoTime;

private Timer(Instant startTime, long startNanoTime) {
this.startTime = startTime;
this.startNanoTime = startNanoTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static PropagatedContext onEnter(@Advice.Argument(0) Runnable call) {
public static void onExit(
@Advice.Argument(0) Runnable call,
@Advice.Enter @Nullable PropagatedContext propagatedContext,
@Advice.Thrown Throwable throwable) {
@Advice.Thrown @Nullable Throwable throwable) {
ExecutorAdviceHelper.cleanUpAfterSubmit(
propagatedContext, throwable, PROPAGATED_CONTEXT, call);
}
Expand Down
1 change: 1 addition & 0 deletions instrumentation/okhttp/okhttp-2.2/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ configurations:
type: list
default: ""
- name: otel.instrumentation.common.peer-service-mapping
declarative_name: java.common.peer_service_mapping
description: Used to specify a mapping from host names or IP addresses to peer services.
type: map
default: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class TracingCallFactory implements Call.Factory {
static {
try {
timeoutMethod = Call.class.getMethod("timeout");
} catch (NoSuchMethodException e) {
} catch (NoSuchMethodException ignored) {
timeoutMethod = null;
}
}
Expand Down Expand Up @@ -148,7 +148,7 @@ public Timeout timeout() {
}
try {
return (Timeout) timeoutMethod.invoke(delegate);
} catch (IllegalAccessException | InvocationTargetException e) {
} catch (IllegalAccessException | InvocationTargetException ignored) {
// do nothing...we're before 3.12, or something else has gone wrong that we can't do
// anything about.
return Timeout.NONE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ public Response intercept(Chain chain) throws IOException {
return response;
}

// Context injection is being handled manually for a reason: we want to use the OkHttp Request
// type for additional AttributeExtractors provided by the user of this library
// thus we must use Instrumenter<Request, Response>, and Request is immutable
// Context injection is handled manually because OkHttp Request is immutable.
private Request injectContextToRequest(Request request, Context context) {
Request.Builder requestBuilder = request.newBuilder();
propagators
Expand Down
1 change: 1 addition & 0 deletions instrumentation/okhttp/okhttp-3.0/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ configurations:
type: list
default: ""
- name: otel.instrumentation.common.peer-service-mapping
declarative_name: java.common.peer_service_mapping
description: Used to specify a mapping from host names or IP addresses to peer services.
type: map
default: ""
Expand Down
Loading