Skip to content

Commit

Permalink
Validate javaagent suppression keys
Browse files Browse the repository at this point in the history
  • Loading branch information
trask committed Dec 23, 2024
1 parent f30601d commit 92be235
Show file tree
Hide file tree
Showing 25 changed files with 93 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash -e

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

module_name=$(echo $file | sed 's#.*/\([^/]*\)/javaagent/src/.*#\1#')
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-suppression-keys:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

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

build:
runs-on: ubuntu-latest
steps:
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");
}

@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

0 comments on commit 92be235

Please sign in to comment.