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

fix broken internal metrics names and make them optional #203

Merged
merged 4 commits into from
Jan 26, 2023

Conversation

brawndou
Copy link
Collaborator

This addresses #198

@brawndou brawndou marked this pull request as ready for review January 26, 2023 00:46
@@ -227,7 +231,7 @@ func (r *scopeRegistry) removeWithRLock(subscopeBucket *scopeBucket, key string)

// Records internal Metrics' cardinalities.
func (r *scopeRegistry) reportInternalMetrics() {
if r.skipInternalMetrics {
if r.internalMetricsOption != SendInternalMetrics {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we can eventually set a default option if it's unset

counterCardinalityName = "tally.internal.counter-cardinality"
gaugeCardinalityName = "tally.internal.gauge-cardinality"
histogramCardinalityName = "tally.internal.histogram-cardinality"
counterCardinalityName = "tally-internal-counter-cardinality"
Copy link
Collaborator

Choose a reason for hiding this comment

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

The fact that this can cause a panic is not great. We should handle an invalid metric names gracefully. We could add sanitazation to the code where the metric is being registered. Though it probably makes sense to have it as a separate PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

created #204 to track this request

counterCardinalityName = "tally.internal.counter-cardinality"
gaugeCardinalityName = "tally.internal.gauge-cardinality"
histogramCardinalityName = "tally.internal.histogram-cardinality"
counterCardinalityName = "tally-internal-counter-cardinality"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think either dots or dashes are accepted by prometheus reporter. At least they not legal characters according to Prom data model

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will change to underscore

gaugeCardinalityName = "tally.internal.gauge-cardinality"
histogramCardinalityName = "tally.internal.histogram-cardinality"
counterCardinalityName = "tally-internal-counter-cardinality"
gaugeCardinalityName = "tally-internal-gauge-cardinality"
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we please have a test for that?
funny enough we have a comment in Prom reporter example about dashes and dots
https://github.com/uber-go/tally/blob/master/prometheus/example/prometheus_main.go#L37

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll have the scope's sanitizer process it during runtime instead. This way we can be agnostic about whatever scope/reporter/sanitizer is underneath.

@brawndou brawndou merged commit 24b844b into uber-go:v3 Jan 26, 2023
brawndou added a commit to brawndou/tally that referenced this pull request Jan 27, 2023
* improved internal metrics config setup
* internal metric names are sanitized at runtime
brawndou added a commit that referenced this pull request Jan 27, 2023
brawndou added a commit that referenced this pull request Jan 27, 2023
brawndou added a commit to brawndou/tally that referenced this pull request Jan 31, 2023
* improved internal metrics config setup
* internal metric names are sanitized at runtime
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