-
Notifications
You must be signed in to change notification settings - Fork 773
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
How do I change the export frequency of the OTLPExporter? #4026
Comments
I had the same question. Ended up manually calling |
The 10 seconds default value does not apply to Metrics. The default export interval for Metrics with OTLP Exporter is 60 seconds. If you want to update the default export interval for Metrics you could either by setting the environment variable .AddOtlpExporter((exporterOptions, metricReaderOptions) =>
{
metricReaderOptions.PeriodicExportingMetricReaderOptions.ExportIntervalMilliseconds = 30000;
}) |
thanks, it was not obvious how to discover this. |
I understand it was stated that the 10 secs default does not apply to metrics, but this is not the behavior I am seeing. I set up some Gauges and to count timeouts and such as shown below: private Meter meter; meter = new Meter("MyService", "1.0.0"); MeterProvider metricsProvider = Sdk.CreateMeterProviderBuilder() When I use this code I get the following output: Export timeoutsCount, Meter: MyService/1.0.0 Then, 10 seconds later: Export timeoutsCount, Meter: MyService/1.0.0 If you check my original question, in approach 1 I tried setting the environment variables as well in my docker compose:
Neither the code above nor the environment variable affect the export time, I still see 10 seconds for each export and have been unable to change that frequency/interval. |
@NetDevDewm Do you also have OTLP TraceExporter setup along with the OTLP MetricExporter? If yes, could you please try this again with the latest prerelease version |
Thank you! It took me a couple days to figure this out. I found it a little tough to find this for some reason. I gave you credit on this stackoverflow post: |
@MetalHexx Thanks for the feedback! We could definitely improve the documentation on how to configure OTLPExporter for Metrics and will work towards it. |
An update on this issue: In my original question i linked to the github that showed these variables should be working - https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md So, I had them in my docker compose, not working. Then, I updated recently to the 1.4.0 and noticed my exports were taking 30 seconds. I was confused and surprised to discover the env variable working now. I know there were some options changes, which also cause me a problem with the new release that I have sorted out, so maybe it was related to that. |
Question
Currently I am attempting to set the OTLPExporterOptions for a MetricsProvider that relate to export frequency. Using the following I am able to successfully set up a provider and export metrics at the default time period of 10 secs (10000 ms):
MeterProvider metricsProvider = Sdk.CreateMeterProviderBuilder()
.AddMeter(serviceName)
.AddConsoleExporter()
.AddOtlpExporter(opt =>
{
opt.ExportProcessorType = ExportProcessorType.Simple;
opt.Endpoint = new Uri(metricsURI);
opt.Protocol = OtlpExportProtocol.Grpc;
})
.Build();
My question is, how is it possible to change the 10 second interval for this export to a collector?
I have tried several approaches:
Setting the environment variables listed here https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md does not affect the export time.
Setting the timeout in code via
opt.TimeoutMilliseconds
also does not affect the export time.Setting the timeout via
opt.BatchExportProcessorOptions.ScheduledDelayMilliseconds
. This appeared to be the wrong setting via this question Batch export vs periodic exporting with OLTP exporter #2767 and also does not affect the export time..NET version: net6.0
Packages:
OpenTelemetry Version=1.3.1
OpenTelemetry.Exporter.Console Version=1.3.1
OpenTelemetry.Exporter.OpenTelemetryProtocol Version=1.3.1
The text was updated successfully, but these errors were encountered: