Skip to content
Closed
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
9 changes: 9 additions & 0 deletions instrumentation/akka/akka-http-10.0/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,55 @@ features:
- CONTEXT_PROPAGATION
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.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 @@ -8,9 +8,11 @@
import com.alibaba.druid.pool.DruidDataSourceMBean;
import io.opentelemetry.api.OpenTelemetry;

/** Entrypoint for instrumenting Alibaba Druid database connection pools. */
public final class DruidTelemetry {
private final OpenTelemetry openTelemetry;

/** Returns a new {@link DruidTelemetry} configured with the given {@link OpenTelemetry}. */
public static DruidTelemetry create(OpenTelemetry openTelemetry) {
return new DruidTelemetry(openTelemetry);
}
Expand All @@ -19,10 +21,12 @@ private DruidTelemetry(OpenTelemetry openTelemetry) {
this.openTelemetry = openTelemetry;
}

/** Start collecting metrics for given connection pool. */
public void registerMetrics(DruidDataSourceMBean dataSource, String dataSourceName) {
ConnectionPoolMetrics.registerMetrics(openTelemetry, dataSource, dataSourceName);
}

/** Stop collecting metrics for given connection pool. */
public void unregisterMetrics(DruidDataSourceMBean dataSource) {
ConnectionPoolMetrics.unregisterMetrics(dataSource);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void set(@Nullable DubboRequest request, String key, String value) {
if (request == null) {
return;
}
request.context().setAttachment(key, value);
request.getContext().setAttachment(key, value);
request.invocation().setAttachment(key, value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ final class DubboNetworkServerAttributesGetter
@Override
public InetSocketAddress getNetworkLocalInetSocketAddress(
DubboRequest request, @Nullable Result result) {
return request.localAddress();
return request.getLocalAddress();
}

@Override
@Nullable
public InetSocketAddress getNetworkPeerInetSocketAddress(
DubboRequest request, @Nullable Result result) {
return request.remoteAddress();
return request.getRemoteAddress();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,47 @@ static DubboRequest create(RpcInvocation invocation, RpcContext context) {

abstract RpcInvocation invocation();

public abstract RpcContext context();
public abstract RpcContext getContext();

public abstract URL url();
/**
* @deprecated Use {@link #getContext()} instead. Will be removed in a future release.
*/
@Deprecated
public RpcContext context() {
return getContext();
}

public abstract URL getUrl();

/**
* @deprecated Use {@link #getUrl()} instead. Will be removed in a future release.
*/
@Deprecated
public URL url() {
return getUrl();
}

@Nullable
public abstract InetSocketAddress getRemoteAddress();

/**
* @deprecated Use {@link #getRemoteAddress()} instead. Will be removed in a future release.
*/
@Deprecated
@Nullable
public abstract InetSocketAddress remoteAddress();
public InetSocketAddress remoteAddress() {
return getRemoteAddress();
}

@Nullable
public abstract InetSocketAddress localAddress();
public abstract InetSocketAddress getLocalAddress();

/**
* @deprecated Use {@link #getLocalAddress()} instead. Will be removed in a future release.
*/
@Deprecated
@Nullable
public InetSocketAddress localAddress() {
return getLocalAddress();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ public final class DubboClientNetworkAttributesGetter
@Nullable
@Override
public String getServerAddress(DubboRequest request) {
return request.url().getHost();
return request.getUrl().getHost();
}

@Override
public Integer getServerPort(DubboRequest request) {
return request.url().getPort();
return request.getUrl().getPort();
}

@Override
@Nullable
public InetSocketAddress getNetworkPeerInetSocketAddress(
DubboRequest request, @Nullable Result response) {
return request.remoteAddress();
return request.getRemoteAddress();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ static void tearDown() {
System.clearProperty("dubbo.application.qos-enable");
}

ReferenceConfig<HelloService> configureClient(int port) {
private static ReferenceConfig<HelloService> configureClient(int port) {
ReferenceConfig<HelloService> reference = new ReferenceConfig<>();
reference.setInterface(HelloService.class);
reference.setGeneric("true");
reference.setUrl("dubbo://localhost:" + port + "/?timeout=30000");
return reference;
}

ServiceConfig<HelloServiceImpl> configureServer() {
private static ServiceConfig<HelloServiceImpl> configureServer() {
RegistryConfig registerConfig = new RegistryConfig();
registerConfig.setAddress("N/A");
ServiceConfig<HelloServiceImpl> service = new ServiceConfig<>();
Expand All @@ -91,7 +91,8 @@ ServiceConfig<HelloServiceImpl> configureServer() {
}

@SuppressWarnings({"rawtypes", "unchecked"})
ReferenceConfig<GenericService> convertReference(ReferenceConfig<HelloService> config) {
private static ReferenceConfig<GenericService> convertReference(
ReferenceConfig<HelloService> config) {
return (ReferenceConfig) config;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,31 @@ static void tearDown() {

protected abstract boolean hasServicePeerName();

ReferenceConfig<HelloService> configureClient(int port) {
private static ReferenceConfig<HelloService> configureClient(int port) {
ReferenceConfig<HelloService> reference = new ReferenceConfig<>();
reference.setInterface(HelloService.class);
reference.setGeneric("true");
reference.setUrl("dubbo://localhost:" + port + "/?timeout=30000");
return reference;
}

ReferenceConfig<HelloService> configureLocalClient(int port) {
private static ReferenceConfig<HelloService> configureLocalClient(int port) {
ReferenceConfig<HelloService> reference = new ReferenceConfig<>();
reference.setInterface(HelloService.class);
reference.setGeneric("true");
reference.setUrl("injvm://localhost:" + port + "/?timeout=30000");
return reference;
}

ReferenceConfig<MiddleService> configureMiddleClient(int port) {
private static ReferenceConfig<MiddleService> configureMiddleClient(int port) {
ReferenceConfig<MiddleService> reference = new ReferenceConfig<>();
reference.setInterface(MiddleService.class);
reference.setGeneric("true");
reference.setUrl("dubbo://localhost:" + port + "/?timeout=30000");
return reference;
}

ServiceConfig<HelloService> configureServer() {
private static ServiceConfig<HelloService> configureServer() {
RegistryConfig registerConfig = new RegistryConfig();
registerConfig.setAddress("N/A");
ServiceConfig<HelloService> service = new ServiceConfig<>();
Expand All @@ -104,7 +104,7 @@ ServiceConfig<HelloService> configureServer() {
return service;
}

ServiceConfig<MiddleService> configureMiddleServer(
private static ServiceConfig<MiddleService> configureMiddleServer(
ReferenceConfig<HelloService> referenceConfig) {
RegistryConfig registerConfig = new RegistryConfig();
registerConfig.setAddress("N/A");
Expand All @@ -116,7 +116,8 @@ ServiceConfig<MiddleService> configureMiddleServer(
}

@SuppressWarnings({"rawtypes", "unchecked"})
ReferenceConfig<GenericService> convertReference(ReferenceConfig<MiddleService> config) {
private static ReferenceConfig<GenericService> convertReference(
ReferenceConfig<MiddleService> config) {
return (ReferenceConfig) config;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/** compatible with dubbo3.x and dubbo 2.7 */
class DubboTestUtil {

static Object newFrameworkModel() {
private static Object newFrameworkModel() {
try {
// only present in latest dep
return Class.forName("org.apache.dubbo.rpc.model.FrameworkModel")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ public static ElasticJobHelper.ElasticJobScope onEnter(
public static void onExit(
@Advice.Enter @Nullable ElasticJobHelper.ElasticJobScope scope,
@Advice.Thrown @Nullable Throwable throwable) {
helper().endSpan(scope, throwable);
if (scope != null) {
helper().endSpan(scope, throwable);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ public ElasticJobScope startSpan(ElasticJobProcessRequest request) {
return new ElasticJobScope(request, context, context.makeCurrent());
}

public void endSpan(@Nullable ElasticJobScope scope, @Nullable Throwable throwable) {
if (scope != null) {
scope.scope.close();
this.instrumenter.end(scope.context, scope.request, null, throwable);
}
public void endSpan(ElasticJobScope scope, @Nullable Throwable throwable) {
scope.scope.close();
this.instrumenter.end(scope.context, scope.request, null, throwable);
}

public static class ElasticJobScope {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ public static ElasticJobHelper.ElasticJobScope onEnter(
public static void onExit(
@Advice.Enter @Nullable ElasticJobHelper.ElasticJobScope scope,
@Advice.Thrown @Nullable Throwable throwable) {
helper().endSpan(scope, throwable);
if (scope != null) {
helper().endSpan(scope, throwable);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ public static ElasticJobHelper.ElasticJobScope onEnter(
public static void onExit(
@Advice.Enter @Nullable ElasticJobHelper.ElasticJobScope scope,
@Advice.Thrown @Nullable Throwable throwable) {
helper().endSpan(scope, throwable);
if (scope != null) {
helper().endSpan(scope, throwable);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ public static ElasticJobHelper.ElasticJobScope onEnter(
public static void onExit(
@Advice.Enter @Nullable ElasticJobHelper.ElasticJobScope scope,
@Advice.Thrown @Nullable Throwable throwable) {
helper().endSpan(scope, throwable);
if (scope != null) {
helper().endSpan(scope, throwable);
}
}
}
}