-
Notifications
You must be signed in to change notification settings - Fork 881
Cannot restart metrics #4384
Copy link
Copy link
Closed as not planned
Labels
StaleIssues and pull requests which have been flagged for closing due to inactivityIssues and pull requests which have been flagged for closing due to inactivitybugSomething isn't workingSomething isn't working
Description
Bug Report
List of all OpenTelemetry NuGet
packages and version that you are
using (e.g. OpenTelemetry 1.0.2):
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.4.0" />
Runtime version (e.g. net462, net48, netcoreapp3.1, net6.0 etc. You can
find this information from the *.csproj file):
net6.0
Symptom
Once a meter has been disposed, a new meter with the same name doesn't work anymore.
What is the expected behavior?
The new meter with the same name should produce metrics as expected
What is the actual behavior?
Once the first meter has been disposed, no new metrics will be reported for the same meter.
Reproduce
var MyMeterInner = new Meter("MyCompany.MyProduct.MyLibrary.Inner", "1.0");
using var meterProvider = Sdk.CreateMeterProviderBuilder()
.AddMeter("MyCompany.MyProduct.*")
.AddConsoleExporter((a, b) => b.PeriodicExportingMetricReaderOptions.ExportIntervalMilliseconds = 1000)
.Build();
MyMeterInner.CreateObservableGauge("testb", () => new Measurement<int>(new System.Random().Next(), new[] { new KeyValuePair<string, object?>("A", "a") }));
await Task.Delay(5000);
MyMeterInner.Dispose();
Console.WriteLine("Disposed");
// We will see Metrics until here
MyMeterInner = new("MyCompany.MyProduct.MyLibrary.Inner", "1.0");
MyMeterInner.CreateObservableGauge("testb", () => new Measurement<int>(new System.Random().Next(), new[] { new KeyValuePair<string, object?>("A", "a") }));
// No metrics here at all
await Task.Delay(5000);Steps to repro
- Create a listener for a meter namespace and ConsoleExporter.
- Create a meter and an observableguage
- Console Exporter works as expected
- Dispose the meter
- Console Exporter stops output
- Create a new meter with the same name as the original meter
- Create a new observableguage on the new meter
- Nothing in the console!!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
StaleIssues and pull requests which have been flagged for closing due to inactivityIssues and pull requests which have been flagged for closing due to inactivitybugSomething isn't workingSomething isn't working