Skip to content

Reduce CPU cycles spent on setting tracing tags #3339

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RohanNagar
Copy link
Contributor

@RohanNagar RohanNagar commented Jun 27, 2025

Make sure that:

  • You have read the contribution guidelines.
  • You have created a feature request first to discuss your contribution intent. Please reference the feature request ticket number in the pull request.
  • You applied code formatting rules using the mvn formatter:format target. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.

Addresses #3308 to avoid creating a RedisURI object when setting tracing tags. As explained in the issue, the current behavior results in unnecessary CPU usage.

This change caches the necessary information that is added to span tags each time the channel is registered.

This should work as long as the RedisUri attribute attached to the channel doesn't change (is that a correct assumption?).

The alternative is to just extract the information each time from channel.attr(ConnectionBuilder.REDIS_URI).get(). Something like:

        if (channel.hasAttr(ConnectionBuilder.REDIS_URI)) {
            String redisUriStr = channel.attr(ConnectionBuilder.REDIS_URI).get();
            span.tag("server.address", redisUriStr);
            span.tag("db.namespace", extractedDbValueFromRedisUriStr);
            span.tag("user.name", extractedUsernameValueFromRedisUriStr);
        }

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.

1 participant