opentelemetry-java-instrume.../instrumentation/ktor/ktor-1.0/library
Aaron Ai 2d7395c44b
Introduce markdown lint check (#7175)
Fixes #7129
2022-11-16 20:48:42 -08:00
..
src Capture net.host.name for netty (#6892) 2022-10-19 09:21:50 -07:00
README.md Introduce markdown lint check (#7175) 2022-11-16 20:48:42 -08:00
build.gradle.kts Document upper version limits (#6436) 2022-08-08 10:08:40 -07:00

README.md

Library Instrumentation for Ktor versions 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 KtorServerTracing feature. You must set the OpenTelemetry to use with the feature.

OpenTelemetry openTelemetry = initializeOpenTelemetryForMe()

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