Skip to content

Conversation

@brianolson
Copy link
Contributor

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.

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-commenter
Copy link

Codecov Report

Merging #2508 (4c7e5f8) into master (abc4058) will increase coverage by 0.02%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
util/metrics/gauge.go 68.00% <50.00%> (+4.78%) ⬆️
ledger/applications.go 56.25% <0.00%> (-10.92%) ⬇️
crypto/merkletrie/trie.go 66.42% <0.00%> (-2.19%) ⬇️
crypto/merkletrie/node.go 91.62% <0.00%> (-1.87%) ⬇️
data/transactions/logic/eval.go 90.51% <0.00%> (-1.50%) ⬇️
data/transactions/logic/assembler.go 80.83% <0.00%> (-0.93%) ⬇️
ledger/eval.go 76.38% <0.00%> (-0.30%) ⬇️
network/wsNetwork.go 60.73% <0.00%> (-0.29%) ⬇️
data/transactions/logic/doc.go 82.75% <0.00%> (ø)
data/transactions/logic/opcodes.go 100.00% <0.00%> (ø)
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update abc4058...4c7e5f8. Read the comment docs.


// 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() {
Copy link
Contributor

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:

  1. Remove the labels feature (it seems to only be used by segment.go:EnterSegment and that function is not called anywhere).
  2. Return from this function immediately when len(valueIndices) <= 1
  3. Set maxMetricRetensionDuration to something very large in config.json

Copy link
Contributor Author

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.

Copy link
Contributor

@winder winder left a 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

Copy link
Contributor

@winder winder left a 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants