Set AggregationTemporality from exporter options (#2455)

Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
This commit is contained in:
Alan West 2021-10-06 11:06:05 -07:00 committed by GitHub
parent 5c7feb0931
commit 08049d68a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -41,12 +41,13 @@ namespace OpenTelemetry.Metrics
var exporter = new ConsoleMetricExporter(options);
if (options.MetricExportIntervalMilliseconds == Timeout.Infinite)
{
return builder.AddReader(new BaseExportingMetricReader(exporter));
}
var reader = options.MetricExportIntervalMilliseconds == Timeout.Infinite
? new BaseExportingMetricReader(exporter)
: new PeriodicExportingMetricReader(exporter, options.MetricExportIntervalMilliseconds);
return builder.AddReader(new PeriodicExportingMetricReader(exporter, options.MetricExportIntervalMilliseconds));
reader.PreferredAggregationTemporality = options.AggregationTemporality;
return builder.AddReader(reader);
}
}
}

View File

@ -54,6 +54,7 @@ namespace OpenTelemetry.Metrics
var metricExporter = new OtlpMetricExporter(options);
var metricReader = new PeriodicExportingMetricReader(metricExporter, options.MetricExportIntervalMilliseconds);
metricReader.PreferredAggregationTemporality = options.AggregationTemporality;
return builder.AddReader(metricReader);
}
}