-
Notifications
You must be signed in to change notification settings - Fork 524
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 consuming OTLP/gRPC metrics #4722
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪Steps errorsExpand 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused about this, why both consumerStats
and ConsumerStats
are needed?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
long
field 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 |
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_dropped
corresponds to the number of distribution and summary metrics sentRelated issues
Closes #4503