-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
add sys/class/net parsing from procfs and expose its metrics #851
Conversation
Ping, this needs some cleanup. |
@SuperQ Absolutely, though I'd be glad for pointing me in the right direction in this point mostly
|
|
bytes_per_second would be better I think, as that's what the output of rate() on the bytes sent will be. |
thanks for the answers guys! I'll get on it soon. |
Yes to:
|
Makes sense, let's go with bytes |
I'm interested in getting this into node_exporter. Is there anything I can do to move this along? |
Yes, currently this is waiting for prometheus/procfs#87 can we move on with this guys? |
collector/netdev_common.go
Outdated
@@ -73,5 +73,6 @@ func (c *netDevCollector) Update(ch chan<- prometheus.Metric) error { | |||
ch <- prometheus.MustNewConstMetric(desc, prometheus.CounterValue, v, dev) | |||
} | |||
} | |||
|
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.
This change seems unrelated.
collector/netclass_linux.go
Outdated
@@ -0,0 +1,169 @@ | |||
// Copyright 2015 The Prometheus Authors |
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.
Since this is a new file, let's make this 2018.
Let's add some fixtures to this, and add |
The Also, it looks like this PR needs to be rebased against master. |
@SuperQ I guess your point is to the Every metric is changed with each restart of the machine, so counter type is imo wrong here (that's why gauge is used). So I suppose using sth like |
Counters being reset to 0 on machine restart is completely fine and normal from a Prometheus perspective. The system is designed to handle this automatically. So if these only go up for the lifetime of a device, and only reset to 0, they are counters. |
Also, it looks like you need to reword your early commit with the DCO signoff. |
Signed-off-by: Jan Klat <jenik@klatys.cz>
…eparate collector, change metric naming Signed-off-by: Jan Klat <jenik@klatys.cz>
Signed-off-by: Jan Klat <jenik@klatys.cz>
Signed-off-by: Jan Klat <jenik@klatys.cz>
Signed-off-by: Jan Klat <jenik@klatys.cz>
Oh ok, I honestly got a different view from docs, especially
Signed off, but the test is failing on changed values for network interfaces... Is there a way to omit this somehow?
|
I think the test diff is due to the fact that the fixtures do not include the fixture data, and you're getting leaked info from the docker container. |
Signed-off-by: Jan Klat <jenik@klatys.cz>
It looks like the fixtures need an |
The fixtures are passed as a option( |
Tests are still failing though:
|
Signed-off-by: Jan Klat <jenik@klatys.cz>
) | ||
|
||
var ( | ||
netclassIgnoredDevices = kingpin.Flag("collector.netclass.ignored-devices", "Regexp of net devices to ignore for netclass collector.").Default("^$").String() |
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.
Do we want to include some interfaces in this default list? Maybe lo
and/or docker.*
?
Signed-off-by: Jan Klat <jenik@klatys.cz>
Can someone please let me know what is failing in buildkite? I don't have access to that org. Thanks! |
You probably need to update the |
Signed-off-by: Jan Klat <jenik@klatys.cz>
Thanks! Should I set the default interface list as well or do you want approve from other Members? |
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.
LGTM
ping @discordianfish I'd be happy to have these in node exporter, the sooner the better :) thanks a lot! |
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.
LGTM
Sorry, this slipped through. Merging now! |
Thanks guys for all the help. Appreciate it! |
# HELP node_network_carrier carrier value of /sys/class/net/<iface>. | ||
# TYPE node_network_carrier gauge | ||
node_network_carrier{interface="eth0"} 1 | ||
# HELP node_network_carrier_changes_total carrier_changes_total value of /sys/class/net/<iface>. |
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.
carrier_changes_total value of
-> carrier_changes value of
please fix it. And others in this PR
…eus#851) * add sys/class/net parsing from procfs and expose its metrics Signed-off-by: Jan Klat <jenik@klatys.cz> * change code to use int pointers per procfs change, move netclass to separate collector, change metric naming Signed-off-by: Jan Klat <jenik@klatys.cz> * bump year in licence, remove redundant newline, correct fixtures Signed-off-by: Jan Klat <jenik@klatys.cz> * fix style Signed-off-by: Jan Klat <jenik@klatys.cz> * change carrier changes to counter type Signed-off-by: Jan Klat <jenik@klatys.cz> * fix e2e output Signed-off-by: Jan Klat <jenik@klatys.cz> * add fixtures Signed-off-by: Jan Klat <jenik@klatys.cz> * update vendor, use fixtures correctly Signed-off-by: Jan Klat <jenik@klatys.cz> * change fixtures (device in /sys/class/net should be symlinked) Signed-off-by: Jan Klat <jenik@klatys.cz> * correct fixtures for 64k page, updated readme Signed-off-by: Jan Klat <jenik@klatys.cz>
related to #300
Hi @SuperQ , I just implemented the mentioned funcionality from procfs into node_exporter, but have several questions:
speed
is in bits (but per second), so not sure whether any suffix is correct hereprocfs
, mostly it's just licence headers, but since it's WIP, I'm not sure whether this is a correct way.