prometheus / prometheus/node_exporter

timex status bitmap fields

Open
#2,727 12 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
13.8k
Forks
2.7k
Avg merge
1d 23h
Merged PRs (30d)
8

Description

This is sort of followup to https://github.com/prometheus/node_exporter/issues/2602

node_timex_status is a bitfield from adjtimex. Unfortunately Prometheus does not have bitmap math operations, so it's hard to check for specific bits being set in the metric.

As a start, I'd like it to be easier to detect STA_UNSYNC 0x0040 being set.

I don't know if there is prior art in node_exporter about the best way to represent bitfields.
Naively it might be exploding the single metric to unique metrics, one per flag.

Host operating system: output of uname -a

Linux (REDACTED) 5.19.0-43-generic #44~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon May 22 13:39:36 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

What did you expect to see?

metrics for each flag

What did you see instead?

a single metric of a bitfield packed into an integer.

I would be happy to help implement this if a design is chosen.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the linked issue #2602 and the current node_timex_status metric collection based on adjtimex. Compare possible representations for STA_UNSYNC and the other status flags, then identify the tests covering timex metrics. Done means a decided, documented representation exposes the requested flag metrics and the tests verify their values.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, prometheus
Domain
observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.