-
Notifications
You must be signed in to change notification settings - Fork 816
Add /series support to TSDB storage #1830
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
Add /series support to TSDB storage #1830
Conversation
e002ffc
to
30f59fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit, otherwise LGTM Thanks!
pkg/ingester/ingester_v2.go
Outdated
} | ||
|
||
// Create a new instance of the TSDB querier | ||
q, err := db.Querier(from.Unix()*1000, to.Unix()*1000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
prefer time.Microsecond
here instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's actually even easier: from
and to
are model.Time
(not the Go time pkg), and are already expressed in milliseconds, so we've just to cast it to int64
.
What's your take?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that sounds good
bd26db9
to
976e374
Compare
e1969c5
to
540648b
Compare
// already been added to the result | ||
ls := seriesSet.At().Labels() | ||
key := ls.String() | ||
if _, ok := added[key]; ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be consistent with upstream, can we use this: https://github.com/prometheus/prometheus/blob/0ae4899c47fbcdab1b0bebedf213b4424f50f760/web/api/v1/api.go#L546-L550
It's an exposed function and I see it fitting perfectly here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked it. The storage.NewMergeSeriesSet()
you pointed out works with the storage
pkg structs, while here we work with tsdb
structs (incompatible types). I checked the merge functions in tsdb
pkg and looks a bit overkilled for what we need here: they merge series samples, while here we just need a unique set of labels.
I would suggest to keep this code as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nit
Signed-off-by: Marco Pracucci <[email protected]>
Signed-off-by: Marco Pracucci <[email protected]>
Signed-off-by: Marco Pracucci <[email protected]>
Signed-off-by: Marco Pracucci <[email protected]>
Signed-off-by: Marco Pracucci <[email protected]>
…abelMatchers() Signed-off-by: Marco Pracucci <[email protected]>
540648b
to
726ece2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What this PR does:
Currently the
/series
API endpoint doesn't work with the TSDB storage, due to missing implementation ofMetricsForLabelMatchers()
. In this PR I'm addressing this issue.Which issue(s) this PR fixes:
No issue created.
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]