diff --git a/platform/jvm/capture-apollo3/src/main/kotlin/io/bitdrift/capture/apollo3/CaptureApolloInterceptor.kt b/platform/jvm/capture-apollo3/src/main/kotlin/io/bitdrift/capture/apollo3/CaptureApolloInterceptor.kt index 76e490a7..fe023f1f 100644 --- a/platform/jvm/capture-apollo3/src/main/kotlin/io/bitdrift/capture/apollo3/CaptureApolloInterceptor.kt +++ b/platform/jvm/capture-apollo3/src/main/kotlin/io/bitdrift/capture/apollo3/CaptureApolloInterceptor.kt @@ -28,9 +28,10 @@ class CaptureApolloInterceptor: ApolloInterceptor { val requestBuilder = request.newBuilder() .addHttpHeader("x-capture-span-key", "gql") .addHttpHeader("x-capture-span-gql-name", "graphql") - .addHttpHeader("x-capture-span-gql-field-operation-name", request.operation.name()) .addHttpHeader("x-capture-span-gql-field-operation-id", request.operation.id()) .addHttpHeader("x-capture-span-gql-field-operation-type", request.operation.type()) + .addHttpHeader("x-capture-span-gql-field-operation-name", request.operation.name()) + .addHttpHeader("x-capture-path-template", "gql-${request.operation.name()}") // set this to override the http _path_template field // TODO(murki): Augment request logs with // request.executionContext[CustomScalarAdapters]?.let { // addHttpHeader("x-capture-span-gql-field-operation-variables", request.operation.variables(it).valueMap.toString()) diff --git a/platform/jvm/capture/src/test/kotlin/io/bitdrift/capture/CaptureOkHttpEventListenerFactoryTest.kt b/platform/jvm/capture/src/test/kotlin/io/bitdrift/capture/CaptureOkHttpEventListenerFactoryTest.kt index 2aab2e28..d48c57c8 100644 --- a/platform/jvm/capture/src/test/kotlin/io/bitdrift/capture/CaptureOkHttpEventListenerFactoryTest.kt +++ b/platform/jvm/capture/src/test/kotlin/io/bitdrift/capture/CaptureOkHttpEventListenerFactoryTest.kt @@ -348,12 +348,14 @@ class CaptureOkHttpEventListenerFactoryTest { "x-capture-span-gql-field-operation-name" to "myOperationName", "x-capture-span-gql-field-operation-id" to "myOperationId", "x-capture-span-gql-field-operation-type" to "query", + "x-capture-path-template" to "gql-myOperationName", ) val expectedSpanName = "_mySpanName" val expectedFields = mapOf( "_operation_name" to "myOperationName", "_operation_id" to "myOperationId", "_operation_type" to "query", + "_path_template" to "gql-myOperationName", ) val request = Request.Builder()