Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

add bandwidth-related metrics (for Linux and OSX) #76

Merged
merged 1 commit into from Apr 13, 2021

Conversation

marten-seemann
Copy link
Contributor

Surprisingly, we only have access to the number of bytes sent / received on OSX, there's no counter for that on Linux: https://github.com/mikioh/tcpinfo/blob/30a79bb1804bc47fa7fe29928c9109f368792a9e/sys_linux.go#L45-L69

metrics.go Outdated Show resolved Hide resolved
metrics.go Outdated
}
bytesRcvdMetric, err := prometheus.NewConstMetric(c.bytesRcvdDesc, prometheus.CounterValue, float64(bytesRcvd))
if err != nil {
log.Errorf("creating tcp_rcvd_segments_total metric failed: %v", err)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
log.Errorf("creating tcp_rcvd_segments_total metric failed: %v", err)
log.Errorf("creating tcp_rcvd_bytes metric failed: %v", err)

metrics.go Outdated Show resolved Hide resolved
metrics.go Outdated
@@ -108,6 +134,34 @@ func (c *aggregatingCollector) Collect(metrics chan<- prometheus.Metric) {
c.mutex.Unlock()
metrics <- c.rtts
metrics <- c.connDurations
if hasSegmentCounter {
segsSentMetric, err := prometheus.NewConstMetric(c.segsSentDesc, prometheus.CounterValue, float64(segsSent))
Copy link
Member

Choose a reason for hiding this comment

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

Great to see NewConstMetric in use here.

@marten-seemann marten-seemann merged commit d897385 into master Apr 13, 2021
@marten-seemann marten-seemann deleted the bandwidth-metrics branch April 19, 2021 12:59
@aschmahmann aschmahmann mentioned this pull request May 14, 2021
71 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants