-
Notifications
You must be signed in to change notification settings - Fork 525
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 support for dynamic histogram metrics #5239
Conversation
💔 Tests Failed
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪Test errorsExpand to view the tests failures
|
This pull request is now in conflicts. Could you fix it @axw? 🙏
|
processor/otel/metrics.go
Outdated
for i, count := range bucketCounts { | ||
if count > 0 { | ||
counts = append(counts, int64(count)) | ||
values = append(values, explicitBounds[i]) |
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.
from the otel code:
// The number of elements in bucket_counts array must be by one greater than
// the number of elements in explicit_bounds array.
Wouldn't that lead to an index-out-of-bound exception for explicitBounds[i]
?
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.
The tests should also be updated if this is the case, as the slices representing bucket_counts
and explicit_bounds
are equal length
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.
Yikes, good catch @simitt. I guess the system test was passing due to luck, and the last entry had a zero count. Looking into it now; probably should be recording the midpoints.
Dis-regard my approval, @simitt is bringing her expert knowledge to bear :) |
New questions have been brought to light
Handle histogram bucket counts correctly, following the approach taken by Prometheus.
This pull request is now in conflicts. Could you fix it @axw? 🙏
|
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.
left one minor comment, apart from that LGTM
processor/otel/metrics.go
Outdated
// bucket is assumed to be 0 if the upper bound of that bucket is greater than 0. In that | ||
// case, the usual linear interpolation is applied within that bucket. Otherwise, the upper | ||
// bound of the lowest bucket is returned for quantiles located in the lowest bucket." | ||
values := make([]float64, 0, len(explicitBounds)) |
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.
Wouldn't values := make([]float64, 0, len(bucketCounts))
make sense now?
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.
indeed, another good catch :) fixed, thanks
* model/metricset: add "histogram" dynamic_template * ingest/pipeline: handle metric descriptions * model: add metric type and unit * processor/otel: translate histogram metrics * Update changelog * processor/otel: fix histogram translation Handle histogram bucket counts correctly, following the approach taken by Prometheus. * processor/otel: fix merge * processor/otel: use appropriate slice cap (cherry picked from commit 91645bd) # Conflicts: # changelogs/head.asciidoc # include/fields.go
* Add support for dynamic histogram metrics (#5239) * model/metricset: add "histogram" dynamic_template * ingest/pipeline: handle metric descriptions * model: add metric type and unit * processor/otel: translate histogram metrics * Update changelog * processor/otel: fix histogram translation Handle histogram bucket counts correctly, following the approach taken by Prometheus. * processor/otel: fix merge * processor/otel: use appropriate slice cap (cherry picked from commit 91645bd) # Conflicts: # changelogs/head.asciidoc # include/fields.go * fix merge Co-authored-by: Andrew Wilkins <[email protected]>
* model/metricset: add "histogram" dynamic_template * ingest/pipeline: handle metric descriptions * model: add metric type and unit * processor/otel: translate histogram metrics * Update changelog * processor/otel: fix histogram translation Handle histogram bucket counts correctly, following the approach taken by Prometheus. * processor/otel: fix merge * processor/otel: use appropriate slice cap (cherry picked from commit 91645bd) # Conflicts: # apmpackage/apm/0.2.0/data_stream/app_metrics/elasticsearch/ingest_pipeline/default.json # apmpackage/apm/0.2.0/data_stream/error_logs/elasticsearch/ingest_pipeline/default.json # apmpackage/apm/0.2.0/data_stream/internal_metrics/elasticsearch/ingest_pipeline/default.json # apmpackage/apm/0.2.0/data_stream/profile_metrics/elasticsearch/ingest_pipeline/default.json # apmpackage/apm/0.2.0/data_stream/traces/elasticsearch/ingest_pipeline/default.json # apmpackage/apm/data_stream/app_metrics/elasticsearch/ingest_pipeline/apm_metrics_dynamic_template.json # apmpackage/apm/data_stream/error_logs/elasticsearch/ingest_pipeline/apm_metrics_dynamic_template.json # apmpackage/apm/data_stream/internal_metrics/elasticsearch/ingest_pipeline/apm_metrics_dynamic_template.json # apmpackage/apm/data_stream/profile_metrics/elasticsearch/ingest_pipeline/apm_metrics_dynamic_template.json # apmpackage/apm/data_stream/traces/elasticsearch/ingest_pipeline/apm_metrics_dynamic_template.json # changelogs/head.asciidoc # include/fields.go # processor/otel/metrics.go # processor/otel/metrics_test.go
Motivation/summary
Introduce support for specifying metric type and unit.
If these are set for any metrics in a metricset, we will create a
_metric_descriptions
field which is used in a new ingest processor. The ingest processor uses these properties to setdynamic_templates
. Currently we only understand the type "histogram", and unit is ignored. Later we will add support for "summary" metrics, and for setting field metadata for metric type (gauge, counter), and for units (byte, percent, nanos, etc.)The OTLP processor is updated to consume histogram metrics accordingly. We will follow up with support for the Elastic APM metrics intake in another PR.
Checklist
- [ ] Documentation has been updatedHow to test these changes
Related issues
#3195