Exemple #1
0
        public static MeterProviderBuilder AddAzureMonitorMetricExporter(this MeterProviderBuilder builder, Action <AzureMonitorExporterOptions> configure = null)
        {
            var options = new AzureMonitorExporterOptions();

            configure?.Invoke(options);

            var exporter = new AzureMonitorMetricExporter(options);

            return(builder.AddReader(new PeriodicExportingMetricReader(new AzureMonitorMetricExporter(options))));
        }
Exemple #2
0
        public static MeterProviderBuilder AddAzureMonitorMetricExporter(this MeterProviderBuilder builder, Action <AzureMonitorExporterOptions> configure = null)
        {
            var options = new AzureMonitorExporterOptions();

            configure?.Invoke(options);

            // TODO: Fallback to default location if location provided via options does not work.
            if (!options.DisableOfflineStorage && options.StorageDirectory == null)
            {
                options.StorageDirectory = StorageHelper.GetDefaultStorageDirectory();
            }

            var exporter = new AzureMonitorMetricExporter(options);

            return(builder.AddReader(new PeriodicExportingMetricReader(new AzureMonitorMetricExporter(options))
            {
                TemporalityPreference = MetricReaderTemporalityPreference.Delta
            }));
        }