Skip to content

Commit

Permalink
Update OTel SDK to version 1.35 (#425)
Browse files Browse the repository at this point in the history
## Goal

Update OTel to the latest version. Fixed `EmbraceSpanProcessor` to ensure the `onStart` method is always run

## Testing

Manually tested on an app that has the minimum requirements, and existing tests pass
  • Loading branch information
bidetofevil committed Feb 16, 2024
1 parent 3a5a049 commit 86985ba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/io/embrace/gradle/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ object Versions {
val ndk = "21.4.7075529"

@JvmField
val openTelemetry = "1.29.0"
val openTelemetry = "1.35.0"

@JvmField
val moshi = "1.12.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,21 @@ import java.util.concurrent.atomic.AtomicLong

/**
* [SpanProcessor] that adds custom attributes to a [Span] when it starts, and exports it to the given [SpanExporter] when it finishes
*
* Note: no explicit tests exist for this as its functionality is tested via the tests for [SpansServiceImpl]
*/
@InternalApi
internal class EmbraceSpanProcessor(private val spanExporter: SpanExporter) : SpanProcessor {

// TODO: sequence-id should be persisted across cold starts to better gauge data loss
private val counter = AtomicLong(1)

override fun onStart(parentContext: Context, span: ReadWriteSpan) {
span.setSequenceId(counter.getAndIncrement())
}

override fun onEnd(span: ReadableSpan) {
// TODO: consider exporting this to a buffer that will export the collected Spans in bulk for performance reasons
spanExporter.export(mutableListOf(span.toSpanData()))
}

override fun isStartRequired() = false
override fun isStartRequired() = true

override fun isEndRequired() = true
}

0 comments on commit 86985ba

Please sign in to comment.