Skip to content

Metrics are no longer flushed automatically #2979

@tomkerkhove

Description

@tomkerkhove

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions