https://github.com/open-telemetry/opent ... ode]public class PeriodicExportingMetricReader : BaseExportingMetricReader
{
// ...
private readonly Thread exporterThread;
private readonly AutoResetEvent exportTrigger = new(false);
private readonly ManualResetEvent shutdownTrigger = new(false);
public PeriodicExportingMetricReader(
BaseExporter exporter,
int exportIntervalMilliseconds = DefaultExportIntervalMilliseconds,
int exportTimeoutMilliseconds = DefaultExportTimeoutMilliseconds)
: base(exporter)
{
this.exporterThread = new Thread(new ThreadStart(this.ExporterProc))
{
IsBackground = true,
Name = $"OpenTelemetry-{nameof(PeriodicExportingMetricReader)}-{exporter.GetType().Name}",
};
this.exporterThread.Start();
}
private void ExporterProc()
{
int index;
int timeout;
var triggers = new WaitHandle[] { this.exportTrigger, this.shutdownTrigger }; //
Подробнее здесь: https://stackoverflow.com/questions/796 ... t-signaled