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

Make metrics better follow guidelines #787

Merged
merged 9 commits into from
Jan 17, 2018
Merged

Make metrics better follow guidelines #787

merged 9 commits into from
Jan 17, 2018

Conversation

brian-brazil
Copy link
Contributor

I think that's all the main ones, I'm a little unsure on the timex ones even after looking at the docs and source

@SuperQ

Fixes #150
Supercedes #559

@brian-brazil brian-brazil force-pushed the counters branch 2 times, most recently from 3595e53 to 5fd9726 Compare January 15, 2018 16:19
Copy link
Member

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -185,6 +185,11 @@ func (c *diskstatsCollector) Update(ch chan<- prometheus.Metric) error {
if err != nil {
return fmt.Errorf("invalid value %s in diskstats: %s", value, err)
}
// Convert to seconds
switch i {
case 3, 7, 9, 10:
Copy link
Member

Choose a reason for hiding this comment

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

That's pretty prone to errors. Would be great to use a value function instead, similar to what is done already in diskstats_darwin.go.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

Copy link
Contributor

@mdlayher mdlayher left a comment

Choose a reason for hiding this comment

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

LGTM!

@brian-brazil
Copy link
Contributor Author

As just discussed there with @SuperQ I have removed the diskstat sector metrics, as that's already covered by the bytes metrics.

@SuperQ
Copy link
Member

SuperQ commented Jan 16, 2018

I like the factor thing, but should we keep 512 as a const?

@brian-brazil
Copy link
Contributor Author

I've added in meminfo and interrupts changes.

Copy link
Member

@discordianfish discordianfish left a comment

Choose a reason for hiding this comment

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

Nice! LGTM

@mdlayher
Copy link
Contributor

Worth throwing promtool check-metrics in CI to ensure this doesn't happen again?

@SuperQ SuperQ merged commit a98067a into master Jan 17, 2018
@SuperQ SuperQ deleted the counters branch January 17, 2018 16:55
@discordianfish
Copy link
Member

@mdlayher Sounds like a good idea! Does it pass already with these changes?

@mdlayher
Copy link
Contributor

Last time I tried, my PR passed every check except for the metrics exposed by the Prometheus Go client.

We could either add an exception, or just fix the go client to use seconds instead of microseconds. (IIRC)

@@ -54,7 +54,7 @@ func init() {
func NewCPUCollector() (Collector, error) {
return &cpuCollector{
cpu: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", cpuCollectorSubsystem),
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "seconds_total"),
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't cpu_usage_seconds_total be the more common naming here rather than just cpu_seconds_total?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe, but not everything is used, what about idle and steal?

Copy link
Member

Choose a reason for hiding this comment

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

Dunno "used" still sounds ok to me even for those :) But I don't care much.

Copy link
Member

Choose a reason for hiding this comment

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

oblitorum pushed a commit to shatteredsilicon/node_exporter that referenced this pull request Apr 9, 2024
* Improve stat linux metric names.

cpu is no longer used.

* node_cpu -> node_cpu_seconds_total for Linux

* Improve filesystem metric names with units

* Improve units and names of linux disk stats

Remove sector metrics, the bytes metrics cover those already.

* Infiniband counters should end in _total

* Improve timex metric names, convert to more normal units.

See
https://github.com/torvalds/linux/blob/3c073991eb417b6f785ddc6afbbdc369eb84aa6a/kernel/time/ntp.c#L909
for what stabil means, looks like a moving average of some form.

* Update test fixture

* For meminfo metrics that had "kB" units, add _bytes

* Interrupts counter should have _total
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.

None yet

6 participants