Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Metrics are no longer flushed automatically #2979

Closed
tomkerkhove opened this issue Mar 7, 2022 · 4 comments · Fixed by #2982
Closed

Metrics are no longer flushed automatically #2979

tomkerkhove opened this issue Mar 7, 2022 · 4 comments · Fixed by #2982
Labels
bug Something isn't working

Comments

@tomkerkhove
Copy link
Contributor

tomkerkhove commented Mar 7, 2022

Bug Report

List of all OpenTelemetry NuGet packages and version that you are using (e.g. OpenTelemetry 1.0.2):

  • OpenTelemetry.Exporter.Console: 1.2.0-rc3
  • OpenTelemetry.Exporter.InMemory: 1.2.0-rc3
  • OpenTelemetry.Exporter.OpenTelemetryProtocol: 1.2.0-rc3
  • OpenTelemetry.Extensions.Hosting: 1.0.0-rc10

Runtime version (e.g. net461, net48, netcoreapp3.1, net5.0 etc. You can
find this information from the *.csproj file):

  • net6.0

Symptom

A clear and concise description of what the bug is.

What is the expected behavior?

Metrics being flushed automatically every 1 minute

What is the actual behavior?

Metrics were not being flushed and diagnostic logs don't provide any entries other than null.

However, as mitigation, I need to call ForceFlush to emit the metrics.

Reproduce

When constructing a meter provider as following, it used to automatically flush metrics:

var configuredMetricProvider = Sdk.CreateMeterProviderBuilder()
                .AddMeter("Example.*")
                .AddConsoleExporter()
                .AddOtlpExporter(options =>
                {
                    options.Endpoint = new Uri(collectorUri);
                })
                // We can only register global histogram buckets, not per histogram (for now)
                // See https://github.com/open-telemetry/opentelemetry-dotnet/issues/2755
                .AddView("*", new ExplicitBucketHistogramConfiguration { Boundaries = histogramBuckets })
                .Build();

Additional Context

Add any other context about the problem here.

@tomkerkhove tomkerkhove added the bug Something isn't working label Mar 7, 2022
@cijothomas
Copy link
Member

.AddOtlpExporter((exporterConfig, readerConfig) => readerConfig.MetricReaderType = MetricReaderType.Periodic) to do periodic export.

There is an upcoming spec PR (open-telemetry/opentelemetry-specification#2379), which will make OTLP do periodic export by default.

@tomkerkhove
Copy link
Contributor Author

Hm but this used to work. Is this an undocumented breaking change then?

@cijothomas
Copy link
Member

Hm but this used to work. Is this an undocumented breaking change then?

Yes agree.
Its "documented" in changelog https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md#120-rc3 , but not very obvious, and I think unintentional as well. @alanwest may be we could do a changelog update for now, warning about the breaking change to mitigate temporarily. (once the spec PR lands, we can do a quick follow-up by releasing rc4).

@tomkerkhove
Copy link
Contributor Author

Thanks, I'll just wait for the new RC to show up then.

@alanwest may be we could do a changelog update for now, warning about the breaking change to mitigate temporarily. (once the spec PR lands, we can do a quick follow-up by releasing rc4).

This would be super helpful indeed, thank you!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants