Skip to content
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

InvalidOperationException not bubbled when using multiple metric readers through deferred builder #2586

Closed
tomkerkhove opened this issue Nov 10, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@tomkerkhove
Copy link
Contributor

Bug Report

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

  • OpenTelemetry.Extensions.Hosting v1.0.0-rc8
  • OpenTelemetry.Exporter.OpenTelemetryProtocol v1.0.0-rc8

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

netcoreapp3.1

Symptom

InvalidOperationException not bubbled when using multiple metric readers through deferred builder which breaks the metric flow without any indication.

What is the expected behavior?

Throw an InvalidOperationException

What is the actual behavior?

App continues without exception, but no longer works

Reproduce

public void ConfigureServices(IServiceCollection services)
{
    services.AddControllers();

    // Since we are using .NET 3.1 & HTTP, we need to define this for our OTLP exporter:
    // See https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md#special-case-when-using-insecure-channel
    AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
    
    services.AddOpenTelemetryMetrics(metricsBuilder =>
    {
        metricsBuilder.AddAspNetCoreInstrumentation()
            .AddMeter("App.Meter.Example")
            .AddOtlpExporter();

        // This is not allowed which causes an InvalidOperationException, but it will not be bubbled from AddOtlpExporter when it uses the deferred approach
        metricsBuilder.AddConsoleExporter(options => options.MetricExportIntervalMilliseconds = 5 * 1000);
    });
}

Additional Context

Bug can be closed when #2398 is closed.

@tomkerkhove tomkerkhove added the bug Something isn't working label Nov 10, 2021
@tomkerkhove
Copy link
Contributor Author

Closing as multiple readers are now supported through #2398 and this exception was removed in #2596

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

No branches or pull requests

1 participant