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

Fix tag propagation for temporal functions #1307

Merged
merged 1 commit into from
Jan 22, 2019

Conversation

andrewmains12
Copy link
Contributor

I ran into this bug locally today--temporal functions don't properly propagate series tags (thanks to @arnikola for suggesting this as the bug!).

For instance, given series:

coordinator_engine_datapoints{type="fetched"} 1386
coordinator_engine_datapoints{type="generated"} 104

a query like increase(coordinator_engine_datapoints[5s]) will return

{
  "__name__": "coordinator_engine_datapoints",
  "instance": "host.docker.internal:7203",
  "job": "coordinator",
  "role": "remote"
}
{
  "__name__": "coordinator_engine_datapoints",
  "instance": "host.docker.internal:7203",
  "job": "coordinator",
  "role": "remote"
}

dropping tags. Query the same range without increase gives all tags, as expected.

Fix is simple; we weren't copying tags into the new block's SeriesMetas; now we do.

@andrewmains12
Copy link
Contributor Author

Note: I also refactored the tests to deduplicate a bit; I thought I would need it, and figured I might as well leave it even though I didn't.

expectedSeriesMetas[0].Name = "t1=v1,"
expectedSeriesMetas[1].Name = "t1=v2,"

assert.Equal(t, expectedSeriesMetas, sink.Metas, "Process should pass along series meta, renaming by ID")
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: renaming to ID

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

assert.Len(t, sink.Values, 4, "output from both blocks")
compareCacheState(t, bNode, bounds, []bool{false, false}, "everything removed from cache")
blks, err := bNode.cache.multiGet(bounds, 2, false)
assert.Len(t, tc.Sink.Values, 4, "output from both tc.Blocks")
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: copy/paste error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops yeah thanks.

Copy link
Collaborator

@arnikola arnikola left a comment

Choose a reason for hiding this comment

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

LGTM, but make sure to squash down the description on merge since it reads really weirdly on git log

@andrewmains12 andrewmains12 force-pushed the andrewmains12/fix_temporal_tags branch from 0fda4ef to 2d44293 Compare January 18, 2019 22:37
@andrewmains12 andrewmains12 merged commit 4cc991b into master Jan 22, 2019
@andrewmains12 andrewmains12 deleted the andrewmains12/fix_temporal_tags branch January 22, 2019 16:11
robskillington pushed a commit that referenced this pull request Jan 28, 2019
Temporal functions don't properly propagate series tags (thanks to @arnikola for suggesting this as the bug!).

For instance, given series:

```
coordinator_engine_datapoints{type="fetched"} 1386
coordinator_engine_datapoints{type="generated"} 104
```

a query like increase(coordinator_engine_datapoints[5s]) will return

```
{
  "__name__": "coordinator_engine_datapoints",
  "instance": "host.docker.internal:7203",
  "job": "coordinator",
  "role": "remote"
}
{
  "__name__": "coordinator_engine_datapoints",
  "instance": "host.docker.internal:7203",
  "job": "coordinator",
  "role": "remote"
}
```

dropping tags. Querying the same range without increase gives all tags, as expected.

Fix is simple; we weren't copying tags into the new block's SeriesMetas; now we do.
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