// Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 using OpenTelemetry.Internal; namespace OpenTelemetry; /// /// Implements processor that exports telemetry data at each OnEnd call. /// /// The type of telemetry object to be exported. public abstract class SimpleExportProcessor : BaseExportProcessor where T : class { private readonly Lock syncObject = new(); /// /// Initializes a new instance of the class. /// /// Exporter instance. protected SimpleExportProcessor(BaseExporter exporter) : base(exporter) { } /// protected override void OnExport(T data) { lock (this.syncObject) { try { this.exporter.Export(new Batch(data)); } catch (Exception ex) { OpenTelemetrySdkEventSource.Log.SpanProcessorException(nameof(this.OnExport), ex); } } } }