Skip to content

Conversation

@chenba
Copy link
Collaborator

@chenba chenba commented Nov 5, 2025

Description

The hostname in the metrics could significantly increase the cardinality. This patch make the inclusion of the hostname optional, with a default of false.

Testing

All existing tests should pass.

Issue(s)

Closes STOR-393 / #1859

} else {
metric
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The alternative would be a macro. I think a macro reads better and it's my preference. @pjenvey do you have a preference?

Copy link
Member

Choose a reason for hiding this comment

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

I agree with all the lifetimes involved makes a quick macro justified.

Though I think there's potentially another less generic option since they're all (currently) gauge calls w/ u64s: a closure that does the entire gauge+send call: let send_gauge_with_maybe_hostname = |key, value| { ... } (with it capturing metrics/hostname from the outer scope so they don't need to be passed as args)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Made the change to a closure. Thank you for the suggestion.

@chenba chenba requested review from pjenvey and taddes November 5, 2025 21:42
@chenba chenba force-pushed the refactor/hostname-optional-metrics-STOR-393 branch from 57ccbed to 6a47c67 Compare November 6, 2025 21:27
pjenvey
pjenvey previously approved these changes Nov 6, 2025
The hostname in the metrics could significantly increase the
cardinality.  This patch make the inclusion of the hostname optional,
with a default of false.
@chenba chenba force-pushed the refactor/hostname-optional-metrics-STOR-393 branch from 6a47c67 to 7c8549c Compare November 6, 2025 21:36
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.

3 participants