General improvements #8
Merged
Merged
Conversation
… to 1s fallback might have to change later
Contributor
Author
|
fyi using VictoriaMetrics as backend :) |
Member
|
Hi, thanks for the PR. I'll have a look at it. |
martialblog
reviewed
May 5, 2026
| $req->getIncludeMetrics(), | ||
| $req->getExcludeMetrics() | ||
| $req->getExcludeMetrics(), | ||
| $req->getCheckInterval() |
Member
There was a problem hiding this comment.
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 returnednullfor 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 usescheck_intervalfrom thePerfdataRequestas its minimum.Changes
Transformer: cast sample values tofloat(ornull) and timestamps tointTransformer: replacearray_column()threshold lookup with explicit int-keyed loopPrometheus: pass$checkIntervalthroughgetMetrics()tocalculateSteps()PerfdataSource: pass$req->getCheckInterval()togetMetrics()Before / After
Before — tooltip empty, graph top clipped:
After — tooltip populated, graph fully visible: