Skip to content

Commit 86b4a96

Browse files
committed
move the AWS SDK context key/attribute initialization to a companion object
1 parent 64c3027 commit 86b4a96

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

instrumentation/kamon-aws-sdk/src/main/scala/kamon/instrumentation/aws/sdk/AwsSdkClientExecutionInterceptor.scala

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import software.amazon.awssdk.core.interceptor.{Context, ExecutionAttribute, Exe
2828
* included in the "software/amazon/awssdk/global/handlers/execution.interceptors" file shipped with this module.
2929
*/
3030
class AwsSdkClientExecutionInterceptor extends ExecutionInterceptor {
31-
private val ClientSpanAttribute = new ExecutionAttribute[Span]("SdkClientSpan")
31+
import AwsSdkClientExecutionInterceptor.ClientSpanAttribute
3232

3333
override def afterMarshalling(context: Context.AfterMarshalling, executionAttributes: ExecutionAttributes): Unit = {
3434
val operationName = executionAttributes.getAttribute(SdkExecutionAttribute.OPERATION_NAME)
@@ -55,4 +55,8 @@ class AwsSdkClientExecutionInterceptor extends ExecutionInterceptor {
5555
kamonSpan.fail(context.exception()).finish()
5656
}
5757
}
58+
}
59+
60+
object AwsSdkClientExecutionInterceptor {
61+
private val ClientSpanAttribute = new ExecutionAttribute[Span]("SdkClientSpan")
5862
}

instrumentation/kamon-aws-sdk/src/main/scala/kamon/instrumentation/aws/sdk/AwsSdkRequestHandler.scala

+5-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import kamon.trace.Span
2929
* included in the "software/amazon/awssdk/global/handlers/execution.interceptors" file shipped with this module.
3030
*/
3131
class AwsSdkRequestHandler extends RequestHandler2 {
32-
val SpanContextKey = new HandlerContextKey[Span](classOf[Span].getName)
32+
import AwsSdkRequestHandler.SpanContextKey
3333

3434
override def beforeRequest(request: Request[_]): Unit = {
3535
val serviceName = request.getServiceName
@@ -66,4 +66,8 @@ class AwsSdkRequestHandler extends RequestHandler2 {
6666
.finish()
6767
}
6868
}
69+
}
70+
71+
object AwsSdkRequestHandler {
72+
private val SpanContextKey = new HandlerContextKey[Span](classOf[Span].getName)
6973
}

0 commit comments

Comments
 (0)