opentelemetry-java-instrume.../instrumentation/ktor/ktor-1.0/library
Gregor Zeitlinger bfb2d2acb5
add Nullaway to instrumentation API (#14458)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
2025-09-16 11:08:40 -07:00
..
src add Nullaway to instrumentation API (#14458) 2025-09-16 11:08:40 -07:00
README.md Update links to not use search.maven.org (#14558) 2025-09-01 14:25:00 +03:00
build.gradle.kts chore(deps): update plugin org.jetbrains.kotlin.jvm to v2.2.0 (#14112) 2025-06-27 22:16:26 -07:00

README.md

Library Instrumentation for Ktor version 1.x

This package contains libraries to help instrument Ktor. Currently, only server instrumentation is supported.

Quickstart

Add these dependencies to your project

Replace OPENTELEMETRY_VERSION with the latest release.

For Maven, add to your pom.xml dependencies:

<dependencies>
  <dependency>
    <groupId>io.opentelemetry.instrumentation</groupId>
    <artifactId>opentelemetry-ktor-1.0</artifactId>
    <version>OPENTELEMETRY_VERSION</version>
  </dependency>
</dependencies>

For Gradle, add to your dependencies:

implementation("io.opentelemetry.instrumentation:opentelemetry-ktor-1.0:OPENTELEMETRY_VERSION")

Usage

Initialize instrumentation by installing the KtorServerTelemetry feature. You must set the OpenTelemetry to use with the feature.

OpenTelemetry openTelemetry = ...

embeddedServer(Netty, 8080) {
  install(KtorServerTelemetry) {
    setOpenTelemetry(openTelemetry)
  }
}