File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed
instrumentation/kamon-redis/src/main
scala/kamon/instrumentation/jedis Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 11kanela.modules {
22 redis {
33 name = "Redis Instrumentation"
4- # Does it provide metrics? No.
5- description = "Provides tracing and metrics for the Jedis library"
4+ description = "Provides tracing for the Jedis library"
65
76 instrumentations = [
87 "kamon.instrumentation.jedis.JedisInstrumentation",
98 ]
109
1110 within = [
12- "redis.clients.jedis..* ",
11+ "redis.clients.jedis.Protocol ",
1312 ]
1413 }
1514}
Original file line number Diff line number Diff line change @@ -8,19 +8,20 @@ import redis.clients.jedis.commands.ProtocolCommand
88
99class JedisInstrumentation extends InstrumentationBuilder {
1010 onType(" redis.clients.jedis.Protocol" )
11- .advise(method(" sendCommand" ).and(withArgument( 1 , classOf [ ProtocolCommand ])) , classOf [SendCommandAdvice ])
11+ .advise(method(" sendCommand" ), classOf [SendCommandAdvice ])
1212}
1313
1414class SendCommandAdvice
15-
1615object SendCommandAdvice {
1716 @ Advice .OnMethodEnter ()
18- def enter (@ Advice .Argument (1 ) command : ProtocolCommand ) = {
19- val spanName = s " redis.command. ${command}"
20- val span = Kamon .clientSpanBuilder(spanName, " redis.client.jedis" )
21- .start()
22-
23- span
17+ def enter (@ Advice .Argument (1 ) command : Any ) = {
18+ command match {
19+ case command : ProtocolCommand =>
20+ val spanName = s " redis.command. ${command}"
21+ Kamon .clientSpanBuilder(spanName, " redis.client.jedis" )
22+ .start()
23+ case _ => Span .Empty
24+ }
2425 }
2526
2627 @ Advice .OnMethodExit (onThrowable = classOf [Throwable ])
You can’t perform that action at this time.
0 commit comments