File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
instrumentation/ktor/ktor-2-common/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ import io.opentelemetry.api.common.AttributesBuilder
1313import io.opentelemetry.context.Context
1414import io.opentelemetry.instrumentation.api.incubator.builder.internal.DefaultHttpClientInstrumenterBuilder
1515import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor
16+ import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor
1617import io.opentelemetry.instrumentation.ktor.internal.KtorBuilderUtil
18+ import java.util.function.Function
1719
1820abstract class AbstractKtorClientTracingBuilder (
1921 private val instrumentationName : String
@@ -169,4 +171,8 @@ abstract class AbstractKtorClientTracingBuilder(
169171 fun emitExperimentalHttpClientMetrics () {
170172 clientBuilder.setEmitExperimentalHttpClientMetrics(true )
171173 }
174+
175+ fun spanNameExtractor (spanNameExtractorTransformer : Function <SpanNameExtractor <in HttpRequestData >, out SpanNameExtractor <in HttpRequestData >>) {
176+ clientBuilder.setSpanNameExtractor(spanNameExtractorTransformer)
177+ }
172178}
Original file line number Diff line number Diff line change 66package io.opentelemetry.instrumentation.ktor.server
77
88import io.ktor.http.*
9- import io.ktor.server.application.*
109import io.ktor.server.request.*
1110import io.ktor.server.response.*
1211import io.opentelemetry.api.OpenTelemetry
@@ -16,9 +15,11 @@ import io.opentelemetry.context.Context
1615import io.opentelemetry.instrumentation.api.incubator.builder.internal.DefaultHttpServerInstrumenterBuilder
1716import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor
1817import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor
18+ import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor
1919import io.opentelemetry.instrumentation.api.instrumenter.SpanStatusBuilder
2020import io.opentelemetry.instrumentation.api.instrumenter.SpanStatusExtractor
2121import io.opentelemetry.instrumentation.ktor.internal.KtorBuilderUtil
22+ import java.util.function.Function
2223
2324abstract class AbstractKtorServerTracingBuilder (private val instrumentationName : String ) {
2425 companion object {
@@ -86,6 +87,10 @@ abstract class AbstractKtorServerTracingBuilder(private val instrumentationName:
8687 }
8788 }
8889
90+ fun spanNameExtractor (spanNameExtractorTransformer : Function <SpanNameExtractor <in ApplicationRequest >, out SpanNameExtractor <in ApplicationRequest >>) {
91+ serverBuilder.setSpanNameExtractor(spanNameExtractorTransformer)
92+ }
93+
8994 @Deprecated(" Please use method `attributeExtractor`" )
9095 fun addAttributeExtractor (extractor : AttributesExtractor <in ApplicationRequest , in ApplicationResponse >) {
9196 attributeExtractor {
You can’t perform that action at this time.
0 commit comments