Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

measure the entire Jedis roundtrip time, fixes #1082 #1117

Merged
merged 4 commits into from
Mar 7, 2022

Conversation

ivantopo
Copy link
Contributor

@ivantopo ivantopo commented Feb 23, 2022

Turns out that our current Jedis instrumentation is only measuring the time it takes to send a command to Redis, without taking into account how long will it take to get an answer back. This PR fixes that. Thanks to @jtjeferreira for bringing this up!

TODO:

  • Check if we should change the span names and tags to something that matches the otel spec
  • Try it out with Jedis 4.x
  • Ignore other possibly unwanted methods from generating spans in the Jedis class (currently only toString, hashCode, and close are ignored)


class JedisInstrumentation extends InstrumentationBuilder {
onType("redis.clients.jedis.Protocol")
.advise(method("sendCommand").and(isPublic[MethodDescription]), classOf[SendCommandAdvice])
onType("redis.clients.jedis.Jedis")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redis.clients.jedis.Jedis is only one of the implementations of redis.clients.jedis.JedisCommands. I guess we should add tests for the other classes...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that there is Jedis and ShardedJedis, but the sharded version uses a regular Jedis under the hood so it should work fine. There are other variants too, like JedisCluster and in 4.x there is a JedisPool too. I'll leave all of those for a separate PR.

Copy link
Contributor Author

@ivantopo ivantopo Feb 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow up for this: #1121

@ivantopo
Copy link
Contributor Author

I managed to test it locally and add a workaround for this to work with Jedis 4.1, at least at a very basic level. We still need to figure out support for some 4.x-only components (see #1121 for follow ups). This is ready to review.

@ivantopo ivantopo marked this pull request as ready for review February 24, 2022 11:26
@ivantopo ivantopo changed the title measure the entire Jedis roundtrip time measure the entire Jedis roundtrip time, fixes #1082 Mar 7, 2022
@ivantopo ivantopo merged commit 428bb45 into kamon-io:master Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants