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

Target metrics #1811

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Target metrics #1811

wants to merge 2 commits into from

Conversation

aaronbuchwald
Copy link
Collaborator

This PR add target specific metrics into the gossiper and renames g to t as the pointer receiver for *gossiper.Target.

Comment on lines +18 to +20
selectTxsToGossipSum prometheus.Gauge
selectedTxsToGossip prometheus.Counter
targetTxsSum prometheus.Gauge
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a specific reason to use a Gauge? I feel like only Inc/Add method are used to represent the 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.

Hmm was just copying how we had handled durations elsewhere. This will never decrease, so we could use a counter instead.

if err != nil {
return err
}

numTxsGossipped := 0
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: typo

}),
selectedTxsToGossip: prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Name: "selected_txs_to_gossip",
Copy link
Contributor

Choose a reason for hiding this comment

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

should we call this select_ to be consistent w/ the other metrics?

}),
selectTxsToGossipSum: prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Name: "select_txs_to_gossip_sum",
Copy link
Contributor

Choose a reason for hiding this comment

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

it's not obvious this + target_txs_sum are latency metrics from the naming - can we put time or something in the name to make it more clear?

return nil
}
g.log.Debug("gossiping transactions", zap.Int("txs", len(txs)), zap.Duration("t", time.Since(start)))
g.metrics.txsGossiped.Add(float64(len(txs)))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did we remove this metric?

return err
}
}
t.metrics.txsGossiped.Add(float64(numTxsGossipped))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this right? This looks like it will re-accumulate previously counted txs into the metric since we're using numTxsGossiped. Shouldn't we be using something like t.metrics.txsGossiped.Add(float64(len(gossipContainer.Txs)) here?

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