-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 multiplier option to prometheus helper #10994
Conversation
Prometheus histograms can contain buckets with keys in decimal representation. They create events with dots in the field names, what can be problematic when stored in Elasticsearch as they will create sub-objects. Add a new option to allow to store these keys in different units, so precission is kept but in a different order of magnitude.
jenkins, test this again please |
Hello, any update on this? |
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 fine with the code like this. Just left some comments if they give you some ideas :)
} | ||
|
||
// Process will multiply the bucket labels if it is an histogram with numeric labels | ||
func (o opMultiplyBuckets) Process(field string, value interface{}, labels common.MapStr) (string, interface{}, common.MapStr) { |
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's the reason for not using pointers 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.
Good question, I didn't think about this, I just followed what was being done for other options.
In any case I wouldn't change it now, we can consider doing it for all options in the future.
@@ -57,6 +57,13 @@ func OpLowercaseValue() MetricOption { | |||
return opLowercaseValue{} | |||
} | |||
|
|||
// OpMultiplyBuckets multiplies bucket labels in histograms, useful to change units | |||
func OpMultiplyBuckets(multiplier float64) MetricOption { |
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'd call this NewOpMultiplyBucketsOption
unless we have some internal convention for this
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 don't have an strong opinion on this but yes, I am following the naming schemas used here.
Take into account that they are not so bad as they are used as options in prometheus metrics:
Metrics: map[string]MetricMap{
"histogram_decimal_metric": Metric("histogram.metric", OpMultiplyBuckets(1000))
}
Failing test is not related, and green in travis, merging. |
hey @jsoriano, trying to update #10585 two small questions occurred to me:
Sorry for not finding earlier. 😞 |
Prometheus histograms can contain buckets with keys in decimal
representation. They create events with dots in the field names, what
can be problematic when stored in Elasticsearch as they will create
sub-objects.
Add a new option to allow to store these keys in different units, so
precission is kept but in a different order of magnitude.