Skip to content

Commit 5551b1f

Browse files
authored
Code review sweep (run 24941446472) (open-telemetry#18297)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
1 parent 950dce4 commit 5551b1f

10 files changed

Lines changed: 29 additions & 23 deletions

File tree

instrumentation/alibaba-druid-1.0/metadata.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ semantic_conventions:
77
- DATABASE_POOL_METRICS
88
configurations:
99
- name: otel.semconv-stability.opt-in
10+
declarative_name: general.semconv_stability.opt_in
1011
description: >
1112
Opt-in to emit stable semantic conventions instead of the old
1213
experimental semantic conventions. Accepts a comma-separated list of semantic convention

instrumentation/apache-dbcp-2.0/metadata.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ semantic_conventions:
1111
- DATABASE_POOL_METRICS
1212
configurations:
1313
- name: otel.semconv-stability.opt-in
14+
declarative_name: general.semconv_stability.opt_in
1415
description: >
1516
Opt-in to emit stable semantic conventions instead of the old
1617
experimental semantic conventions. Accepts a comma-separated list of semantic convention

instrumentation/apache-dubbo-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachedubbo/v2_7/DubboSingletons.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import io.opentelemetry.instrumentation.api.incubator.semconv.service.peer.ServicePeerAttributesExtractor;
1212
import org.apache.dubbo.rpc.Filter;
1313

14-
public class DubboSingletons {
14+
class DubboSingletons {
1515
private static final Filter clientFilter;
1616
private static final Filter serverFilter;
1717

@@ -26,11 +26,11 @@ public class DubboSingletons {
2626
serverFilter = telemetry.newServerFilter();
2727
}
2828

29-
public static Filter clientFilter() {
29+
static Filter clientFilter() {
3030
return clientFilter;
3131
}
3232

33-
public static Filter serverFilter() {
33+
static Filter serverFilter() {
3434
return serverFilter;
3535
}
3636

instrumentation/apache-dubbo-2.7/library-autoconfigure/src/test/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboHeadersGetterTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DubboHeadersGetterTest {
2626
@Mock RpcInvocation rpcInvocation;
2727

2828
@Test
29-
void testKeys() throws Exception {
29+
void testKeys() throws ReflectiveOperationException {
3030
when(context.getUrl()).thenReturn(new URL("http", "localhost", 1));
3131
when(context.getRemoteAddress()).thenReturn(new InetSocketAddress(1));
3232
when(context.getLocalAddress()).thenReturn(new InetSocketAddress(1));
@@ -43,7 +43,7 @@ void testKeys() throws Exception {
4343
}
4444

4545
@SuppressWarnings("unchecked")
46-
private Map<Object, Object> getObjectAttachments() throws Exception {
46+
private Map<Object, Object> getObjectAttachments() throws ReflectiveOperationException {
4747
return (Map<Object, Object>)
4848
RpcInvocation.class.getMethod("getObjectAttachments").invoke(rpcInvocation);
4949
}

instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import java.lang.reflect.Field;
3232
import java.net.InetAddress;
3333
import java.util.concurrent.CompletableFuture;
34-
import java.util.concurrent.ExecutionException;
3534
import java.util.function.Consumer;
3635
import org.apache.dubbo.common.utils.NetUtils;
3736
import org.apache.dubbo.config.ApplicationConfig;
@@ -280,8 +279,7 @@ void testApacheDubboBase() throws ReflectiveOperationException {
280279
}
281280

282281
@Test
283-
void testApacheDubboTest()
284-
throws ExecutionException, InterruptedException, ReflectiveOperationException {
282+
void testApacheDubboTest() throws ReflectiveOperationException {
285283
int port = PortUtils.findOpenPort();
286284
protocolConfig.setPort(port);
287285

@@ -315,7 +313,7 @@ void testApacheDubboTest()
315313
genericService.$invokeAsync(
316314
"hello", new String[] {String.class.getName()}, new Object[] {"hello"}));
317315

318-
assertThat(response.get()).isEqualTo("hello");
316+
assertThat(response.join()).isEqualTo("hello");
319317

320318
testing()
321319
.waitAndAssertTraces(

instrumentation/apache-elasticjob-3.0/metadata.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ description: This instrumentation enables spans for Apache ElasticJob job execut
33
library_link: https://shardingsphere.apache.org/elasticjob/
44
configurations:
55
- name: otel.instrumentation.apache-elasticjob.experimental-span-attributes
6+
declarative_name: java.apache_elasticjob.experimental_span_attributes/development
67
description: >
78
Enables experimental span attributes `job.system`, `scheduling.apache-elasticjob.job.name`,
89
`scheduling.apache-elasticjob.task.id`, `scheduling.apache-elasticjob.sharding.item.index`,
910
`scheduling.apache-elasticjob.sharding.total.count`,
1011
`scheduling.apache-elasticjob.sharding.item.parameter`, and
1112
`scheduling.apache-elasticjob.job.type`.
1213
type: boolean
13-
default: false
14+
default: false

instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/v4_1/ApacheHttpAsyncClientInstrumentation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public static class ClientAdvice {
6868
@ToArgument(value = 3, index = 1)
6969
})
7070
@Advice.OnMethodEnter(suppress = Throwable.class, inline = false)
71-
public static Object[] methodEnter(
71+
public static Object[] onEnter(
7272
@Advice.Argument(0) HttpAsyncRequestProducer requestProducer,
7373
@Advice.Argument(2) HttpContext httpContext,
7474
@Advice.Argument(3) FutureCallback<?> futureCallback) {

instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/v4_1/ApacheHttpAsyncClientSingletons.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenters;
1010
import org.apache.http.HttpResponse;
1111

12-
public class ApacheHttpAsyncClientSingletons {
12+
class ApacheHttpAsyncClientSingletons {
1313
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.apache-httpasyncclient-4.1";
1414

1515
private static final Instrumenter<ApacheHttpClientRequest, HttpResponse> instrumenter;
@@ -22,7 +22,7 @@ public class ApacheHttpAsyncClientSingletons {
2222
new HttpHeaderSetter());
2323
}
2424

25-
public static Instrumenter<ApacheHttpClientRequest, HttpResponse> instrumenter() {
25+
static Instrumenter<ApacheHttpClientRequest, HttpResponse> instrumenter() {
2626
return instrumenter;
2727
}
2828

instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/v4_1/ApacheHttpClientRequest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import org.apache.http.HttpRequest;
2222
import org.apache.http.ProtocolVersion;
2323

24-
public class ApacheHttpClientRequest {
24+
class ApacheHttpClientRequest {
2525

2626
private static final Logger logger = Logger.getLogger(ApacheHttpClientRequest.class.getName());
2727

@@ -30,7 +30,7 @@ public class ApacheHttpClientRequest {
3030
private final HttpRequest delegate;
3131
@Nullable private final HttpHost target;
3232

33-
public ApacheHttpClientRequest(@Nullable HttpHost httpHost, HttpRequest httpRequest) {
33+
ApacheHttpClientRequest(@Nullable HttpHost httpHost, HttpRequest httpRequest) {
3434
URI calculatedUri = getUri(httpRequest);
3535
if (calculatedUri != null && httpHost != null) {
3636
uri = getCalculatedUri(httpHost, calculatedUri);
@@ -41,7 +41,7 @@ public ApacheHttpClientRequest(@Nullable HttpHost httpHost, HttpRequest httpRequ
4141
target = httpHost;
4242
}
4343

44-
public List<String> getHeader(String name) {
44+
List<String> getHeader(String name) {
4545
return headersToList(delegate.getHeaders(name));
4646
}
4747

@@ -57,16 +57,16 @@ static List<String> headersToList(Header[] headers) {
5757
return headersList;
5858
}
5959

60-
public void setHeader(String name, String value) {
60+
void setHeader(String name, String value) {
6161
delegate.setHeader(name, value);
6262
}
6363

64-
public String getMethod() {
64+
String getMethod() {
6565
return delegate.getRequestLine().getMethod();
6666
}
6767

6868
@Nullable
69-
public String getUrl() {
69+
String getUrl() {
7070
return uri != null ? uri.toString() : null;
7171
}
7272

@@ -80,7 +80,7 @@ String getProtocolVersion() {
8080
}
8181

8282
@Nullable
83-
public String getServerAddress() {
83+
String getServerAddress() {
8484
if (uri != null) {
8585
return uri.getHost();
8686
}
@@ -91,7 +91,7 @@ public String getServerAddress() {
9191
}
9292

9393
@Nullable
94-
public Integer getServerPort() {
94+
Integer getServerPort() {
9595
if (uri != null) {
9696
return uri.getPort();
9797
}
@@ -102,7 +102,7 @@ public Integer getServerPort() {
102102
}
103103

104104
@Nullable
105-
public String getScheme() {
105+
String getScheme() {
106106
if (uri != null) {
107107
return uri.getScheme();
108108
}
@@ -149,7 +149,7 @@ private static URI getCalculatedUri(HttpHost httpHost, URI uri) {
149149
}
150150

151151
@Nullable
152-
public InetSocketAddress getNetworkPeerAddress() {
152+
InetSocketAddress getNetworkPeerAddress() {
153153
if (target == null) {
154154
return null;
155155
}

instrumentation/apache-httpasyncclient-4.1/metadata.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@ semantic_conventions:
66
- HTTP_CLIENT_METRICS
77
configurations:
88
- name: otel.instrumentation.http.known-methods
9+
declarative_name: java.common.http.known_methods
910
description: >
1011
Configures the instrumentation to recognize an alternative set of HTTP request methods. All
1112
other methods will be treated as `_OTHER`.
1213
type: list
1314
default: "CONNECT,DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT,TRACE"
1415
- name: otel.instrumentation.http.client.capture-request-headers
16+
declarative_name: general.http.client.request_captured_headers
1517
description: List of HTTP request headers to capture in HTTP client telemetry.
1618
type: list
1719
default: ""
1820
- name: otel.instrumentation.http.client.capture-response-headers
21+
declarative_name: general.http.client.response_captured_headers
1922
description: List of HTTP response headers to capture in HTTP client telemetry.
2023
type: list
2124
default: ""
@@ -24,13 +27,15 @@ configurations:
2427
type: map
2528
default: ""
2629
- name: otel.instrumentation.http.client.emit-experimental-telemetry
30+
declarative_name: java.common.http.client.emit_experimental_telemetry/development
2731
description: >
2832
Enable the capture of experimental HTTP client telemetry. Adds the `http.request.body.size`
2933
and `http.response.body.size` attributes to spans, and records `http.client.request.size` and
3034
`http.client.response.size` metrics.
3135
type: boolean
3236
default: false
3337
- name: otel.instrumentation.sanitization.url.experimental.sensitive-query-parameters
38+
declarative_name: general.sanitization.url.sensitive_query_parameters/development
3439
description: List of URL query parameter names whose values are redacted in URL attributes. See https://opentelemetry.io/docs/specs/semconv/http/http-spans.
3540
type: list
3641
default: "AWSAccessKeyId,Signature,sig,X-Goog-Signature"

0 commit comments

Comments
 (0)