Minor additions to Extending Metric SDK docs (#3089)

This commit is contained in:
Cijo Thomas 2022-03-24 12:01:50 -07:00 committed by GitHub
parent a4a4d7ffa8
commit 3e8074576d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

@ -15,17 +15,27 @@
// </copyright>
using System;
using System.Threading;
using OpenTelemetry.Metrics;
internal static class MyExporterExtensions
{
public static MeterProviderBuilder AddMyExporter(this MeterProviderBuilder builder)
public static MeterProviderBuilder AddMyExporter(this MeterProviderBuilder builder, int exportIntervalMilliSeconds = Timeout.Infinite)
{
if (builder == null)
{
throw new ArgumentNullException(nameof(builder));
}
return builder.AddReader(new BaseExportingMetricReader(new MyExporter()));
if (exportIntervalMilliSeconds == Timeout.Infinite)
{
// Export triggered manually only.
return builder.AddReader(new BaseExportingMetricReader(new MyExporter()));
}
else
{
// Export is triggered periodically.
return builder.AddReader(new PeriodicExportingMetricReader(new MyExporter(), exportIntervalMilliSeconds));
}
}
}

View File

@ -29,8 +29,6 @@ not covered by the built-in exporters:
done via `OpenTelemetry.SuppressInstrumentationScope`.
* Exporters receives a batch of `Metric`, and each `Metric`
can contain 1 or more `MetricPoint`s.
* Exporters should use `Activity.TagObjects` collection instead of
`Activity.Tags` to obtain the full set of attributes (tags).
* Exporters should use `ParentProvider.GetResource()` to get the `Resource`
associated with the provider.