-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Introduce Oldtimer (with InfluxDB sink support) #1172
Introduce Oldtimer (with InfluxDB sink support) #1172
Conversation
Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test". This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry. Otherwise, if this message is too spammy, please complain to ixdy. |
6 similar comments
Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test". This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry. Otherwise, if this message is too spammy, please complain to ixdy. |
Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test". This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry. Otherwise, if this message is too spammy, please complain to ixdy. |
Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test". This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry. Otherwise, if this message is too spammy, please complain to ixdy. |
Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test". This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry. Otherwise, if this message is too spammy, please complain to ixdy. |
Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test". This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry. Otherwise, if this message is too spammy, please complain to ixdy. |
Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test". This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry. Otherwise, if this message is too spammy, please complain to ixdy. |
f04f936
to
26b7dc5
Compare
As far as sinks go, this PR includes InfluxDB, and Hawkular will probably be next (IIRC, @burmanm was interested in helping out there). After that, I'm assuming GCM is the next priority. Depending on time constrains, I can then work on OpenTSDB (or Reimann or Elasticsearch, but I haven't investigated those quite yet). |
26b7dc5
to
35772d3
Compare
Ok, I've removed the |
|
||
// GetAggregation fetches the given aggregations for one or more objects (specified by metricKeys) of | ||
// the same type, within the given time interval, calculated over a series of buckets | ||
GetAggregation(metricName string, aggregations []string, metricKeys []HistoricalKey, start, end time.Time, bucketSize time.Duration) (map[HistoricalKey][]TimestampedAggregationValue, error) |
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'm not fond of the idea of passing []string type here. Couldn't we make it a type that automatically restricts the available values and makes it easier to read?
Now each sink writer has to know that these strings are actually vars from historical_types.go
Considering that every sink writer has to modify them to their internal naming / functions in any case.
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 a type alias around string? Sure. I often think that Go could use a proper enum type, though...
35772d3
to
1ec15f3
Compare
Please do not merge this until we will cut release 1.1 branch. |
|
||
// GetAggregation fetches the given aggregations for one or more objects (specified by metricKeys) of | ||
// the same type, within the given time interval, calculated over a series of buckets | ||
GetAggregation(metricName string, aggregations []AggregationType, metricKeys []HistoricalKey, start, end time.Time, bucketSize time.Duration) (map[HistoricalKey][]TimestampedAggregationValue, error) |
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.
This question applies to all of these methods. Are there parameters which can be assumed to be passed on with invalid value? Such as end time 0 or start time 0 (or both), bucketSize 0? I see there's checks for these in the example influx implementation, but nothing in these interface definitions.
And if there are, how should they be handled? I can make a lot of assumptions (and derive something from the influx example), but it would be nice to have these documented to make it easier to implement proper HistoricalSource.
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'll add in documentation to the interface, good catch.
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.
(but yes, they can have zero/empty values, which indicate no bounds for time, and to use only a single bucket for bucket size).
1ec15f3
to
25a6cf7
Compare
What's the status on this? @DirectXMan12 is there more code to do from your end? @mwielgus does your team have any other comments? I see that the release-1.1 branch exists, so how close do you think we are to merging this? |
0d1857a
to
28b15ae
Compare
To(metrics.InstrumentRouteFunc("podMetrics", a.podAggregations)). | ||
Doc("Export some pod-level metric aggregations"). | ||
Operation("podAggregations"). | ||
Param(ws.PathParameter("pod-id", "The id of the pod to lookup").DataType("string")). |
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.
What exactly is pod id. Please document.
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.
ack, will do. It's the UID of the pod (as recorded in the pod metadata in Kubernetes). I'll just change the text there to say UID.
typeSel := fmt.Sprintf("type = '%s'", key.ObjectType) | ||
switch key.ObjectType { | ||
case core.MetricSetTypeNode: | ||
return fmt.Sprintf("%s AND %s = '%s'", typeSel, core.LabelNodename.Key, key.NodeName) |
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.
same here, can we escape the parameters?
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.
For Influx, key values are checked in checkSanitizedKey
above, and an error is thrown if anything besides /^[a-zA-Z0-9_.-]+$/
is found.
Each of the sinks is individually responsible (instead of sanitization being at the API layer) since some sink driver will support bound parameters, which are more flexible.
28b15ae
to
6a7dce2
Compare
6a7dce2
to
5834108
Compare
5834108
to
e84ab8f
Compare
Ok, I've added tests for the model handlers. |
Tests fail |
Oddly, it passes locally (go version go1.6.1 linux/amd64). Looks like timezones in the timestamps in the test are changing across serialization and deserialization. |
Can you fix it anyhow? I cannot merge a pr that breaks unit test. |
@mwielgus yep, just need to figure out what's going on ;-) |
e84ab8f
to
d642641
Compare
f355bb9
to
b36ca14
Compare
Oldtimer is the Heapster historical metrics access mechanism. This commit introduces the the API for Oldtimer, which mirrors the Heapster model API, with additional paths for retrieving metrics aggregated over time. In order for the historical API to function, one specified sink must support the historical access interface defined in this commit.
This commit adds support for historical access (Oldtimer) to the InfluxDB sink.
Ok, I've pushed one final change, which makes the start time parameter mandatory (and mandatorily non-zero), since different sinks treat a zero time differently, and some sinks have issues with excessively large duration (making an explicit start time mandatory makes sense here). Thanks to @burmanm for pointing out the issue. Thanks to @ncdc for tracking down the issue with the times. It had to do with Go having a special "Local" timezone internally that was different than the actually local timezone (but "equivalent"), so |
@mwielgus should be good to go! |
LGTM |
This PR introduces Oldtimer, proposed in docs/proposals/old-timer.md.
Oldtimer is accessible from the
/api/v1/historical
, and mirrors the model API. It can be enabled by passing--historical_source
with one of the URIs used in the--sink
argument.Currently this PR supports the InfluxDB sink. Support for the rest of the metrics sinks should be coming along shortly in separate PRs (although if someone more familiar with one of the individual sinks is interested in writing the Oldtimer support for that sink, that would be appreciated).
cc @burmanm @piosz @mwielgus @bryk