Example: demonstrates how to use opentelemetry-kotlin to capture a span and a log #1237
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goal
This changeset demonstrates how to use opentelemetry-kotlin to capture a span and a log. This isn't meant to be merged - it's meant to start a discussion about how
opentelemetry-kotlin
could be used inopentelemetry-android
, and make it easier for folks to play around with the API for themselves if they wish.I've converted the crash instrumentation to capture a log using the Kotlin API (see
CrashReporter
). The slow rendering instrumentation captures a span (seeSpanBasedJankReporter
)Compatibility
opentelemetry-kotlin
has been designed so that it's easy to dip toes into the water to try things out. The Java API'sOpenTelemetry
symbol can be converted to the Kotlin API by callingtoOtelKotlinApi()
- under the hood this just decorates the Java implementation with a Kotlin API. It's also possible to access the underlying implementation viatoOtelJavaApi()
, and there are various hooks to convert between objects.opentelemetry-kotlin
has 2 modes: it can decorate theopentelemetry-java
SDK, or use theopentelemetry-kotlin
implementation. In the current configuration this decorates theopentelemetry-java
implementation.In future if
opentelemetry-kotlin
was the only API used inopentelemetry-android
, it would be possible to switch over to the Kotlin implementation as both use the same API.