Skip to content

Commit

Permalink
Separate ktor 2.0 client and server instrumentation (open-telemetry#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
laurit authored and zeitlinger committed Jun 12, 2024
1 parent e5eba98 commit 5e002c5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.javaagent.instrumentation.ktor.v2_0;

import static java.util.Collections.singletonList;

import com.google.auto.service.AutoService;
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import java.util.List;

@AutoService(InstrumentationModule.class)
public class KtorClientInstrumentationModule extends InstrumentationModule {

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

@Override
public boolean isHelperClass(String className) {
return className.startsWith("io.opentelemetry.extension.kotlin.");
}

@Override
public List<TypeInstrumentation> typeInstrumentations() {
return singletonList(new HttpClientInstrumentation());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@

package io.opentelemetry.javaagent.instrumentation.ktor.v2_0;

import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;

import com.google.auto.service.AutoService;
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import java.util.List;

@AutoService(InstrumentationModule.class)
public class KtorInstrumentationModule extends InstrumentationModule {
public class KtorServerInstrumentationModule extends InstrumentationModule {

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

@Override
Expand All @@ -26,6 +26,6 @@ public boolean isHelperClass(String className) {

@Override
public List<TypeInstrumentation> typeInstrumentations() {
return asList(new ServerInstrumentation(), new HttpClientInstrumentation());
return singletonList(new ServerInstrumentation());
}
}

0 comments on commit 5e002c5

Please sign in to comment.