Add support for consuming OTLP/gRPC metrics#4722
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪Steps errors
Expand to view the steps failures
|
Add support for consuming basic OTLP/gRPC metrics, like we support in the OpenTelemetry Collector exporter. This does not cover distributions or summaries; these will be added once the Elasticsearch enhancements we are dependent on are available.
Codecov Report
@@ Coverage Diff @@
## master #4722 +/- ##
==========================================
+ Coverage 76.43% 76.70% +0.26%
==========================================
Files 165 166 +1
Lines 10083 10211 +128
==========================================
+ Hits 7707 7832 +125
- Misses 2376 2379 +3
|
| UnsupportedMetricsDropped int64 | ||
| } | ||
|
|
||
| type consumerStats struct { |
There was a problem hiding this comment.
I am confused about this, why both consumerStats and ConsumerStats are needed?
There was a problem hiding this comment.
consumerStats might change at any time, ConsumerStats is a snapshot. I'll add a comment.
| otelMetrics := in.Metrics() | ||
| var unsupported int64 | ||
| for i := 0; i < otelMetrics.Len(); i++ { | ||
| if !c.addMetric(otelMetrics.At(i), &ms) { |
There was a problem hiding this comment.
instead of having a method that both mutates and argument and returns a value, can't we say unsupported += otelMetrics.Len() - ms.Len()?
There was a problem hiding this comment.
No, because two metrics may end up in the same metricset. (ms is a collection of metricsets)
| func (c *Consumer) addMetric(metric pdata.Metric, ms *metricsets) bool { | ||
| switch metric.DataType() { | ||
| case pdata.MetricDataTypeIntGauge: | ||
| dps := metric.IntGauge().DataPoints() |
There was a problem hiding this comment.
Maybe dumb question, but can't we make all these data types conform an interface defining LabelsMap(), Timestamp() and Value()?
All these cases are the same
There was a problem hiding this comment.
Yes, but:
- That won't work when we add support for distributions and summaries
- Ideally we would also support distinguishing doubles from ints, storing the latter in a
longfield type
I'd prefer to leave it as it is for now (this is also how it looks in opentelemetry-collector-contrib), and refactor it later if it's a pain.
|
jenkins run the tests please |
* Add support for consuming OTLP/gRPC metrics Add support for consuming basic OTLP/gRPC metrics, like we support in the OpenTelemetry Collector exporter. This does not cover distributions or summaries; these will be added once the Elasticsearch enhancements we are dependent on are available. * processor/otel: add comment about [Cc]onsumerStats # Conflicts: # changelogs/head.asciidoc
* Add support for consuming OTLP/gRPC metrics Add support for consuming basic OTLP/gRPC metrics, like we support in the OpenTelemetry Collector exporter. This does not cover distributions or summaries; these will be added once the Elasticsearch enhancements we are dependent on are available. * processor/otel: add comment about [Cc]onsumerStats # Conflicts: # changelogs/head.asciidoc
* Add support for consuming OTLP/gRPC metrics Add support for consuming basic OTLP/gRPC metrics, like we support in the OpenTelemetry Collector exporter. This does not cover distributions or summaries; these will be added once the Elasticsearch enhancements we are dependent on are available. * processor/otel: add comment about [Cc]onsumerStats # Conflicts: # changelogs/head.asciidoc
* Add support for consuming OTLP/gRPC metrics Add support for consuming basic OTLP/gRPC metrics, like we support in the OpenTelemetry Collector exporter. This does not cover distributions or summaries; these will be added once the Elasticsearch enhancements we are dependent on are available. * processor/otel: add comment about [Cc]onsumerStats # Conflicts: # changelogs/head.asciidoc
…chemas-to-agents * upstream/master: (111 commits) Introduce metricset.name (elastic#4857) processor/otel: test service.version handling (elastic#4853) docs: Add PHP agent information to shared docs (elastic#4740) Script for faster development workflow (elastic#4731) Update to elastic/beats@1b31c26 (elastic#4763) backport: add 7.12 to .backportrc.json (elastic#4807) backport: enable auto-merge on backport PRs (elastic#4777) Support for Node.js profiles (elastic#4728) docs: readds .NET link (elastic#4764) [DOCS] Fixes URLs on Secure communication with APM Agents page (elastic#4746) ci: set proper parameters for the tar step (elastic#4696) docs: add 7.11.1 release notes (elastic#4727) Disable sourcemap upload endpoint when data streams enabled (elastic#4735) Add service name to dataset field (elastic#4674) Update to elastic/beats@ba423212a660 (elastic#4733) sampling: require a default policy (elastic#4729) processor/otel: add unit test for span status (elastic#4734) Add support for consuming OTLP/gRPC metrics (elastic#4722) [apmpackage] Add config options supported in ESS (elastic#4690) Use the apm-server version everywhere* (elastic#4725) ...
…te-schema-json-1 * upstream/master: (111 commits) Introduce metricset.name (elastic#4857) processor/otel: test service.version handling (elastic#4853) docs: Add PHP agent information to shared docs (elastic#4740) Script for faster development workflow (elastic#4731) Update to elastic/beats@1b31c26 (elastic#4763) backport: add 7.12 to .backportrc.json (elastic#4807) backport: enable auto-merge on backport PRs (elastic#4777) Support for Node.js profiles (elastic#4728) docs: readds .NET link (elastic#4764) [DOCS] Fixes URLs on Secure communication with APM Agents page (elastic#4746) ci: set proper parameters for the tar step (elastic#4696) docs: add 7.11.1 release notes (elastic#4727) Disable sourcemap upload endpoint when data streams enabled (elastic#4735) Add service name to dataset field (elastic#4674) Update to elastic/beats@ba423212a660 (elastic#4733) sampling: require a default policy (elastic#4729) processor/otel: add unit test for span status (elastic#4734) Add support for consuming OTLP/gRPC metrics (elastic#4722) [apmpackage] Add config options supported in ESS (elastic#4690) Use the apm-server version everywhere* (elastic#4725) ...
|
Tested with BC 2; metrics are accepted and ingested as expected. Regarding testing of distributions or summaries - how did you test that when implementing? I was instrumenting a go app, but the otel go metrics implementation only supports counters so far. |
|
@simitt it does support histograms and summaries. You need to define an aggregator in the metrics controller, and then use a ValueRecorder meter. Frankly speaking their metrics API is obtuse, so you can't be faulted for missing that :) Here's how I tested histograms: apm-server/systemtest/otlp_test.go Lines 174 to 193 in d0624d4 I believe you need to change |
|
I was missing that one could use Tested with BC3:
|
Motivation/summary
Add support for consuming basic OTLP/gRPC metrics,
like we support in the OpenTelemetry Collector exporter.
We do not yet support distributions or summaries; these
will be added once the Elasticsearch enhancements we
are dependent on are available. If these are received, the
server will ignore them and increment a monitoring counter
to indicate that an unsupported metric was received and
dropped.
Checklist
- [ ] Documentation has been updated[OTLP] Document support for OTLP/gRPC on the standard port #4678How to test these changes
apm-server.otlp.grpc.metrics.consumer.unsupported_droppedcorresponds to the number of distribution and summary metrics sentRelated issues
Closes #4503