Skip to content

Commit

Permalink
Add BatchSpanProcessor
Browse files Browse the repository at this point in the history
  • Loading branch information
jairo-mendoza committed Oct 10, 2024
1 parent 2dc6cc0 commit 4e01bbc
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor
import io.opentelemetry.sdk.logs.export.SimpleLogRecordProcessor
import io.opentelemetry.sdk.metrics.export.PeriodicMetricReader
import io.opentelemetry.sdk.resources.Resource
import io.opentelemetry.sdk.trace.export.BatchSpanProcessor
import kotlin.time.toJavaDuration

/** Creates an Attributes object from a String->String Map. */
Expand All @@ -40,7 +41,6 @@ private fun createAttributes(dict: Map<String, String>): Attributes {
//
// * DeterministicSampler.
// * BaggageSpanProcessor.
// * BatchSpanProcessor.
// * LoggingSpanExporter.
// * LoggingMetricExporter.
// * Debug logging.
Expand Down Expand Up @@ -107,11 +107,17 @@ class Honeycomb {
AttributesExtractor.constant(
AttributeKey.stringKey("name"), "UncaughtException"))

val batchSpanProcessor = BatchSpanProcessor.builder(traceExporter).build();

val otelRumBuilder = OpenTelemetryRum.builder(app, rumConfig)
.setResource(resource)
.addSpanExporterCustomizer {
traceExporter
}
.addTracerProviderCustomizer { builder, _ ->
builder.setResource(resource)
builder.addSpanProcessor(batchSpanProcessor)
}
.addMeterProviderCustomizer { builder, _ ->
builder.setResource(resource)
builder.registerMetricReader(
Expand Down

0 comments on commit 4e01bbc

Please sign in to comment.