Minor additions to Extending Metric SDK docs (#3089)
This commit is contained in:
parent
a4a4d7ffa8
commit
3e8074576d
|
|
@ -15,17 +15,27 @@
|
||||||
// </copyright>
|
// </copyright>
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
using OpenTelemetry.Metrics;
|
using OpenTelemetry.Metrics;
|
||||||
|
|
||||||
internal static class MyExporterExtensions
|
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)
|
if (builder == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(builder));
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,6 @@ not covered by the built-in exporters:
|
||||||
done via `OpenTelemetry.SuppressInstrumentationScope`.
|
done via `OpenTelemetry.SuppressInstrumentationScope`.
|
||||||
* Exporters receives a batch of `Metric`, and each `Metric`
|
* Exporters receives a batch of `Metric`, and each `Metric`
|
||||||
can contain 1 or more `MetricPoint`s.
|
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`
|
* Exporters should use `ParentProvider.GetResource()` to get the `Resource`
|
||||||
associated with the provider.
|
associated with the provider.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue