Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate javaagent suppression keys #12955

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
54 changes: 54 additions & 0 deletions .github/scripts/check-javaagent-suppression-keys.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash -e

# shellcheck disable=SC2044
for file in $(find instrumentation -name "*Module.java"); do

if ! grep -q "extends InstrumentationModule" "$file"; then
continue
fi

if [[ "$file" != *"/javaagent/src/"* ]]; then
continue
fi

# shellcheck disable=SC2001
module_name=$(echo "$file" | sed 's#.*/\([^/]*\)/javaagent/src/.*#\1#')
# shellcheck disable=SC2001
simple_module_name=$(echo "$module_name" | sed 's/-[0-9.]*$//')

if [[ "$simple_module_name" == *jaxrs* ]]; then
# TODO these need some work still
continue
fi
if [[ "$simple_module_name" == *jaxws* ]]; then
# TODO these need some work still
continue
fi
if [[ "$simple_module_name" == jdbc ]]; then
# TODO split jdbc-datasource out into separate instrumentation?
continue
fi
if [[ "$simple_module_name" == kafka-clients ]]; then
# TODO split kafka client metrics out into separate instrumentation?
continue
fi
if [[ "$simple_module_name" == quarkus-resteasy-reactive ]]; then
# TODO module is missing a base version
continue
fi

if [ "$module_name" == "$simple_module_name" ]; then
expected="super\(\n? *\"$simple_module_name\""
else
expected="super\(\n? *\"$simple_module_name\",\n? *\"$module_name\""
fi

echo "$module_name"

matches=$(perl -0 -ne "print if /$expected/" "$file" | wc -l)
if [ "$matches" == 0 ]; then
echo "Expected to find $expected in $file"
exit 1
fi

done
7 changes: 7 additions & 0 deletions .github/workflows/build-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ jobs:
exit 1
fi

check-javaagent-suppression-keys:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- run: .github/scripts/check-javaagent-suppression-keys.sh

build:
runs-on: ubuntu-latest
steps:
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## Unreleased

### Migration notes

- Some Java agent instrumentation suppression keys have been renamed to match their module names:
- `elasticsearch-rest-6.0` --> `elasticsearch-rest-6.4`
- `internal-application-logging` --> `internal-application-logger`
- `javalin-5` -> `javalin-5.0`
- `pulsar-2.8.0` -> `pulsar-2.8`

## Version 2.11.0 (2024-12-23)

### Migration notes
Expand Down Expand Up @@ -89,6 +97,7 @@ In preparation for stabilizing HTTP library instrumentation soon:
([#12883](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/12883))
- Add close to fix CWE-404
([#12908](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/12908))
>>>>>>> upstream/main

## Version 2.10.0 (2024-11-13)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@AutoService(InstrumentationModule.class)
public class AkkaActorForkJoinInstrumentationModule extends InstrumentationModule {
public AkkaActorForkJoinInstrumentationModule() {
super("akka-actor", "akka-actor-fork-join", "akka-actor-fork-join-2.5");
super("akka-actor-fork-join", "akka-actor-fork-join-2.5", "akka-actor");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@AutoService(InstrumentationModule.class)
public class ArmeriaGrpcInstrumentationModule extends InstrumentationModule {
public ArmeriaGrpcInstrumentationModule() {
super("armeria", "armeria-1.14", "armeria-grpc-1.14");
super("armeria-grpc", "armeria-grpc-1.14", "armeria", "armeria-1.14");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class ClickHouseInstrumentationModule extends InstrumentationModule {

public ClickHouseInstrumentationModule() {
super("clickhouse", "clickhouse-client-0.5");
super("clickhouse-client", "clickhouse-client-0.5", "clickhouse");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@AutoService(InstrumentationModule.class)
public class ElasticsearchRest6InstrumentationModule extends InstrumentationModule {
public ElasticsearchRest6InstrumentationModule() {
super("elasticsearch-rest", "elasticsearch-rest-6.0", "elasticsearch");
super("elasticsearch-rest", "elasticsearch-rest-6.4", "elasticsearch");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class TwitterUtilCoreInstrumentationModule extends InstrumentationModule
implements ExperimentalInstrumentationModule {

public TwitterUtilCoreInstrumentationModule() {
super("twitter-util-core");
super("finagle-http", "finagle-http-23.11", "twitter-util-core");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
public class ApplicationLoggingInstrumentationModule extends InstrumentationModule {

public ApplicationLoggingInstrumentationModule() {
super("internal-application-logging");
super("internal-application-logger");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
public class JavalinInstrumentationModule extends InstrumentationModule {

public JavalinInstrumentationModule() {
super("javalin", "javalin-5");
super("javalin", "javalin-5.0");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class KotlinCoroutinesInstrumentationModule extends InstrumentationModule
implements ExperimentalInstrumentationModule {

public KotlinCoroutinesInstrumentationModule() {
super("kotlinx-coroutines");
super("kotlinx-coroutines", "kotlinx-coroutines-1.0");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ public class AnnotationInstrumentationModule extends InstrumentationModule {

public AnnotationInstrumentationModule() {
super(
"kotlinx-coroutines-opentelemetry-instrumentation-annotations",
"kotlinx-coroutines",
"kotlinx-coroutines-1.0",
"kotlinx-coroutines-opentelemetry-instrumentation-annotations",
"opentelemetry-instrumentation-annotations");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class KotlinCoroutinesFlowInstrumentationModule extends InstrumentationModule {

public KotlinCoroutinesFlowInstrumentationModule() {
super("kotlinx-coroutines", "kotlinx-coroutines-flow");
super("kotlinx-coroutines-flow", "kotlinx-coroutines-flow-1.3", "kotlinx-coroutines");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class KtorClientInstrumentationModule extends InstrumentationModule {

public KtorClientInstrumentationModule() {
super("ktor", "ktor-client", "ktor-2.0", "ktor-client-2.0");
super("ktor", "ktor-2.0", "ktor-client", "ktor-client-2.0");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class KtorServerInstrumentationModule extends InstrumentationModule {

public KtorServerInstrumentationModule() {
super("ktor", "ktor-server", "ktor-2.0", "ktor-server-2.0");
super("ktor", "ktor-2.0", "ktor-server", "ktor-server-2.0");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class KtorClientInstrumentationModule extends InstrumentationModule {

public KtorClientInstrumentationModule() {
super("ktor", "ktor-client", "ktor-3.0", "ktor-client-3.0");
super("ktor", "ktor-3.0", "ktor-client", "ktor-client-3.0");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class KtorServerInstrumentationModule extends InstrumentationModule {

public KtorServerInstrumentationModule() {
super("ktor", "ktor-server", "ktor-3.0", "ktor-server-3.0");
super("ktor", "ktor-3.0", "ktor-server", "ktor-server-3.0");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
public class WithSpanInstrumentationModule extends InstrumentationModule {

public WithSpanInstrumentationModule() {
super("opentelemetry-extension-annotations");
super("opentelemetry-extension-annotations", "opentelemetry-extension-annotations-1.0");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class ContextExtensionInstrumentationModule extends InstrumentationModule
implements ExperimentalInstrumentationModule {

public ContextExtensionInstrumentationModule() {
super("opentelemetry-extension-kotlin");
super("opentelemetry-extension-kotlin", "opentelemetry-extension-kotlin-1.0");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
public class AnnotationInstrumentationModule extends InstrumentationModule {

public AnnotationInstrumentationModule() {
super("opentelemetry-instrumentation-annotations", "annotations");
super(
"opentelemetry-instrumentation-annotations",
"opentelemetry-instrumentation-annotations-1.16",
"annotations");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@AutoService(InstrumentationModule.class)
public class PulsarInstrumentationModule extends InstrumentationModule {
public PulsarInstrumentationModule() {
super("pulsar", "pulsar-2.8.0");
super("pulsar", "pulsar-2.8");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class GatewayInstrumentationModule extends InstrumentationModule
implements ExperimentalInstrumentationModule {

public GatewayInstrumentationModule() {
super("spring-cloud-gateway");
super("spring-cloud-gateway", "spring-cloud-gateway-2.0");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
public class SpringSecurityConfigServletInstrumentationModule extends InstrumentationModule
implements ExperimentalInstrumentationModule {
public SpringSecurityConfigServletInstrumentationModule() {
super("spring-security-config-servlet", "spring-security-config-servlet-6.0");
super(
"spring-security-config",
"spring-security-config-6.0",
"spring-security-config-servlet",
"spring-security-config-servlet-6.0");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
public class SpringSecurityConfigWebFluxInstrumentationModule extends InstrumentationModule {

public SpringSecurityConfigWebFluxInstrumentationModule() {
super("spring-security-config-webflux", "spring-security-config-webflux-6.0");
super(
"spring-security-config",
"spring-security-config-6.0",
"spring-security-config-webflux",
"spring-security-config-webflux-6.0");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class ReactorNettyInstrumentationModule extends InstrumentationModule
implements ExperimentalInstrumentationModule {

public ReactorNettyInstrumentationModule() {
super("reactor-netty", "reactor-netty-server");
super("spring-webflux", "spring-webflux-5.0", "reactor-netty", "reactor-netty-server");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class ZioInstrumentationModule extends InstrumentationModule {

public ZioInstrumentationModule() {
super("zio");
super("zio", "zio-2.0");
}

@Override
Expand Down
Loading