Repository navigation
feat(pulse): support history charts with gaps, tick-row grid and time axis - #4
Merged
Merged
Conversation
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.
Description
Pulse can now draw history charts, such as Azure Monitor CPU and memory over 24 hours or 7 days, for azt: missing points show as gaps, the grid no longer hides the line, and a time axis can go under the plot. Each commit is one of these changes.
NaN,+Infand-Infdraw as gaps in both renderers: no line, no fill, no connecting stroke. The braille spline runs per segment, so it does not curve across a gap.Lastskips trailing gaps, soLegendBoxshows the last finite value. Before,Push(math.NaN())drew a spike to the top row on arm64, a dot on the bottom row in braille mode, and on amd64View()panicked withindex out of range [-9223372036854775808].±Infwas clamped to the range edges; it is now a gap too.docs/axes-and-grid.mdalready said. The code drew one on every row since the first commit, and a test asserted it; that test now checks the documented behavior. A series drawn with─no longer blends into the grid. All screenshots are regenerated.WithXAxis(func(age int) string)andSetXAxisadd an axis row and a label row under the plot. Age 0 is the newest point. Labels sit at the left edge, the quarter columns (the same columns as the vertical grid, marked with┴) and the right edge. A label that does not fit, or would touch a neighbor, is dropped.Height()stays the plot height, andView()returns two more lines. New screenshotassets/xaxis.png.Fixed along the way: after the grid change, a
NaNtick inWithTicksindexed the grid out of range and panicked on amd64. Non-finite ticks are now skipped.Without gaps and without the new option, the output is byte-identical to
mainexcept for the grid rows. This was checked on 34 charts in both modes. The tests also pass on linux/amd64.Left for later:
WithRange(NaN, x)breaks rendering: lines mode panics and braille hangs. The root cause is thatSetRangeaccepts NaN.BrailleRendererdoes not trim data longer than the width. A customChartthat returns more points thanWidth()can draw a stray mark in column 0.Modelalways trims, so it is not affected.go.modrequires bubbletea and gopsutil only forexamples/, so every module that imports pulse gets them in its module graph. A separateexamples/go.modwould remove them.SA4023and 1ineffassign.Type of Change
Checklist
gofmt,go vet).go test -race ./...).