Skip to content

Commit 2471f02

Browse files
committed
Fix compilation errors: wrap HttpConstants.KNOWN_METHODS in HashSet constructor
The DeclarativeConfigUtil.getList().map(HashSet::new).orElse() pattern produces Optional<HashSet<String>>, but HttpConstants.KNOWN_METHODS is a Set<String>. Wrapping it in 'new HashSet<>()' fixes the type mismatch. Fixes compilation errors in: - AgentServletInstrumenterBuilder - Servlet2SpanNameExtractor - HttpUrlConnectionSingletons - ElasticsearchRestJavaagentInstrumenterFactory - HttpSpanDecorator (camel-2.20) - AwsLambdaEventsInstrumenterFactory
1 parent 48e400f commit 2471f02

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

instrumentation/aws-lambda/aws-lambda-events-common-2.2/library/src/main/java/io/opentelemetry/instrumentation/awslambdaevents/common/v2_2/internal/AwsLambdaEventsInstrumenterFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static AwsLambdaFunctionInstrumenter createInstrumenter(
3838
private static Set<String> getKnownHttpMethods(OpenTelemetry openTelemetry) {
3939
return DeclarativeConfigUtil.getList(openTelemetry, "general", "http", "known_methods")
4040
.map(HashSet::new)
41-
.orElse(HttpConstants.KNOWN_METHODS);
41+
.orElse(new HashSet<>(HttpConstants.KNOWN_METHODS));
4242
}
4343

4444
private static String spanName(AwsLambdaRequest input) {

instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/HttpSpanDecorator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private static Set<String> getKnownHttpMethods() {
5858
return DeclarativeConfigUtil.getList(
5959
GlobalOpenTelemetry.get(), "general", "http", "known_methods")
6060
.map(HashSet::new)
61-
.orElse(HttpConstants.KNOWN_METHODS);
61+
.orElse(new HashSet<>(HttpConstants.KNOWN_METHODS));
6262
}
6363

6464
protected static String getHttpMethod(Exchange exchange, Endpoint endpoint) {

instrumentation/elasticsearch/elasticsearch-rest-common-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/ElasticsearchRestJavaagentInstrumenterFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ private static Set<String> getKnownHttpMethods() {
4141
return DeclarativeConfigUtil.getList(
4242
GlobalOpenTelemetry.get(), "general", "http", "known_methods")
4343
.map(HashSet::new)
44-
.orElse(HttpConstants.KNOWN_METHODS);
44+
.orElse(new HashSet<>(HttpConstants.KNOWN_METHODS));
4545
}
4646
}

instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlConnectionSingletons.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ private static Set<String> getKnownHttpMethods() {
4545
return DeclarativeConfigUtil.getList(
4646
GlobalOpenTelemetry.get(), "general", "http", "known_methods")
4747
.map(HashSet::new)
48-
.orElse(HttpConstants.KNOWN_METHODS);
48+
.orElse(new HashSet<>(HttpConstants.KNOWN_METHODS));
4949
}
5050

5151
private HttpUrlConnectionSingletons() {}

instrumentation/servlet/servlet-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v2_2/Servlet2SpanNameExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private static Set<String> getKnownHttpMethods() {
2828
return DeclarativeConfigUtil.getList(
2929
GlobalOpenTelemetry.get(), "general", "http", "known_methods")
3030
.map(HashSet::new)
31-
.orElse(HttpConstants.KNOWN_METHODS);
31+
.orElse(new HashSet<>(HttpConstants.KNOWN_METHODS));
3232
}
3333

3434
@Override

instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/AgentServletInstrumenterBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,6 @@ private static Set<String> getKnownHttpMethods() {
104104
return DeclarativeConfigUtil.getList(
105105
GlobalOpenTelemetry.get(), "general", "http", "known_methods")
106106
.map(HashSet::new)
107-
.orElse(HttpConstants.KNOWN_METHODS);
107+
.orElse(new HashSet<>(HttpConstants.KNOWN_METHODS));
108108
}
109109
}

0 commit comments

Comments
 (0)