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

[aggregator] Add compatibility for rollup rules with timed metrics #2251

Merged
merged 12 commits into from
Apr 10, 2020

Conversation

robskillington
Copy link
Collaborator

What this PR does / why we need it:

Adds compatibility for rollup rules to the aggregator with timed metric types.

Special notes for your reviewer:

Does this PR introduce a user-facing and/or backwards incompatible change?:

NONE

Does this PR require updating code package or user-facing documentation?:

NONE


// IncValuesOutOfOrder increments value or if not initialized is a no-op.
func (m CounterMetrics) IncValuesOutOfOrder() {
if m.valuesOutOfOrder != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we expect to initialize a CounterMetrics without the constructor or is this just to be paranoid?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Bit of both, I believe some integration tests do not initialize it and also this is for paranoia.

// NB: we only need to record the value needed for derivative transformations.
// We currently only support first-order derivative transformations so we only
// need to keep one value. In the future if we need to support higher-order
// derivative transformations, we need to store an array of values here.
e.lastConsumedValues[aggTypeIdx] = value
if !math.IsNaN(curr.Value) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Discussed offline why we bother passing evaluating the op if incoming sample is NaN but there may be transformations (such as count # samples) that still care.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍

if sm.Tombstoned {
e.RUnlock()
timeLock.RUnlock()
// e.metrics.timed.tombstonedMetadata.Inc(1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Undo comment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah good call.

if len(sm.Pipelines) == 0 {
e.RUnlock()
timeLock.RUnlock()
e.metrics.untimed.noPipelinesInMetadata.Inc(1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

s/untimed/timed/?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup, ty good call.

diff := curr.Value - prev.Value
if diff < 0 {
// // Treated as a counter reset, take the curr value as counted elements.
// return Datapoint{TimeNanos: curr.TimeNanos, Value: curr.Value}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Stale comment

@robskillington robskillington merged commit 6fab578 into master Apr 10, 2020
@robskillington robskillington deleted the r/support-timed-metric-rollup-rules branch April 10, 2020 15:07
fishie9 pushed a commit that referenced this pull request Apr 14, 2020
fix

integration test

fix integration test

fix

Add metrics for passthrough in follower instances

[aggregator] Add compatibility for rollup rules with timed metrics (#2251)

Add pass-through in m3aggregator using rawtcp server

fix
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