Skip to content

General improvements #8

Merged
martialblog merged 4 commits into
NETWAYS:mainfrom
gdm-maha:main
May 6, 2026
Merged

General improvements #8
martialblog merged 4 commits into
NETWAYS:mainfrom
gdm-maha:main

Conversation

@gdm-maha
Copy link
Copy Markdown
Contributor

@gdm-maha gdm-maha commented May 5, 2026

What

Fix hover tooltip values and graph clipping in the Prometheus backend.

Why

Prometheus encodes all sample values as JSON strings (e.g. "4114608128"). The Transformer stored them as-is, so uPlot received strings instead of numbers and could not populate the hover tooltip or correctly calculate the Y-axis range, causing the top of the graph to be clipped.

The threshold timestamp lookup also used array_column() with raw JSON-decoded keys, which caused type mismatches (int vs float) and silently returned null for all threshold values — hiding warning and critical lines.

Finally, calculateSteps() had a hardcoded 60-second minimum step. This caused repeated identical data points within a single check interval due to Prometheus gap-filling. The step now uses check_interval from the PerfdataRequest as its minimum.

Changes

  • Transformer: cast sample values to float (or null) and timestamps to int
  • Transformer: replace array_column() threshold lookup with explicit int-keyed loop
  • Prometheus: pass $checkInterval through getMetrics() to calculateSteps()
  • PerfdataSource: pass $req->getCheckInterval() to getMetrics()

Before / After

Before — tooltip empty, graph top clipped:

image

After — tooltip populated, graph fully visible:

image

@gdm-maha
Copy link
Copy Markdown
Contributor Author

gdm-maha commented May 5, 2026

fyi using VictoriaMetrics as backend :)

@martialblog
Copy link
Copy Markdown
Member

Hi, thanks for the PR. I'll have a look at it.

@martialblog martialblog self-assigned this May 5, 2026
$req->getIncludeMetrics(),
$req->getExcludeMetrics()
$req->getExcludeMetrics(),
$req->getCheckInterval()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi, the changes look good. The only change I would make is the following.

The getCheckInterval method is only available since 0.4.0 so we need to update the module.info to reflect the dependency.

Modules: perfdatagraphs (>=0.4.0)

@martialblog martialblog added this to the v0.1.1 milestone May 5, 2026
@martialblog martialblog merged commit 3abb525 into NETWAYS:main May 6, 2026
2 checks passed
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.

2 participants