-
Notifications
You must be signed in to change notification settings - Fork 524
metrics Gauge cleanup #2508
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
metrics Gauge cleanup #2508
Conversation
Gauge that didn't change used to disappear from results; this could make a non-zero value appear zero, confusing metrics. gaugeCommon.go split was confusing, merge back into gauge.go
Codecov Report
@@ Coverage Diff @@
## master #2508 +/- ##
==========================================
+ Coverage 46.86% 46.88% +0.02%
==========================================
Files 345 347 +2
Lines 55400 55519 +119
==========================================
+ Hits 25961 26031 +70
- Misses 26503 26545 +42
- Partials 2936 2943 +7
Continue to review full report at Codecov.
|
|
|
||
| // filterExpiredMetrics scans the gauge.valuesIndices map and removing all the gauges that | ||
| // haven't been updated in the past <maxMetricRetensionDuration> units of time. | ||
| func (gauge *Gauge) filterExpiredMetrics() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this would be a problem if someone decides to use the label feature. It looks like that allows for creating dynamic guages based on user-defined keys. We don't currently use the dynamic labels feature in the networking code. In theory, someone might add a gauge by session ID (i.e. ping per connection). At that point removing this function would become be issue since it would grow unbounded.
A couple of possible solutions:
- Remove the
labelsfeature (it seems to only be used bysegment.go:EnterSegmentand that function is not called anywhere). - Return from this function immediately when
len(valueIndices) <= 1 - Set
maxMetricRetensionDurationto something very large inconfig.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MakeSegement EnterSegment LeaveSegment never occur in the code. It's completely unused and I'm tempted to delete segment.go entirely.
labels is also unused, I checked all uses of Gauge.Set() and labels is always nil.
Since there's no problem with the code as it is but only as it might be, I'd like to finish this bugfix and file a new issue for further util/metrics cleanup of dead code.
winder
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly good, I just spot one possible problem
winder
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved pending a new ticket is created. In the new ticket could you mention that StringGauge has the same problem?
Summary
Gauge no longer has a timeout.
Gauge that didn't change used to disappear from results; this could make a non-zero value appear zero, confusing metrics.
gaugeCommon.go split was confusing, merge back into gauge.go
Test Plan
Refactor continue to pass existing tests.