From fe0610ca500abe9ff4ea9ac53f2054827904875c Mon Sep 17 00:00:00 2001 From: Reiley Yang Date: Thu, 13 Aug 2020 13:23:18 -0700 Subject: [PATCH 1/2] refactor exporter --- .../Trace/ActivityExporterSync.cs | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 src/OpenTelemetry/Trace/ActivityExporterSync.cs diff --git a/src/OpenTelemetry/Trace/ActivityExporterSync.cs b/src/OpenTelemetry/Trace/ActivityExporterSync.cs new file mode 100644 index 00000000000..f08c352ebad --- /dev/null +++ b/src/OpenTelemetry/Trace/ActivityExporterSync.cs @@ -0,0 +1,75 @@ +// +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; + +namespace OpenTelemetry.Trace +{ + /// + /// Enumeration used to define the result of an export operation. + /// + public enum ExportResultSync + { + /// + /// Batch is successfully exported. + /// + Succeeded = 0, + + /// + /// Batch export failed. + /// + Failed = 1, + } + + /// + /// ActivityExporterSync base class. + /// + public abstract class ActivityExporterSync : IDisposable + { + /// + /// Exports batch of activities. + /// + /// Batch of activities to export. + /// Result of export. + public abstract ExportResult Export(IEnumerable batch); + + /// + /// Shuts down the exporter. + /// + public virtual void Shutdown() + { + } + + /// + public void Dispose() + { + this.Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases the unmanaged resources used by this class and optionally releases the managed resources. + /// + /// to release both managed and unmanaged resources; to release only unmanaged resources. + protected virtual void Dispose(bool disposing) + { + } + } +} From bb03a9638515127f41417a98df5214db8bd1a1c0 Mon Sep 17 00:00:00 2001 From: Reiley Yang Date: Thu, 13 Aug 2020 13:54:10 -0700 Subject: [PATCH 2/2] stay closer to the spec --- src/OpenTelemetry/Trace/ActivityExporterSync.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenTelemetry/Trace/ActivityExporterSync.cs b/src/OpenTelemetry/Trace/ActivityExporterSync.cs index f08c352ebad..4ab0a6947cc 100644 --- a/src/OpenTelemetry/Trace/ActivityExporterSync.cs +++ b/src/OpenTelemetry/Trace/ActivityExporterSync.cs @@ -28,14 +28,14 @@ namespace OpenTelemetry.Trace public enum ExportResultSync { /// - /// Batch is successfully exported. + /// Batch export succeeded. /// - Succeeded = 0, + Success = 0, /// /// Batch export failed. /// - Failed = 1, + Failure = 1, } ///