File tree 2 files changed +11
-11
lines changed
instrumentation/kamon-redis/src/main
scala/kamon/instrumentation/jedis
2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 1
1
kanela.modules {
2
2
redis {
3
3
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"
6
5
7
6
instrumentations = [
8
7
"kamon.instrumentation.jedis.JedisInstrumentation",
9
8
]
10
9
11
10
within = [
12
- "redis.clients.jedis..* ",
11
+ "redis.clients.jedis.Protocol ",
13
12
]
14
13
}
15
14
}
Original file line number Diff line number Diff line change @@ -8,19 +8,20 @@ import redis.clients.jedis.commands.ProtocolCommand
8
8
9
9
class JedisInstrumentation extends InstrumentationBuilder {
10
10
onType(" redis.clients.jedis.Protocol" )
11
- .advise(method(" sendCommand" ).and(withArgument( 1 , classOf [ ProtocolCommand ])) , classOf [SendCommandAdvice ])
11
+ .advise(method(" sendCommand" ), classOf [SendCommandAdvice ])
12
12
}
13
13
14
14
class SendCommandAdvice
15
-
16
15
object SendCommandAdvice {
17
16
@ 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
+ }
24
25
}
25
26
26
27
@ Advice .OnMethodExit (onThrowable = classOf [Throwable ])
You can’t perform that action at this time.
0 commit comments