https://github.com/open-telemetry/opentelemetry-kotlin
https://github.com/open-telemetry/opentelemetry-kotlin
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/open-telemetry/opentelemetry-kotlin
- Owner: open-telemetry
- License: apache-2.0
- Created: 2026-01-08T02:21:04.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-01-12T13:26:34.000Z (5 months ago)
- Last Synced: 2026-01-12T18:33:29.317Z (5 months ago)
- Language: Kotlin
- Homepage: https://opentelemetry.io
- Size: 721 KB
- Stars: 11
- Watchers: 4
- Forks: 3
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
#
OpenTelemetry Kotlin
[](https://codecov.io/github/open-telemetry/opentelemetry-kotlin)
An implementation of the [OpenTelemetry specification](https://opentelemetry.io/docs/specs/otel/) as a Kotlin
Multiplatform Library.
This API operates in 2 modes:
1. Compatibility mode, where it acts as a façade for the [OpenTelemetry Java SDK](https://github.com/open-telemetry/opentelemetry-java)
2. Regular mode, where it captures telemetry via a Kotlin Multiplatform (KMP) implementation
## Supported targets
The following targets are supported:
- Android (API >=21)
- JVM (JDK >= 8)
Other targets compile but are not considered sufficiently tested to count as 'supported' at this current time.
## Supported OTel APIs
- Tracing
- Logging
## Getting Started
### Regular mode
1. Add the following dependencies to your Android/Java project:
```
dependencies {
implementation("io.opentelemetry.kotlin:core:")
implementation("io.opentelemetry.kotlin:implementation:")
}
```
2. Initialize the SDK:
```
val otelKotlin = createOpenTelemetryKotlin()
```
3. Use the Kotlin API in your app
### Compatibility mode
Compatibility mode allows you to use a Kotlin API that uses the OpenTelemetry Java SDK under the hood to export telemetry.
This can be helpful if you already use the Java implementation or don't want to use the Kotlin implementation.
1. Add the following dependencies to your Android/Java project:
```
dependencies {
implementation("io.opentelemetry.kotlin:core:")
implementation("io.opentelemetry.kotlin:compat:")
}
```
2. Wrap your existing [OTel Java](https://github.com/open-telemetry/opentelemetry-java) instance:
```
val otelJava = io.opentelemetry.sdk.OpenTelemetrySdk.builder().build()
val otelKotlin = otelJava.toOtelKotlinApi()
```
3. Use the Kotlin API instead of the Java API in your app
## Example usage
### Tracing API
```
val tracer = otelKotlin.tracerProvider.getTracer(
name = "kotlin-example-app",
version = "0.1.0"
)
tracer.createSpan("my_span")
```
### Logging API
```
val logger = otelKotlin.loggerProvider.getLogger("my_logger")
logger.log("Hello, World!")
```
### Example Apps
Example usage of the library can be found [here](examples).
## Feedback/bugs
Got feedback or found a bug? Please open a GitHub issue and we'll get back to you.
# Contributing
We are currently resource constrained and are actively seeking new contributors interested in working towards [approver](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver) / [maintainer](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer) roles.
In addition to the documentation for approver / maintainer roles and the [contributing](./CONTRIBUTING.md) guide, here are some additional notes on engaging:
- [Pull request](https://github.com/open-telemetry/opentelemetry-kotlin/pulls) reviews are equally or more helpful than code contributions. Comments and approvals are valuable with or without a formal project role. They're also a great forcing function to explore a fairly complex codebase.
- Attending the Special Interest Group (SIG) is a great way to get to know community members and learn about project priorities.
- Issues labeled [help wanted](https://github.com/open-telemetry/opentelemetry-kotlin/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) are project priorities. Code contributions (or pull request reviews when a PR is linked) for these issues are particularly important.
- Triaging / responding to new issues and discussions is a great way to engage with the project.
- We are available in the [#otel-kotlin](https://cloud-native.slack.com/archives/C08NRCD4R4G) channel in the [CNCF Slack](https://slack.cncf.io/). Please join us there for further discussions.
## Maintainers
- [Jamie Lynch](https://github.com/fractalwrench), Embrace
- [Jason Plumb](https://github.com/breedx-splk), Splunk
For more information about the maintainer role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer).
## Approvers
- [Hanson Ho](https://github.com/bidetofevil), Embrace
- [Masaki Sugimoto](https://github.com/Msksgm), Henry, Inc
- [Francisco Prieto](https://github.com/priettt), Embrace
For more information about the approver role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver).
### Thanks to all of our contributors!