Add Tdigest Aggregation Plugin#6887
Add Tdigest Aggregation Plugin#6887PhoenixRion wants to merge 18 commits intoinfluxdata:masterfrom PhoenixRion:master
Conversation
danielnelson
left a comment
There was a problem hiding this comment.
Here an initial review. Ultimately my goal is to shrink down the code as much as we can, as this goes a long way on understanding and maintaining the plugin.
| /telegraf.exe | ||
| /telegraf.gz | ||
| /vendor | ||
| .idea/ |
There was a problem hiding this comment.
Revert this file, place in your global core.excludesfile https://git-scm.com/docs/gitignore/2.22.1
| name = "github.com/satori/go.uuid" | ||
| revision = "b2ce2384e17bbe0c6d34077efa39dbab3e09123b" | ||
|
|
||
| [[constraint]] |
There was a problem hiding this comment.
We updated master to use Go modules after this PR was opened, kind of surprised this didn't trigger a conflict.
There was a problem hiding this comment.
I am not sure what I would need to change because of this
There was a problem hiding this comment.
We will need to either merge or rebase against Telegraf master branch, then these files will be deleted. To add the dependency you just need to run:
go get github.com/influxdata/tdigest@v0.0.1
This should add it to the new go.mod/go.sum files.
|
|
||
| ``` | ||
| # Keep the histogram of each metric passing through. | ||
| [[aggregators.tdigestagg]] |
There was a problem hiding this comment.
Rename to tdigest, move files to directory with same name.
There was a problem hiding this comment.
This what not initially possible because it conflicted with the tdigest library but that is not longer an issue
There was a problem hiding this comment.
You can also adjust an imports name if needed:
import (
foo github.com/influxdata/tdigest
)
var tdigest = foo.TDigest{}
| @@ -0,0 +1,172 @@ | |||
| //Copyright (c) 2019, Groupon, Inc. | |||
There was a problem hiding this comment.
Remove per file copyright notices
There was a problem hiding this comment.
I am checking with Legal as the text per file is a current guideline.
| ExcludeTags []string `toml:"exclude_tags"` | ||
| SourceTagKey string `toml:"source_tag_key"` | ||
| AtomReplacementTagKey string `toml:"atom_replacement_tag_key"` | ||
| } |
There was a problem hiding this comment.
Move the contents of this file into tdigest.go
There was a problem hiding this comment.
Why would I move this out of the bucketing package when it is only referenced within it?
There was a problem hiding this comment.
Isn't this referenced from the main plugin struct?
| emitting the aggregations and the histogram every `period` seconds. | ||
|
|
||
| ### Aggregation Concepts | ||
| * Tag key ```source``` has special meaning as the primary key of developers destination TSDB |
There was a problem hiding this comment.
The measurement aka metric name should be this.
There was a problem hiding this comment.
Source is very different from measurement
There was a problem hiding this comment.
It seems the some of the logic with source and atom is specific to your deployment. For inclusion into the main Telegraf tree I suggest we move these out of this plugin and into separate processor(s) than can check for tags and enforce rules as needed. If the current processors can't handle your case, then we can add new ones to complete the needed functionality.
I'm not exactly sure how you are using the source tag, but keep in mind that it is a somewhat special tag that Telegraf often uses to report the hostname of the system the metrics describe.
|
|
||
| ### Aggregation Concepts | ||
| * Tag key ```source``` has special meaning as the primary key of developers destination TSDB | ||
| * Tag key ```atom``` has special meaning to denote the atomic dimension of an aggregation |
There was a problem hiding this comment.
What is this used for?
There was a problem hiding this comment.
to denote the atomic dimension of an aggregation
There was a problem hiding this comment.
Is this the units (meters, bytes, etc), the aggregation type (min, max, etc) or something entirely different? Can you add some examples?
| @@ -0,0 +1,37 @@ | |||
| //Copyright (c) 2019, Groupon, Inc. | |||
There was a problem hiding this comment.
On all files, rename to use snake_case.go
| _time time.Time | ||
| } | ||
|
|
||
| type ClamAggregation struct { |
There was a problem hiding this comment.
If we are going to keep this format in, I'd like to do two things:
- Build everything as a single main type, and then do a conversion to you CLAM format at the last moment.
- Remove documentation of this format.
If you don't think this will be possible, then we should remove the format. There isn't any way we will be able to maintain the format if it unless it is very simple and self contained.
| _histogram *tdigest.TDigest | ||
| _tags map[string]string | ||
| _basicName string | ||
| _sum float64 | ||
| _time time.Time |
There was a problem hiding this comment.
This isn't very idiomatic for Go, name these without the leading underscore and export the function names in the interface.
|
Any news about this PR? IMO this will be very useful for the project, especially for on-line percentiles. |
|
@PhoenixRion Thanks for the PR but closing this in preference for #8594 with less code. If there's anything that this PR contains that is missing from #8594 feel free to comment. |
closes #6440
Required for all PRs: