Opentelemetry-java: Collector Not collecting metrics if the collection interval is less that the metric generation interval

Created on 6 Jun 2020  路  25Comments  路  Source: open-telemetry/opentelemetry-java

Describe the bug
I am using the method setExportIntervalMillis to set the collector interval to 2500 ms ans generating metrics at the rate like 4000ms,
although initially the collector will not receive any metrics but on the 2nd attemps means on 5000ms it should pickup some metrics, but that is not happening

Steps to reproduce
Set the setExportIntervalMillis to the value less than the time you are generating the metrics.

What did you expect to see?
should collect the metrics

What did you see instead?
No metrics getting collected

What version and what artifacts are you using?

Artifacts: opentelemetry-java-sdk, io.opentelemetry.sdk.metrics.export.MetricExporter
Version: latest one
How did you reference these artifacts? (excerpt from your build.gradle, pom.xml, etc)
build.gradle

Environment
Compiler: (e.g., "AdoptOpenJDK 11.0.6")
OS: macos Mojave
Runtime (if different from JDK above): (e.g., "Oracle JRE 8u251")
OS (if different from OS compiled on): (e.g., "Windows Server 2019")

Additional context
Add any other context about the problem here.

Bug

All 25 comments

Any update on this

Hi @godev-learner . I don't think anyone has had a chance to take a look at this. Do you have a simple code example of this happening you could provide?

Thanks!

I'll try to take a look at this as soon as possible. Just out of curiosity, if you use the logging exporter, rather than the collector, do you see the same behavior?

yes I do see the same behaviour for the logging exporter as well.

yes I do see the same behaviour for the logging exporter as well.

Excellent. That will make it much simpler to reproduce. We also need to create an "In Memory" metric exporter that we can use to do unit testing for this, I think.

ok, let me know if you need anything from my side.I was trying to see if there is trigger that will flush the channel, but I am not able to find any. let me know if you find anything.

@godev-learner I tried to reproduce this with the code here: https://gist.github.com/jkwatson/de3e333fd9094581c33f1590201da8bd

Everything worked fine for me. Can you try updating to 0.5.0 and see if this code works for you?

Did you try running my code to verify it works correctly?

Hang on, before we get to the OLTP exporter... If you run my example, as is, with the TestExporter, do you see metrics showing up? If you don't, then there's something fundamental going wrong that we need to figure out. Can you provide more details about how you're building, running, etc?

yes I am able to run your example if I just use the TestExporter.

For testing your class I am just running the java program you have provided me nothing special.

Next step: If you run my example with the LoggingExporter (rather than OLTP), does that work?

ok let me check

oh no! So, we need to know more about your environment then, since this works fine when I run locally from my IDE.

oh no! So, we need to know more about your environment then, since this works fine when I run locally from my IDE.

no thats ok, my mistake I was 2 programs your test is running fine in my env, I confirmed Thats why I deleted the comment

Next step: If you run my example with the LoggingExporter (rather than OLTP), does that work?

I will check on this step.

I check with the Logging exporter and it seems to be working as you can see below

sending metric data: 0
Jun 08, 2020 7:30:10 PM io.opentelemetry.exporters.logging.LoggingMetricExporter export
INFO: Received a collection of 2 metrics for export.
Jun 08, 2020 7:30:10 PM io.opentelemetry.exporters.logging.LoggingMetricExporter export
INFO: metric: MetricData{descriptor=Descriptor{name=recorder, description=, unit=1, type=SUMMARY, constantLabels={}}, resource=Resource{attributes={}}, instrumentationLibraryInfo=InstrumentationLibraryInfo{name=testing, version=null}, points=[null]}
Jun 08, 2020 7:30:10 PM io.opentelemetry.exporters.logging.LoggingMetricExporter export
INFO: metric: MetricData{descriptor=Descriptor{name=counter, description=, unit=1, type=MONOTONIC_LONG, constantLabels={}}, resource=Resource{attributes={}}, instrumentationLibraryInfo=InstrumentationLibraryInfo{name=testing, version=null}, points=[LongPoint{startEpochNanos=1591669808743000000, epochNanos=1591669810200000000, labels={isItAnError=false, spanName=testSpan}, value=1}]}
sending metric data: 1

ok. good news, then. We've isolated the issue to either the OLTP exporter, or the collector itself. My suspicion is that it's the collector, since the OLTP exporter is pretty simple. I'll take a look tomorrow and see if I can locally add some debugging to the exporter and see what's up.

ok sure thanks.

@jkwatson did you get the chance to check on this

I'm just picking this up (sorry...it's been a busy morning). How are you running the collector?

same in my intellij

I've found a bug... the exporter is being given a null Point in one of the metrics on the first collection cycle, causing it to blow up and the backing thread to die. Thanks for this report, and providing the detailed case to help reproduce.

Note: I think the bug is actually in the metric system itself, rather than the exporter, but the exporter should also be a bit more robust to this sort of data condition.

Thanks @jkwatson for creating the tickets.

Was this page helpful?
0 / 5 - 0 ratings