Skip to content

Fixing cluster metrics attributes slice corruption#3699

Merged
ndyakov merged 6 commits into
redis:masterfrom
bonfirestudios:master
Mar 23, 2026
Merged

Fixing cluster metrics attributes slice corruption#3699
ndyakov merged 6 commits into
redis:masterfrom
bonfirestudios:master

Conversation

@Jesse-Bonfire

@Jesse-Bonfire Jesse-Bonfire commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

This issue is a bit complicated but during initialization of redisotel we are finding that our custom attributes are being removed from some of the metricsHooks after getting registered.

During initialization of the redisotel on a Redis Cluster the "pool.name" was being appended to the attrs slice for each node in the cluster. This slice is then copied to the metricsHook but as the slice grows the data order rearranges so when processHook is finally called the slice is looking at 4 "pool.name" attrs and our custom attr is removed.

I also added support to be able to manually set the poolName during redisotel initialization which skips the getting of first address in the options for each client type.


Note

Medium Risk
Moderate risk because it changes how metrics attributes (including pool.name) are derived and appended for all Redis client types, which can affect metric cardinality/labels but not Redis command execution.

Overview
Ensures pool.name is added to the metrics attribute set once during InstrumentMetrics (instead of per-node registration), preventing attribute slice growth/corruption that could drop user-provided attributes on Redis Cluster/Ring.

Adds WithPoolName(...) to allow callers to explicitly set the pool name and skip auto-detection from client addresses.

Written by Cursor Bugbot for commit eae6053. This will update automatically on new commits. Configure here.

@jit-ci

jit-ci Bot commented Jan 29, 2026

Copy link
Copy Markdown

Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset.

In case there are security findings, they will be communicated to you as a comment inside the PR.

Hope you’ll enjoy using Jit.

Questions? Comments? Want to learn more? Get in touch with us.

@Jesse-Bonfire Jesse-Bonfire marked this pull request as draft January 29, 2026 19:46
@Jesse-Bonfire Jesse-Bonfire marked this pull request as ready for review January 29, 2026 19:46
@ndyakov

ndyakov commented Jan 30, 2026

Copy link
Copy Markdown
Member

Hello @Jesse-Bonfire, thank you for opening this PR, will review it soon, we are preparing a new version, if possible - will include it.

@Jesse-Bonfire

Copy link
Copy Markdown
Contributor Author

Not sure why that test has failed. It appears to be unrelated. Does that test sometimes have issues?

@ndyakov

ndyakov commented Feb 5, 2026

Copy link
Copy Markdown
Member

@Jesse-Bonfire there are some flaky tests, we are resolving them in our PRs when we observe them, will just restart the build for you.

@Jesse-Bonfire

Copy link
Copy Markdown
Contributor Author

Let me know if there is anything else I need to do to get this merged in :)

@ndyakov

ndyakov commented Feb 17, 2026

Copy link
Copy Markdown
Member

Looks good, thank you @Jesse-Bonfire

@ofekshenawa feel free to review and merge.

@ndyakov ndyakov self-requested a review February 17, 2026 10:46
@jit-ci

jit-ci Bot commented Feb 27, 2026

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment thread extra/redisotel/config.go
@ndyakov ndyakov merged commit e79b6eb into redis:master Mar 23, 2026
56 of 57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants