Feat/data readings - #150
Draft
lawik wants to merge 2 commits into
Draft
Conversation
ReportServer was the cursor left behind when the remote reporter went in v0.6.0: one in-memory mark per instance, advanced on every read whoever the reader was and whatever they did with the result. Nothing in Mobius used it, and it is the wrong shape for shipping data anywhere. A cursor is a fact about the destination's copy, so it belongs to the consumer, one per sink, advanced only once a send is accepted, and persisted on the consumer's cadence rather than Mobius's. Mobius.get_latest_metrics/1 and get_latest_events/1 go with it. The replacement is a window query (Mobius.Data.metrics/4, EventLog.list/1 with :from/:to) driven by a cursor the caller keeps.
Mobius keeps cumulative state at uneven density: a scrape a second for
two minutes, then one a minute, then one an hour, and each scrape lives
in exactly one archive, so no archive is a complete timeline and the
merge of all four is. Anything shipping that history to a remote system
has had to know all of this, plus how to turn a cumulative counter or a
summary accumulator into a number that means something on its own.
readings/1 does that work once, as a pure function of the stored
scrapes. It thins the merged timeline to the earliest scrape per step
(nothing is averaged; gauges sub-sample, the cumulative types delta
exactly), and reduces every type to plain numbers: last_value as is,
counter and sum as the rate since the previous reading, summary as the
average/std_dev/reports of the observations since the previous reading,
histograms as quantiles of the same delta. Tags fold into the name, and
a :key function renames or drops series. The result is an ascending
list of %{timestamp:, metrics: %{name => number}}, which is what a
remote metrics API wants and what a per-step threshold can judge.
The window options are the cursor: a reporter asks for everything after
the last second it shipped and advances that mark only once the send is
accepted. Mobius does not keep the mark; see the previous commit.
Scraper.snapshots/2 returns records and histogram payloads from the same
scrapes in one call, so deltas between consecutive scrapes cannot be
split by a scrape landing between two calls.
The README's remote-reporting section still described the :remote_reporter
option removed in v0.6.0; it now describes this.
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.
No description provided.