using var meter = new Meter("my-meter");
var providerBuilder = Sdk.CreateMeterProviderBuilder().AddMeter(meter.Name);
providerBuilder
.AddOtlpExporter((exporterOptions, metricReaderOptions) =>
{
metricReaderOptions.PeriodicExportingMetricReaderOptions = new PeriodicExportingMetricReaderOptions
{
ExportIntervalMilliseconds = Convert.ToInt32("10000"),
};
exporterOptions.Protocol = OtlpExportProtocol.HttpProtobuf;
metricReaderOptions.TemporalityPreference = MetricReaderTemporalityPreference.Delta;
});
using var provider = providerBuilder.Build();
Counter<int> counter = meter.CreateCounter<int>("my-counter-example", "1", "test counter");
for (int i = 0; i < 69; i++) {
counter?.Add(1);
Task.Delay(2000).Wait();
}
Created
October 26, 2024 13:23
-
-
Save srikanthccv/554e3632ded4d9d4f0b4128f67649d1e to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment