Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[processor/cumulativetodelta] Deciding whether to keep the first point based on linear point speculation #35487

Open
h0cheung opened this issue Sep 30, 2024 · 7 comments
Labels
enhancement New feature or request priority:p2 Medium processor/cumulativetodelta Cumulative To Delta processor

Comments

@h0cheung
Copy link
Contributor

Component(s)

processor/cumulativetodelta

Is your feature request related to a problem? Please describe.

When there is no accurate time information for the first point, the first two points can be used to determine whether to keep the first point or not, based on the change in value to infer if the first point is growing from 0.

Describe the solution you'd like

VictoriaMetrics' implementation of the increase function may be good for us: https://github.com/VictoriaMetrics/VictoriaMetrics/blob/3d01bc3fbe3d8f4ff4909408fe45ffc1c1acdcf7/app/vmselect/promql/rollup.go#L1828

It does this by taking the first two points (denoted $v0$ and $v1$), and considering that there is a 0 before the first one if and only if $v0 < 10 * (v1 - v0 + 1)$.a 0. (As we require the input to be monotonic, the Abs could be ignored`)

We can use the same rules to decide whether to output the first point directly as a delta metric point.

Describe alternatives you've considered

No response

Additional context

No response

@h0cheung h0cheung added enhancement New feature or request needs triage New item requiring triage labels Sep 30, 2024
@github-actions github-actions bot added the processor/cumulativetodelta Cumulative To Delta processor label Sep 30, 2024
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@TylerHelmuth
Copy link
Member

@h0cheung this feels possible, but I think it would be good as an option, not a required behavior. Can you propose what the user config would look like?

@TylerHelmuth TylerHelmuth added priority:p2 Medium and removed needs triage New item requiring triage labels Sep 30, 2024
@h0cheung
Copy link
Contributor Author

h0cheung commented Oct 23, 2024

@h0cheung this feels possible, but I think it would be good as an option, not a required behavior. Can you propose what the user config would look like?

Does it feels good to add a config like this?

// KeepLinearInitialValue determines whether to keep the first datapoint when it seems to be a linear increase.
// This only works when InitialValue is set to "auto" and should be dropped according to the starttime based strategy.
// Exactly, let's define the first value as v1 and the second value as v2, then if v1 < (v2 - v1 + 1) * 10, v1 will be kept.
KeepLinearInitialValue bool `mapstructure:"keep_linear_initial_value"`

@TylerHelmuth
Copy link
Member

Sure that seems good.

@h0cheung
Copy link
Contributor Author

When agent restarts, sum metrics with value between 1~9 will be directly reported as delta value.

For error count metrics, this is terrible, which causes alerts.

@TylerHelmuth
Copy link
Member

@h0cheung are you saying that is the behavior now or if we implemented this feature?

@h0cheung
Copy link
Contributor Author

h0cheung commented Dec 4, 2024

@h0cheung are you saying that is the behavior now or if we implemented this feature?

If we implement this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority:p2 Medium processor/cumulativetodelta Cumulative To Delta processor
Projects
None yet
Development

No branches or pull requests

2 participants