From 2f721a81f81eeda46aa56972e30a0a70ea03ef46 Mon Sep 17 00:00:00 2001 From: Utkarsh Umesan Pillai Date: Tue, 24 Nov 2020 23:09:16 -0800 Subject: [PATCH 1/5] Added SimpleExporter and BatchExporter for Activity and LogRecord --- .../extending-the-sdk/LoggerExtensions.cs | 2 +- docs/logs/extending-the-sdk/Program.cs | 2 +- .../MyExporterHelperExtensions.cs | 2 +- docs/trace/extending-the-sdk/Program.cs | 2 +- .../ConsoleExporterHelperExtensions.cs | 2 +- .../ConsoleExporterLoggingExtensions.cs | 2 +- .../InMemoryExporterHelperExtensions.cs | 2 +- .../InMemoryExporterLoggingExtensions.cs | 2 +- .../JaegerExporterHelperExtensions.cs | 4 +- .../OtlpExporterHelperExtensions.cs | 4 +- .../ZipkinExporterHelperExtensions.cs | 4 +- src/OpenTelemetry/BaseExportProcessor.cs | 12 ++--- .../BatchActivityExportProcessor.cs | 49 +++++++++++++++++++ src/OpenTelemetry/BatchExportProcessor.cs | 6 +-- .../BatchLogRecordExportProcessor.cs | 41 ++++++++++++++++ .../SimpleActivityExportProcessor.cs | 39 +++++++++++++++ src/OpenTelemetry/SimpleExportProcessor.cs | 6 +-- .../SimpleLogRecordExportProcessor.cs | 30 ++++++++++++ .../OtlpExporterTest.cs | 2 +- .../ZipkinExporterTests.cs | 4 +- ...ssor.cs => TestActivityExportProcessor.cs} | 10 ++-- .../Trace/BatchExportActivityProcessorTest.cs | 22 ++++----- .../Trace/ExportProcessorTest.cs | 6 +-- .../SimpleExportActivityProcessorTest.cs | 10 ++-- 24 files changed, 209 insertions(+), 56 deletions(-) create mode 100644 src/OpenTelemetry/BatchActivityExportProcessor.cs create mode 100644 src/OpenTelemetry/BatchLogRecordExportProcessor.cs create mode 100644 src/OpenTelemetry/SimpleActivityExportProcessor.cs create mode 100644 src/OpenTelemetry/SimpleLogRecordExportProcessor.cs rename test/OpenTelemetry.Tests/Shared/{TestExportProcessor.cs => TestActivityExportProcessor.cs} (74%) diff --git a/docs/logs/extending-the-sdk/LoggerExtensions.cs b/docs/logs/extending-the-sdk/LoggerExtensions.cs index 465da876e99..644d711c1a0 100644 --- a/docs/logs/extending-the-sdk/LoggerExtensions.cs +++ b/docs/logs/extending-the-sdk/LoggerExtensions.cs @@ -27,6 +27,6 @@ public static OpenTelemetryLoggerOptions AddMyExporter(this OpenTelemetryLoggerO throw new ArgumentNullException(nameof(options)); } - return options.AddProcessor(new BatchExportProcessor(new MyExporter())); + return options.AddProcessor(new BatchLogRecordExportProcessor(new MyExporter())); } } diff --git a/docs/logs/extending-the-sdk/Program.cs b/docs/logs/extending-the-sdk/Program.cs index 90177244578..34b92899924 100644 --- a/docs/logs/extending-the-sdk/Program.cs +++ b/docs/logs/extending-the-sdk/Program.cs @@ -35,7 +35,7 @@ public static void Main() builder.AddOpenTelemetry(options => options .AddProcessor(new MyProcessor("ProcessorA")) .AddProcessor(new MyProcessor("ProcessorB")) - .AddProcessor(new SimpleExportProcessor(new MyExporter("ExporterX"))) + .AddProcessor(new SimpleLogRecordExportProcessor(new MyExporter("ExporterX"))) .AddMyExporter()); }); diff --git a/docs/trace/extending-the-sdk/MyExporterHelperExtensions.cs b/docs/trace/extending-the-sdk/MyExporterHelperExtensions.cs index e35ac0f4531..910f812db05 100644 --- a/docs/trace/extending-the-sdk/MyExporterHelperExtensions.cs +++ b/docs/trace/extending-the-sdk/MyExporterHelperExtensions.cs @@ -28,6 +28,6 @@ public static TracerProviderBuilder AddMyExporter(this TracerProviderBuilder bui throw new ArgumentNullException(nameof(builder)); } - return builder.AddProcessor(new BatchExportProcessor(new MyExporter())); + return builder.AddProcessor(new BatchActivityExportProcessor(new MyExporter())); } } diff --git a/docs/trace/extending-the-sdk/Program.cs b/docs/trace/extending-the-sdk/Program.cs index c099ab6e877..d22781033f5 100644 --- a/docs/trace/extending-the-sdk/Program.cs +++ b/docs/trace/extending-the-sdk/Program.cs @@ -29,7 +29,7 @@ public static void Main() .AddSource("OTel.Demo") .AddProcessor(new MyProcessor("ProcessorA")) .AddProcessor(new MyProcessor("ProcessorB")) - .AddProcessor(new SimpleExportProcessor(new MyExporter("ExporterX"))) + .AddProcessor(new SimpleActivityExportProcessor(new MyExporter("ExporterX"))) .AddMyExporter() .Build(); diff --git a/src/OpenTelemetry.Exporter.Console/ConsoleExporterHelperExtensions.cs b/src/OpenTelemetry.Exporter.Console/ConsoleExporterHelperExtensions.cs index 4b1817852b9..f4fe6da2c76 100644 --- a/src/OpenTelemetry.Exporter.Console/ConsoleExporterHelperExtensions.cs +++ b/src/OpenTelemetry.Exporter.Console/ConsoleExporterHelperExtensions.cs @@ -38,7 +38,7 @@ public static TracerProviderBuilder AddConsoleExporter(this TracerProviderBuilde var options = new ConsoleExporterOptions(); configure?.Invoke(options); - return builder.AddProcessor(new SimpleExportProcessor(new ConsoleExporter(options))); + return builder.AddProcessor(new SimpleActivityExportProcessor(new ConsoleExporter(options))); } } } diff --git a/src/OpenTelemetry.Exporter.Console/ConsoleExporterLoggingExtensions.cs b/src/OpenTelemetry.Exporter.Console/ConsoleExporterLoggingExtensions.cs index 1827cc90c50..df3a6cde4a4 100644 --- a/src/OpenTelemetry.Exporter.Console/ConsoleExporterLoggingExtensions.cs +++ b/src/OpenTelemetry.Exporter.Console/ConsoleExporterLoggingExtensions.cs @@ -37,7 +37,7 @@ public static OpenTelemetryLoggerOptions AddConsoleExporter(this OpenTelemetryLo var options = new ConsoleExporterOptions(); configure?.Invoke(options); - return loggerOptions.AddProcessor(new SimpleExportProcessor(new ConsoleExporter(options))); + return loggerOptions.AddProcessor(new SimpleLogRecordExportProcessor(new ConsoleExporter(options))); } } } diff --git a/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterHelperExtensions.cs b/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterHelperExtensions.cs index 54addbfc4ee..a596ea326f7 100644 --- a/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterHelperExtensions.cs +++ b/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterHelperExtensions.cs @@ -42,7 +42,7 @@ public static TracerProviderBuilder AddInMemoryExporter(this TracerProviderBuild throw new ArgumentNullException(nameof(exportedItems)); } - return builder.AddProcessor(new SimpleExportProcessor(new InMemoryExporter(exportedItems))); + return builder.AddProcessor(new SimpleActivityExportProcessor(new InMemoryExporter(exportedItems))); } } } diff --git a/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterLoggingExtensions.cs b/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterLoggingExtensions.cs index 62c6e8bd5dd..dce3414126f 100644 --- a/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterLoggingExtensions.cs +++ b/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterLoggingExtensions.cs @@ -35,7 +35,7 @@ public static OpenTelemetryLoggerOptions AddInMemoryExporter(this OpenTelemetryL throw new ArgumentNullException(nameof(exportedItems)); } - return loggerOptions.AddProcessor(new SimpleExportProcessor(new InMemoryExporter(exportedItems))); + return loggerOptions.AddProcessor(new SimpleLogRecordExportProcessor(new InMemoryExporter(exportedItems))); } } } diff --git a/src/OpenTelemetry.Exporter.Jaeger/JaegerExporterHelperExtensions.cs b/src/OpenTelemetry.Exporter.Jaeger/JaegerExporterHelperExtensions.cs index 2d558fad519..1c67154a6c1 100644 --- a/src/OpenTelemetry.Exporter.Jaeger/JaegerExporterHelperExtensions.cs +++ b/src/OpenTelemetry.Exporter.Jaeger/JaegerExporterHelperExtensions.cs @@ -45,11 +45,11 @@ public static TracerProviderBuilder AddJaegerExporter(this TracerProviderBuilder if (exporterOptions.ExportProcessorType == ExportProcessorType.Simple) { - return builder.AddProcessor(new SimpleExportProcessor(jaegerExporter)); + return builder.AddProcessor(new SimpleActivityExportProcessor(jaegerExporter)); } else { - return builder.AddProcessor(new BatchExportProcessor( + return builder.AddProcessor(new BatchActivityExportProcessor( jaegerExporter, exporterOptions.BatchExportProcessorOptions.MaxQueueSize, exporterOptions.BatchExportProcessorOptions.ScheduledDelayMilliseconds, diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterHelperExtensions.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterHelperExtensions.cs index 6b5d6887352..6bd0810a64b 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterHelperExtensions.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterHelperExtensions.cs @@ -45,11 +45,11 @@ public static TracerProviderBuilder AddOtlpExporter(this TracerProviderBuilder b if (exporterOptions.ExportProcessorType == ExportProcessorType.Simple) { - return builder.AddProcessor(new SimpleExportProcessor(otlpExporter)); + return builder.AddProcessor(new SimpleActivityExportProcessor(otlpExporter)); } else { - return builder.AddProcessor(new BatchExportProcessor( + return builder.AddProcessor(new BatchActivityExportProcessor( otlpExporter, exporterOptions.BatchExportProcessorOptions.MaxQueueSize, exporterOptions.BatchExportProcessorOptions.ScheduledDelayMilliseconds, diff --git a/src/OpenTelemetry.Exporter.Zipkin/ZipkinExporterHelperExtensions.cs b/src/OpenTelemetry.Exporter.Zipkin/ZipkinExporterHelperExtensions.cs index 251845a0e20..318a8ead220 100644 --- a/src/OpenTelemetry.Exporter.Zipkin/ZipkinExporterHelperExtensions.cs +++ b/src/OpenTelemetry.Exporter.Zipkin/ZipkinExporterHelperExtensions.cs @@ -45,11 +45,11 @@ public static TracerProviderBuilder AddZipkinExporter(this TracerProviderBuilder if (exporterOptions.ExportProcessorType == ExportProcessorType.Simple) { - return builder.AddProcessor(new SimpleExportProcessor(zipkinExporter)); + return builder.AddProcessor(new SimpleActivityExportProcessor(zipkinExporter)); } else { - return builder.AddProcessor(new BatchExportProcessor( + return builder.AddProcessor(new BatchActivityExportProcessor( zipkinExporter, exporterOptions.BatchExportProcessorOptions.MaxQueueSize, exporterOptions.BatchExportProcessorOptions.ScheduledDelayMilliseconds, diff --git a/src/OpenTelemetry/BaseExportProcessor.cs b/src/OpenTelemetry/BaseExportProcessor.cs index 13f841917c7..ca771a5fdce 100644 --- a/src/OpenTelemetry/BaseExportProcessor.cs +++ b/src/OpenTelemetry/BaseExportProcessor.cs @@ -34,7 +34,7 @@ public abstract class BaseExportProcessor : BaseProcessor /// Initializes a new instance of the class. /// /// Exporter instance. - public BaseExportProcessor(BaseExporter exporter) + protected BaseExportProcessor(BaseExporter exporter) { this.exporter = exporter ?? throw new ArgumentNullException(nameof(exporter)); } @@ -44,18 +44,12 @@ public sealed override void OnStart(T data) { } - /// - public sealed override void OnEnd(T data) + public override void OnEnd(T data) { - if (data is Activity activity && activity.ActivityTraceFlags == ActivityTraceFlags.None) - { - return; - } - this.OnExport(data); } - public abstract void OnExport(T data); + protected abstract void OnExport(T data); internal override void SetParentProvider(BaseProvider parentProvider) { diff --git a/src/OpenTelemetry/BatchActivityExportProcessor.cs b/src/OpenTelemetry/BatchActivityExportProcessor.cs new file mode 100644 index 00000000000..be62c8d015c --- /dev/null +++ b/src/OpenTelemetry/BatchActivityExportProcessor.cs @@ -0,0 +1,49 @@ +// +// 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.Diagnostics; + +namespace OpenTelemetry +{ + public class BatchActivityExportProcessor : BatchExportProcessor + { + public BatchActivityExportProcessor( + BaseExporter exporter, + int maxQueueSize = DefaultMaxQueueSize, + int scheduledDelayMilliseconds = DefaultScheduledDelayMilliseconds, + int exporterTimeoutMilliseconds = DefaultExporterTimeoutMilliseconds, + int maxExportBatchSize = DefaultMaxExportBatchSize) + : base( + exporter, + maxQueueSize, + scheduledDelayMilliseconds, + exporterTimeoutMilliseconds, + maxExportBatchSize) + { + } + + /// + public override void OnEnd(Activity data) + { + if (!data.Recorded) + { + return; + } + + this.OnExport(data); + } + } +} diff --git a/src/OpenTelemetry/BatchExportProcessor.cs b/src/OpenTelemetry/BatchExportProcessor.cs index b6375b9a396..a41ee5c647c 100644 --- a/src/OpenTelemetry/BatchExportProcessor.cs +++ b/src/OpenTelemetry/BatchExportProcessor.cs @@ -25,7 +25,7 @@ namespace OpenTelemetry /// Implements processor that batches telemetry objects before calling exporter. /// /// The type of telemetry object to be exported. - public class BatchExportProcessor : BaseExportProcessor + public abstract class BatchExportProcessor : BaseExportProcessor where T : class { internal const int DefaultMaxQueueSize = 2048; @@ -52,7 +52,7 @@ public class BatchExportProcessor : BaseExportProcessor /// The delay interval in milliseconds between two consecutive exports. The default value is 5000. /// How long the export can run before it is cancelled. The default value is 30000. /// The maximum batch size of every export. It must be smaller or equal to maxQueueSize. The default value is 512. - public BatchExportProcessor( + protected BatchExportProcessor( BaseExporter exporter, int maxQueueSize = DefaultMaxQueueSize, int scheduledDelayMilliseconds = DefaultScheduledDelayMilliseconds, @@ -108,7 +108,7 @@ public BatchExportProcessor( internal long ProcessedCount => this.circularBuffer.RemovedCount; /// - public override void OnExport(T data) + protected override void OnExport(T data) { if (this.circularBuffer.TryAdd(data, maxSpinCount: 50000)) { diff --git a/src/OpenTelemetry/BatchLogRecordExportProcessor.cs b/src/OpenTelemetry/BatchLogRecordExportProcessor.cs new file mode 100644 index 00000000000..6c361b5840d --- /dev/null +++ b/src/OpenTelemetry/BatchLogRecordExportProcessor.cs @@ -0,0 +1,41 @@ +// +// 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. +// + +#if NET461 || NETSTANDARD2_0 +using OpenTelemetry.Logs; + +namespace OpenTelemetry +{ + public class BatchLogRecordExportProcessor : BatchExportProcessor + { + public BatchLogRecordExportProcessor( + BaseExporter exporter, + int maxQueueSize = DefaultMaxQueueSize, + int scheduledDelayMilliseconds = DefaultScheduledDelayMilliseconds, + int exporterTimeoutMilliseconds = DefaultExporterTimeoutMilliseconds, + int maxExportBatchSize = DefaultMaxExportBatchSize) + : base( + exporter, + maxQueueSize, + scheduledDelayMilliseconds, + exporterTimeoutMilliseconds, + maxExportBatchSize) + { + + } + } +} +#endif diff --git a/src/OpenTelemetry/SimpleActivityExportProcessor.cs b/src/OpenTelemetry/SimpleActivityExportProcessor.cs new file mode 100644 index 00000000000..ac9a4a20c7f --- /dev/null +++ b/src/OpenTelemetry/SimpleActivityExportProcessor.cs @@ -0,0 +1,39 @@ +// +// 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.Diagnostics; + +namespace OpenTelemetry +{ + public class SimpleActivityExportProcessor : SimpleExportProcessor + { + public SimpleActivityExportProcessor(BaseExporter exporter) + : base(exporter) + { + } + + /// + public override void OnEnd(Activity data) + { + if (!data.Recorded) + { + return; + } + + this.OnExport(data); + } + } +} diff --git a/src/OpenTelemetry/SimpleExportProcessor.cs b/src/OpenTelemetry/SimpleExportProcessor.cs index 6c71b5473fa..4b09ca47881 100644 --- a/src/OpenTelemetry/SimpleExportProcessor.cs +++ b/src/OpenTelemetry/SimpleExportProcessor.cs @@ -23,7 +23,7 @@ namespace OpenTelemetry /// Implements processor that exports telemetry data at each OnEnd call. /// /// The type of telemetry object to be exported. - public class SimpleExportProcessor : BaseExportProcessor + public abstract class SimpleExportProcessor : BaseExportProcessor where T : class { private readonly object syncObject = new object(); @@ -32,13 +32,13 @@ public class SimpleExportProcessor : BaseExportProcessor /// Initializes a new instance of the class. /// /// Exporter instance. - public SimpleExportProcessor(BaseExporter exporter) + protected SimpleExportProcessor(BaseExporter exporter) : base(exporter) { } /// - public override void OnExport(T data) + protected override void OnExport(T data) { lock (this.syncObject) { diff --git a/src/OpenTelemetry/SimpleLogRecordExportProcessor.cs b/src/OpenTelemetry/SimpleLogRecordExportProcessor.cs new file mode 100644 index 00000000000..19ebc903fb7 --- /dev/null +++ b/src/OpenTelemetry/SimpleLogRecordExportProcessor.cs @@ -0,0 +1,30 @@ +// +// 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. +// + +#if NET461 || NETSTANDARD2_0 +using OpenTelemetry.Logs; + +namespace OpenTelemetry +{ + public class SimpleLogRecordExportProcessor : SimpleExportProcessor + { + public SimpleLogRecordExportProcessor(BaseExporter exporter) + : base(exporter) + { + } + } +} +#endif diff --git a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpExporterTest.cs b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpExporterTest.cs index 8291b32233b..6dd9d871e2a 100644 --- a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpExporterTest.cs +++ b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpExporterTest.cs @@ -96,7 +96,7 @@ public void ToOtlpResourceSpansTest(bool addResource) using var openTelemetrySdk = builder.Build(); - var processor = new BatchExportProcessor(new TestExporter(RunTest)); + var processor = new BatchActivityExportProcessor(new TestExporter(RunTest)); const int numOfSpans = 10; bool isEven; for (var i = 0; i < numOfSpans; i++) diff --git a/test/OpenTelemetry.Exporter.Zipkin.Tests/ZipkinExporterTests.cs b/test/OpenTelemetry.Exporter.Zipkin.Tests/ZipkinExporterTests.cs index abd1c67bf6f..f78939c39cb 100644 --- a/test/OpenTelemetry.Exporter.Zipkin.Tests/ZipkinExporterTests.cs +++ b/test/OpenTelemetry.Exporter.Zipkin.Tests/ZipkinExporterTests.cs @@ -109,7 +109,7 @@ public void SuppresssesInstrumentation() Endpoint = new Uri($"http://{this.testServerHost}:{this.testServerPort}/api/v2/spans?requestId={requestId}"), }; var zipkinExporter = new ZipkinExporter(exporterOptions); - var exportActivityProcessor = new BatchExportProcessor(zipkinExporter); + var exportActivityProcessor = new BatchActivityExportProcessor(zipkinExporter); var openTelemetrySdk = Sdk.CreateTracerProviderBuilder() .AddSource(ActivitySourceName) @@ -168,7 +168,7 @@ public void IntegrationTest(bool useShortTraceIds, bool useTestResource, bool is exporter.SetLocalEndpointFromResource(Resource.Empty); } - var processor = new SimpleExportProcessor(exporter); + var processor = new SimpleActivityExportProcessor(exporter); processor.OnEnd(activity); diff --git a/test/OpenTelemetry.Tests/Shared/TestExportProcessor.cs b/test/OpenTelemetry.Tests/Shared/TestActivityExportProcessor.cs similarity index 74% rename from test/OpenTelemetry.Tests/Shared/TestExportProcessor.cs rename to test/OpenTelemetry.Tests/Shared/TestActivityExportProcessor.cs index a56d273a3a3..e506c69e231 100644 --- a/test/OpenTelemetry.Tests/Shared/TestExportProcessor.cs +++ b/test/OpenTelemetry.Tests/Shared/TestActivityExportProcessor.cs @@ -15,20 +15,20 @@ // using System.Collections.Generic; +using System.Diagnostics; namespace OpenTelemetry.Tests { - internal class TestExportProcessor : BaseExportProcessor - where T : class + internal class TestActivityExportProcessor : SimpleActivityExportProcessor { - public List ExportedItems = new List(); + public List ExportedItems = new List(); - public TestExportProcessor(BaseExporter exporter) + public TestActivityExportProcessor(BaseExporter exporter) : base(exporter) { } - public override void OnExport(T data) + protected override void OnExport(Activity data) { this.ExportedItems.Add(data); } diff --git a/test/OpenTelemetry.Tests/Trace/BatchExportActivityProcessorTest.cs b/test/OpenTelemetry.Tests/Trace/BatchExportActivityProcessorTest.cs index 73a8833ae03..6c44e0f114e 100644 --- a/test/OpenTelemetry.Tests/Trace/BatchExportActivityProcessorTest.cs +++ b/test/OpenTelemetry.Tests/Trace/BatchExportActivityProcessorTest.cs @@ -28,18 +28,18 @@ public class BatchExportActivityProcessorTest [Fact] public void CheckNullExporter() { - Assert.Throws(() => new BatchExportProcessor(null)); + Assert.Throws(() => new BatchActivityExportProcessor(null)); } [Fact] public void CheckConstructorWithInvalidValues() { var exportedItems = new List(); - Assert.Throws(() => new BatchExportProcessor(new InMemoryExporter(exportedItems), maxQueueSize: 0)); - Assert.Throws(() => new BatchExportProcessor(new InMemoryExporter(exportedItems), maxExportBatchSize: 0)); - Assert.Throws(() => new BatchExportProcessor(new InMemoryExporter(exportedItems), maxQueueSize: 1, maxExportBatchSize: 2049)); - Assert.Throws(() => new BatchExportProcessor(new InMemoryExporter(exportedItems), scheduledDelayMilliseconds: 0)); - Assert.Throws(() => new BatchExportProcessor(new InMemoryExporter(exportedItems), exporterTimeoutMilliseconds: -1)); + Assert.Throws(() => new BatchActivityExportProcessor(new InMemoryExporter(exportedItems), maxQueueSize: 0)); + Assert.Throws(() => new BatchActivityExportProcessor(new InMemoryExporter(exportedItems), maxExportBatchSize: 0)); + Assert.Throws(() => new BatchActivityExportProcessor(new InMemoryExporter(exportedItems), maxQueueSize: 1, maxExportBatchSize: 2049)); + Assert.Throws(() => new BatchActivityExportProcessor(new InMemoryExporter(exportedItems), scheduledDelayMilliseconds: 0)); + Assert.Throws(() => new BatchActivityExportProcessor(new InMemoryExporter(exportedItems), exporterTimeoutMilliseconds: -1)); } [Fact] @@ -47,7 +47,7 @@ public void CheckIfBatchIsExportingOnQueueLimit() { var exportedItems = new List(); using var exporter = new InMemoryExporter(exportedItems); - using var processor = new BatchExportProcessor( + using var processor = new BatchActivityExportProcessor( exporter, maxQueueSize: 1, maxExportBatchSize: 1, @@ -75,7 +75,7 @@ public void CheckForceFlushWithInvalidTimeout() { var exportedItems = new List(); using var exporter = new InMemoryExporter(exportedItems); - using var processor = new BatchExportProcessor(exporter, maxQueueSize: 2, maxExportBatchSize: 1); + using var processor = new BatchActivityExportProcessor(exporter, maxQueueSize: 2, maxExportBatchSize: 1); Assert.Throws(() => processor.ForceFlush(-2)); } @@ -87,7 +87,7 @@ public void CheckForceFlushExport(int timeout) { var exportedItems = new List(); using var exporter = new InMemoryExporter(exportedItems); - using var processor = new BatchExportProcessor( + using var processor = new BatchActivityExportProcessor( exporter, maxQueueSize: 3, maxExportBatchSize: 3, @@ -132,7 +132,7 @@ public void CheckShutdownExport(int timeout) { var exportedItems = new List(); using var exporter = new InMemoryExporter(exportedItems); - using var processor = new BatchExportProcessor( + using var processor = new BatchActivityExportProcessor( exporter, maxQueueSize: 3, maxExportBatchSize: 3, @@ -162,7 +162,7 @@ public void CheckExportForRecordingButNotSampledActivity() { var exportedItems = new List(); using var exporter = new InMemoryExporter(exportedItems); - using var processor = new BatchExportProcessor( + using var processor = new BatchActivityExportProcessor( exporter, maxQueueSize: 1, maxExportBatchSize: 1); diff --git a/test/OpenTelemetry.Tests/Trace/ExportProcessorTest.cs b/test/OpenTelemetry.Tests/Trace/ExportProcessorTest.cs index 99bdf94e194..367b3e0f739 100644 --- a/test/OpenTelemetry.Tests/Trace/ExportProcessorTest.cs +++ b/test/OpenTelemetry.Tests/Trace/ExportProcessorTest.cs @@ -30,7 +30,7 @@ public class ExportProcessorTest public void ExportProcessorIgnoresActivityWhenDropped() { var sampler = new AlwaysOffSampler(); - var processor = new TestExportProcessor(new ConsoleExporter(null)); + var processor = new TestActivityExportProcessor(new ConsoleExporter(null)); using var activitySource = new ActivitySource(ActivitySourceName); using var sdk = Sdk.CreateTracerProviderBuilder() .AddSource(ActivitySourceName) @@ -51,7 +51,7 @@ public void ExportProcessorIgnoresActivityWhenDropped() public void ExportProcessorIgnoresActivityMarkedAsRecordOnly() { var sampler = new RecordOnlySampler(); - var processor = new TestExportProcessor(new ConsoleExporter(null)); + var processor = new TestActivityExportProcessor(new ConsoleExporter(null)); using var activitySource = new ActivitySource(ActivitySourceName); using var sdk = Sdk.CreateTracerProviderBuilder() .AddSource(ActivitySourceName) @@ -72,7 +72,7 @@ public void ExportProcessorIgnoresActivityMarkedAsRecordOnly() public void ExportProcessorExportsActivityMarkedAsRecordAndSample() { var sampler = new AlwaysOnSampler(); - var processor = new TestExportProcessor(new ConsoleExporter(null)); + var processor = new TestActivityExportProcessor(new ConsoleExporter(null)); using var activitySource = new ActivitySource(ActivitySourceName); using var sdk = Sdk.CreateTracerProviderBuilder() .AddSource(ActivitySourceName) diff --git a/test/OpenTelemetry.Tests/Trace/SimpleExportActivityProcessorTest.cs b/test/OpenTelemetry.Tests/Trace/SimpleExportActivityProcessorTest.cs index 88606bf6b21..d30ff6ed051 100644 --- a/test/OpenTelemetry.Tests/Trace/SimpleExportActivityProcessorTest.cs +++ b/test/OpenTelemetry.Tests/Trace/SimpleExportActivityProcessorTest.cs @@ -28,7 +28,7 @@ public class SimpleExportActivityProcessorTest [Fact] public void CheckNullExporter() { - Assert.Throws(() => new SimpleExportProcessor(null)); + Assert.Throws(() => new SimpleActivityExportProcessor(null)); } [Fact] @@ -36,7 +36,7 @@ public void CheckExportedOnEnd() { var exportedItems = new List(); using var exporter = new InMemoryExporter(exportedItems); - using var processor = new SimpleExportProcessor(exporter); + using var processor = new SimpleActivityExportProcessor(exporter); var activity1 = new Activity("start1"); activity1.ActivityTraceFlags = ActivityTraceFlags.Recorded; @@ -59,7 +59,7 @@ public void CheckForceFlushExport(int timeout) { var exportedItems = new List(); using var exporter = new InMemoryExporter(exportedItems); - using var processor = new SimpleExportProcessor(exporter); + using var processor = new SimpleActivityExportProcessor(exporter); var activity1 = new Activity("start1"); activity1.ActivityTraceFlags = ActivityTraceFlags.Recorded; @@ -86,7 +86,7 @@ public void CheckShutdownExport(int timeout) { var exportedItems = new List(); using var exporter = new InMemoryExporter(exportedItems); - using var processor = new SimpleExportProcessor(exporter); + using var processor = new SimpleActivityExportProcessor(exporter); var activity = new Activity("start"); activity.ActivityTraceFlags = ActivityTraceFlags.Recorded; @@ -105,7 +105,7 @@ public void CheckExportForRecordingButNotSampledActivity() { var exportedItems = new List(); using var exporter = new InMemoryExporter(exportedItems); - using var processor = new SimpleExportProcessor(exporter); + using var processor = new SimpleActivityExportProcessor(exporter); var activity = new Activity("start"); activity.ActivityTraceFlags = ActivityTraceFlags.None; From b7d569c4487a3d54f1b770f2934ec7a1408ca3d6 Mon Sep 17 00:00:00 2001 From: Utkarsh Umesan Pillai Date: Mon, 30 Nov 2020 11:46:22 -0800 Subject: [PATCH 2/5] Updated the .publicApi text files --- .../.publicApi/net452/PublicAPI.Unshipped.txt | 8 +++++++- .../.publicApi/net46/PublicAPI.Unshipped.txt | 8 +++++++- .../.publicApi/net461/PublicAPI.Unshipped.txt | 12 +++++++++++- .../netstandard2.0/PublicAPI.Unshipped.txt | 12 +++++++++++- src/OpenTelemetry/BaseExportProcessor.cs | 4 ++-- src/OpenTelemetry/BatchLogRecordExportProcessor.cs | 1 - .../Shared/TestActivityExportProcessor.cs | 2 +- 7 files changed, 39 insertions(+), 8 deletions(-) diff --git a/src/OpenTelemetry/.publicApi/net452/PublicAPI.Unshipped.txt b/src/OpenTelemetry/.publicApi/net452/PublicAPI.Unshipped.txt index 8baca87e353..2d10b341f64 100644 --- a/src/OpenTelemetry/.publicApi/net452/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry/.publicApi/net452/PublicAPI.Unshipped.txt @@ -20,6 +20,8 @@ OpenTelemetry.Batch.Enumerator.Enumerator() -> void OpenTelemetry.Batch.Enumerator.MoveNext() -> bool OpenTelemetry.Batch.Enumerator.Reset() -> void OpenTelemetry.Batch.GetEnumerator() -> OpenTelemetry.Batch.Enumerator +OpenTelemetry.BatchActivityExportProcessor +OpenTelemetry.BatchActivityExportProcessor.BatchActivityExportProcessor(OpenTelemetry.BaseExporter exporter, int maxQueueSize = 2048, int scheduledDelayMilliseconds = 5000, int exporterTimeoutMilliseconds = 30000, int maxExportBatchSize = 512) -> void OpenTelemetry.BatchExportProcessor OpenTelemetry.BatchExportProcessor.BatchExportProcessor(OpenTelemetry.BaseExporter exporter, int maxQueueSize = 2048, int scheduledDelayMilliseconds = 5000, int exporterTimeoutMilliseconds = 30000, int maxExportBatchSize = 512) -> void OpenTelemetry.BatchExportProcessorOptions @@ -130,6 +132,8 @@ OpenTelemetry.Resources.ResourceBuilder.Build() -> OpenTelemetry.Resources.Resou OpenTelemetry.Resources.ResourceBuilder.Clear() -> OpenTelemetry.Resources.ResourceBuilder OpenTelemetry.Resources.ResourceBuilderExtensions OpenTelemetry.Sdk +OpenTelemetry.SimpleActivityExportProcessor +OpenTelemetry.SimpleActivityExportProcessor.SimpleActivityExportProcessor(OpenTelemetry.BaseExporter exporter) -> void OpenTelemetry.SimpleExportProcessor OpenTelemetry.SimpleExportProcessor.SimpleExportProcessor(OpenTelemetry.BaseExporter exporter) -> void OpenTelemetry.SuppressInstrumentationScope @@ -179,7 +183,9 @@ abstract OpenTelemetry.Metrics.Export.MetricProcessor.FinishCollectionCycle(out abstract OpenTelemetry.Metrics.Export.MetricProcessor.Process(OpenTelemetry.Metrics.Export.Metric metric) -> void abstract OpenTelemetry.Trace.Sampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult override OpenTelemetry.BaseExportProcessor.Dispose(bool disposing) -> void +override OpenTelemetry.BaseExportProcessor.OnEnd(T data) -> void override OpenTelemetry.BaseExportProcessor.OnShutdown(int timeoutMilliseconds) -> bool +override OpenTelemetry.BatchActivityExportProcessor.OnEnd(System.Diagnostics.Activity data) -> void override OpenTelemetry.BatchExportProcessor.OnExport(T data) -> void override OpenTelemetry.BatchExportProcessor.OnForceFlush(int timeoutMilliseconds) -> bool override OpenTelemetry.BatchExportProcessor.OnShutdown(int timeoutMilliseconds) -> bool @@ -214,6 +220,7 @@ override OpenTelemetry.Metrics.Aggregators.Int64MeasureMinMaxSumCountAggregator. override OpenTelemetry.Metrics.Aggregators.Int64MeasureMinMaxSumCountAggregator.Update(long value) -> void override OpenTelemetry.Metrics.Export.UngroupedBatcher.FinishCollectionCycle(out System.Collections.Generic.IEnumerable metrics) -> void override OpenTelemetry.Metrics.Export.UngroupedBatcher.Process(OpenTelemetry.Metrics.Export.Metric metric) -> void +override OpenTelemetry.SimpleActivityExportProcessor.OnEnd(System.Diagnostics.Activity data) -> void override OpenTelemetry.SimpleExportProcessor.OnExport(T data) -> void override OpenTelemetry.Trace.AlwaysOffSampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult override OpenTelemetry.Trace.AlwaysOnSampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult @@ -222,7 +229,6 @@ override OpenTelemetry.Trace.SamplingResult.Equals(object obj) -> bool override OpenTelemetry.Trace.SamplingResult.GetHashCode() -> int override OpenTelemetry.Trace.TraceIdRatioBasedSampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult abstract OpenTelemetry.BaseExportProcessor.OnExport(T data) -> void -override sealed OpenTelemetry.BaseExportProcessor.OnEnd(T data) -> void override sealed OpenTelemetry.BaseExportProcessor.OnStart(T data) -> void readonly OpenTelemetry.BaseExportProcessor.exporter -> OpenTelemetry.BaseExporter static OpenTelemetry.ProviderExtensions.GetResource(this OpenTelemetry.BaseProvider baseProvider) -> OpenTelemetry.Resources.Resource diff --git a/src/OpenTelemetry/.publicApi/net46/PublicAPI.Unshipped.txt b/src/OpenTelemetry/.publicApi/net46/PublicAPI.Unshipped.txt index 50b25ab3eb1..1f4e28de163 100644 --- a/src/OpenTelemetry/.publicApi/net46/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry/.publicApi/net46/PublicAPI.Unshipped.txt @@ -20,6 +20,8 @@ OpenTelemetry.Batch.Enumerator.Enumerator() -> void OpenTelemetry.Batch.Enumerator.MoveNext() -> bool OpenTelemetry.Batch.Enumerator.Reset() -> void OpenTelemetry.Batch.GetEnumerator() -> OpenTelemetry.Batch.Enumerator +OpenTelemetry.BatchActivityExportProcessor +OpenTelemetry.BatchActivityExportProcessor.BatchActivityExportProcessor(OpenTelemetry.BaseExporter exporter, int maxQueueSize = 2048, int scheduledDelayMilliseconds = 5000, int exporterTimeoutMilliseconds = 30000, int maxExportBatchSize = 512) -> void OpenTelemetry.BatchExportProcessor OpenTelemetry.BatchExportProcessor.BatchExportProcessor(OpenTelemetry.BaseExporter exporter, int maxQueueSize = 2048, int scheduledDelayMilliseconds = 5000, int exporterTimeoutMilliseconds = 30000, int maxExportBatchSize = 512) -> void OpenTelemetry.BatchExportProcessorOptions @@ -130,6 +132,8 @@ OpenTelemetry.Resources.ResourceBuilder.Build() -> OpenTelemetry.Resources.Resou OpenTelemetry.Resources.ResourceBuilder.Clear() -> OpenTelemetry.Resources.ResourceBuilder OpenTelemetry.Resources.ResourceBuilderExtensions OpenTelemetry.Sdk +OpenTelemetry.SimpleActivityExportProcessor +OpenTelemetry.SimpleActivityExportProcessor.SimpleActivityExportProcessor(OpenTelemetry.BaseExporter exporter) -> void OpenTelemetry.SimpleExportProcessor OpenTelemetry.SimpleExportProcessor.SimpleExportProcessor(OpenTelemetry.BaseExporter exporter) -> void OpenTelemetry.SuppressInstrumentationScope @@ -179,7 +183,9 @@ abstract OpenTelemetry.Metrics.Export.MetricProcessor.FinishCollectionCycle(out abstract OpenTelemetry.Metrics.Export.MetricProcessor.Process(OpenTelemetry.Metrics.Export.Metric metric) -> void abstract OpenTelemetry.Trace.Sampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult override OpenTelemetry.BaseExportProcessor.Dispose(bool disposing) -> void +override OpenTelemetry.BaseExportProcessor.OnEnd(T data) -> void override OpenTelemetry.BaseExportProcessor.OnShutdown(int timeoutMilliseconds) -> bool +override OpenTelemetry.BatchActivityExportProcessor.OnEnd(System.Diagnostics.Activity data) -> void override OpenTelemetry.BatchExportProcessor.OnExport(T data) -> void override OpenTelemetry.BatchExportProcessor.OnForceFlush(int timeoutMilliseconds) -> bool override OpenTelemetry.BatchExportProcessor.OnShutdown(int timeoutMilliseconds) -> bool @@ -214,6 +220,7 @@ override OpenTelemetry.Metrics.Aggregators.Int64MeasureMinMaxSumCountAggregator. override OpenTelemetry.Metrics.Aggregators.Int64MeasureMinMaxSumCountAggregator.Update(long value) -> void override OpenTelemetry.Metrics.Export.UngroupedBatcher.FinishCollectionCycle(out System.Collections.Generic.IEnumerable metrics) -> void override OpenTelemetry.Metrics.Export.UngroupedBatcher.Process(OpenTelemetry.Metrics.Export.Metric metric) -> void +override OpenTelemetry.SimpleActivityExportProcessor.OnEnd(System.Diagnostics.Activity data) -> void override OpenTelemetry.SimpleExportProcessor.OnExport(T data) -> void override OpenTelemetry.Trace.AlwaysOffSampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult override OpenTelemetry.Trace.AlwaysOnSampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult @@ -222,7 +229,6 @@ override OpenTelemetry.Trace.SamplingResult.Equals(object obj) -> bool override OpenTelemetry.Trace.SamplingResult.GetHashCode() -> int override OpenTelemetry.Trace.TraceIdRatioBasedSampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult abstract OpenTelemetry.BaseExportProcessor.OnExport(T data) -> void -override sealed OpenTelemetry.BaseExportProcessor.OnEnd(T data) -> void override sealed OpenTelemetry.BaseExportProcessor.OnStart(T data) -> void readonly OpenTelemetry.BaseExportProcessor.exporter -> OpenTelemetry.BaseExporter static OpenTelemetry.ProviderExtensions.GetResource(this OpenTelemetry.BaseProvider baseProvider) -> OpenTelemetry.Resources.Resource diff --git a/src/OpenTelemetry/.publicApi/net461/PublicAPI.Unshipped.txt b/src/OpenTelemetry/.publicApi/net461/PublicAPI.Unshipped.txt index 35226ea1905..a003b51aa13 100644 --- a/src/OpenTelemetry/.publicApi/net461/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry/.publicApi/net461/PublicAPI.Unshipped.txt @@ -21,6 +21,8 @@ OpenTelemetry.Batch.Enumerator.Enumerator() -> void OpenTelemetry.Batch.Enumerator.MoveNext() -> bool OpenTelemetry.Batch.Enumerator.Reset() -> void OpenTelemetry.Batch.GetEnumerator() -> OpenTelemetry.Batch.Enumerator +OpenTelemetry.BatchActivityExportProcessor +OpenTelemetry.BatchActivityExportProcessor.BatchActivityExportProcessor(OpenTelemetry.BaseExporter exporter, int maxQueueSize = 2048, int scheduledDelayMilliseconds = 5000, int exporterTimeoutMilliseconds = 30000, int maxExportBatchSize = 512) -> void OpenTelemetry.BatchExportProcessor OpenTelemetry.BatchExportProcessor.BatchExportProcessor(OpenTelemetry.BaseExporter exporter, int maxQueueSize = 2048, int scheduledDelayMilliseconds = 5000, int exporterTimeoutMilliseconds = 30000, int maxExportBatchSize = 512) -> void OpenTelemetry.BatchExportProcessorOptions @@ -33,6 +35,8 @@ OpenTelemetry.BatchExportProcessorOptions.MaxQueueSize.get -> int OpenTelemetry.BatchExportProcessorOptions.MaxQueueSize.set -> void OpenTelemetry.BatchExportProcessorOptions.ScheduledDelayMilliseconds.get -> int OpenTelemetry.BatchExportProcessorOptions.ScheduledDelayMilliseconds.set -> void +OpenTelemetry.BatchLogRecordExportProcessor +OpenTelemetry.BatchLogRecordExportProcessor.BatchLogRecordExportProcessor(OpenTelemetry.BaseExporter exporter, int maxQueueSize = 2048, int scheduledDelayMilliseconds = 5000, int exporterTimeoutMilliseconds = 30000, int maxExportBatchSize = 512) -> void OpenTelemetry.CompositeProcessor OpenTelemetry.CompositeProcessor.AddProcessor(OpenTelemetry.BaseProcessor processor) -> OpenTelemetry.CompositeProcessor OpenTelemetry.CompositeProcessor.CompositeProcessor(System.Collections.Generic.IEnumerable> processors) -> void @@ -149,8 +153,12 @@ OpenTelemetry.Resources.ResourceBuilder.Build() -> OpenTelemetry.Resources.Resou OpenTelemetry.Resources.ResourceBuilder.Clear() -> OpenTelemetry.Resources.ResourceBuilder OpenTelemetry.Resources.ResourceBuilderExtensions OpenTelemetry.Sdk +OpenTelemetry.SimpleActivityExportProcessor +OpenTelemetry.SimpleActivityExportProcessor.SimpleActivityExportProcessor(OpenTelemetry.BaseExporter exporter) -> void OpenTelemetry.SimpleExportProcessor OpenTelemetry.SimpleExportProcessor.SimpleExportProcessor(OpenTelemetry.BaseExporter exporter) -> void +OpenTelemetry.SimpleLogRecordExportProcessor +OpenTelemetry.SimpleLogRecordExportProcessor.SimpleLogRecordExportProcessor(OpenTelemetry.BaseExporter exporter) -> void OpenTelemetry.SuppressInstrumentationScope OpenTelemetry.SuppressInstrumentationScope.Dispose() -> void OpenTelemetry.Trace.AlwaysOffSampler @@ -198,7 +206,9 @@ abstract OpenTelemetry.Metrics.Export.MetricProcessor.FinishCollectionCycle(out abstract OpenTelemetry.Metrics.Export.MetricProcessor.Process(OpenTelemetry.Metrics.Export.Metric metric) -> void abstract OpenTelemetry.Trace.Sampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult override OpenTelemetry.BaseExportProcessor.Dispose(bool disposing) -> void +override OpenTelemetry.BaseExportProcessor.OnEnd(T data) -> void override OpenTelemetry.BaseExportProcessor.OnShutdown(int timeoutMilliseconds) -> bool +override OpenTelemetry.BatchActivityExportProcessor.OnEnd(System.Diagnostics.Activity data) -> void override OpenTelemetry.BatchExportProcessor.OnExport(T data) -> void override OpenTelemetry.BatchExportProcessor.OnForceFlush(int timeoutMilliseconds) -> bool override OpenTelemetry.BatchExportProcessor.OnShutdown(int timeoutMilliseconds) -> bool @@ -233,6 +243,7 @@ override OpenTelemetry.Metrics.Aggregators.Int64MeasureMinMaxSumCountAggregator. override OpenTelemetry.Metrics.Aggregators.Int64MeasureMinMaxSumCountAggregator.Update(long value) -> void override OpenTelemetry.Metrics.Export.UngroupedBatcher.FinishCollectionCycle(out System.Collections.Generic.IEnumerable metrics) -> void override OpenTelemetry.Metrics.Export.UngroupedBatcher.Process(OpenTelemetry.Metrics.Export.Metric metric) -> void +override OpenTelemetry.SimpleActivityExportProcessor.OnEnd(System.Diagnostics.Activity data) -> void override OpenTelemetry.SimpleExportProcessor.OnExport(T data) -> void override OpenTelemetry.Trace.AlwaysOffSampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult override OpenTelemetry.Trace.AlwaysOnSampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult @@ -241,7 +252,6 @@ override OpenTelemetry.Trace.SamplingResult.Equals(object obj) -> bool override OpenTelemetry.Trace.SamplingResult.GetHashCode() -> int override OpenTelemetry.Trace.TraceIdRatioBasedSampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult abstract OpenTelemetry.BaseExportProcessor.OnExport(T data) -> void -override sealed OpenTelemetry.BaseExportProcessor.OnEnd(T data) -> void override sealed OpenTelemetry.BaseExportProcessor.OnStart(T data) -> void readonly OpenTelemetry.BaseExportProcessor.exporter -> OpenTelemetry.BaseExporter static Microsoft.Extensions.Logging.OpenTelemetryLoggingExtensions.AddOpenTelemetry(this Microsoft.Extensions.Logging.ILoggingBuilder builder, System.Action configure = null) -> Microsoft.Extensions.Logging.ILoggingBuilder diff --git a/src/OpenTelemetry/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt index 35226ea1905..a003b51aa13 100644 --- a/src/OpenTelemetry/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt @@ -21,6 +21,8 @@ OpenTelemetry.Batch.Enumerator.Enumerator() -> void OpenTelemetry.Batch.Enumerator.MoveNext() -> bool OpenTelemetry.Batch.Enumerator.Reset() -> void OpenTelemetry.Batch.GetEnumerator() -> OpenTelemetry.Batch.Enumerator +OpenTelemetry.BatchActivityExportProcessor +OpenTelemetry.BatchActivityExportProcessor.BatchActivityExportProcessor(OpenTelemetry.BaseExporter exporter, int maxQueueSize = 2048, int scheduledDelayMilliseconds = 5000, int exporterTimeoutMilliseconds = 30000, int maxExportBatchSize = 512) -> void OpenTelemetry.BatchExportProcessor OpenTelemetry.BatchExportProcessor.BatchExportProcessor(OpenTelemetry.BaseExporter exporter, int maxQueueSize = 2048, int scheduledDelayMilliseconds = 5000, int exporterTimeoutMilliseconds = 30000, int maxExportBatchSize = 512) -> void OpenTelemetry.BatchExportProcessorOptions @@ -33,6 +35,8 @@ OpenTelemetry.BatchExportProcessorOptions.MaxQueueSize.get -> int OpenTelemetry.BatchExportProcessorOptions.MaxQueueSize.set -> void OpenTelemetry.BatchExportProcessorOptions.ScheduledDelayMilliseconds.get -> int OpenTelemetry.BatchExportProcessorOptions.ScheduledDelayMilliseconds.set -> void +OpenTelemetry.BatchLogRecordExportProcessor +OpenTelemetry.BatchLogRecordExportProcessor.BatchLogRecordExportProcessor(OpenTelemetry.BaseExporter exporter, int maxQueueSize = 2048, int scheduledDelayMilliseconds = 5000, int exporterTimeoutMilliseconds = 30000, int maxExportBatchSize = 512) -> void OpenTelemetry.CompositeProcessor OpenTelemetry.CompositeProcessor.AddProcessor(OpenTelemetry.BaseProcessor processor) -> OpenTelemetry.CompositeProcessor OpenTelemetry.CompositeProcessor.CompositeProcessor(System.Collections.Generic.IEnumerable> processors) -> void @@ -149,8 +153,12 @@ OpenTelemetry.Resources.ResourceBuilder.Build() -> OpenTelemetry.Resources.Resou OpenTelemetry.Resources.ResourceBuilder.Clear() -> OpenTelemetry.Resources.ResourceBuilder OpenTelemetry.Resources.ResourceBuilderExtensions OpenTelemetry.Sdk +OpenTelemetry.SimpleActivityExportProcessor +OpenTelemetry.SimpleActivityExportProcessor.SimpleActivityExportProcessor(OpenTelemetry.BaseExporter exporter) -> void OpenTelemetry.SimpleExportProcessor OpenTelemetry.SimpleExportProcessor.SimpleExportProcessor(OpenTelemetry.BaseExporter exporter) -> void +OpenTelemetry.SimpleLogRecordExportProcessor +OpenTelemetry.SimpleLogRecordExportProcessor.SimpleLogRecordExportProcessor(OpenTelemetry.BaseExporter exporter) -> void OpenTelemetry.SuppressInstrumentationScope OpenTelemetry.SuppressInstrumentationScope.Dispose() -> void OpenTelemetry.Trace.AlwaysOffSampler @@ -198,7 +206,9 @@ abstract OpenTelemetry.Metrics.Export.MetricProcessor.FinishCollectionCycle(out abstract OpenTelemetry.Metrics.Export.MetricProcessor.Process(OpenTelemetry.Metrics.Export.Metric metric) -> void abstract OpenTelemetry.Trace.Sampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult override OpenTelemetry.BaseExportProcessor.Dispose(bool disposing) -> void +override OpenTelemetry.BaseExportProcessor.OnEnd(T data) -> void override OpenTelemetry.BaseExportProcessor.OnShutdown(int timeoutMilliseconds) -> bool +override OpenTelemetry.BatchActivityExportProcessor.OnEnd(System.Diagnostics.Activity data) -> void override OpenTelemetry.BatchExportProcessor.OnExport(T data) -> void override OpenTelemetry.BatchExportProcessor.OnForceFlush(int timeoutMilliseconds) -> bool override OpenTelemetry.BatchExportProcessor.OnShutdown(int timeoutMilliseconds) -> bool @@ -233,6 +243,7 @@ override OpenTelemetry.Metrics.Aggregators.Int64MeasureMinMaxSumCountAggregator. override OpenTelemetry.Metrics.Aggregators.Int64MeasureMinMaxSumCountAggregator.Update(long value) -> void override OpenTelemetry.Metrics.Export.UngroupedBatcher.FinishCollectionCycle(out System.Collections.Generic.IEnumerable metrics) -> void override OpenTelemetry.Metrics.Export.UngroupedBatcher.Process(OpenTelemetry.Metrics.Export.Metric metric) -> void +override OpenTelemetry.SimpleActivityExportProcessor.OnEnd(System.Diagnostics.Activity data) -> void override OpenTelemetry.SimpleExportProcessor.OnExport(T data) -> void override OpenTelemetry.Trace.AlwaysOffSampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult override OpenTelemetry.Trace.AlwaysOnSampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult @@ -241,7 +252,6 @@ override OpenTelemetry.Trace.SamplingResult.Equals(object obj) -> bool override OpenTelemetry.Trace.SamplingResult.GetHashCode() -> int override OpenTelemetry.Trace.TraceIdRatioBasedSampler.ShouldSample(in OpenTelemetry.Trace.SamplingParameters samplingParameters) -> OpenTelemetry.Trace.SamplingResult abstract OpenTelemetry.BaseExportProcessor.OnExport(T data) -> void -override sealed OpenTelemetry.BaseExportProcessor.OnEnd(T data) -> void override sealed OpenTelemetry.BaseExportProcessor.OnStart(T data) -> void readonly OpenTelemetry.BaseExportProcessor.exporter -> OpenTelemetry.BaseExporter static Microsoft.Extensions.Logging.OpenTelemetryLoggingExtensions.AddOpenTelemetry(this Microsoft.Extensions.Logging.ILoggingBuilder builder, System.Action configure = null) -> Microsoft.Extensions.Logging.ILoggingBuilder diff --git a/src/OpenTelemetry/BaseExportProcessor.cs b/src/OpenTelemetry/BaseExportProcessor.cs index ca771a5fdce..abdc00416ea 100644 --- a/src/OpenTelemetry/BaseExportProcessor.cs +++ b/src/OpenTelemetry/BaseExportProcessor.cs @@ -49,8 +49,6 @@ public override void OnEnd(T data) this.OnExport(data); } - protected abstract void OnExport(T data); - internal override void SetParentProvider(BaseProvider parentProvider) { base.SetParentProvider(parentProvider); @@ -58,6 +56,8 @@ internal override void SetParentProvider(BaseProvider parentProvider) this.exporter.ParentProvider = parentProvider; } + protected abstract void OnExport(T data); + /// protected override bool OnShutdown(int timeoutMilliseconds) { diff --git a/src/OpenTelemetry/BatchLogRecordExportProcessor.cs b/src/OpenTelemetry/BatchLogRecordExportProcessor.cs index 6c361b5840d..96cc35bc84f 100644 --- a/src/OpenTelemetry/BatchLogRecordExportProcessor.cs +++ b/src/OpenTelemetry/BatchLogRecordExportProcessor.cs @@ -34,7 +34,6 @@ public BatchLogRecordExportProcessor( exporterTimeoutMilliseconds, maxExportBatchSize) { - } } } diff --git a/test/OpenTelemetry.Tests/Shared/TestActivityExportProcessor.cs b/test/OpenTelemetry.Tests/Shared/TestActivityExportProcessor.cs index e506c69e231..64894b6cf1d 100644 --- a/test/OpenTelemetry.Tests/Shared/TestActivityExportProcessor.cs +++ b/test/OpenTelemetry.Tests/Shared/TestActivityExportProcessor.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); From 65bb2ca89449a4b3a979caab3ec59673175f4acb Mon Sep 17 00:00:00 2001 From: Utkarsh Umesan Pillai Date: Tue, 15 Dec 2020 12:57:43 -0800 Subject: [PATCH 3/5] Updated the README to use SimpleActivityExportProcessor instead of SimpleExportProcessor --- docs/trace/extending-the-sdk/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/trace/extending-the-sdk/README.md b/docs/trace/extending-the-sdk/README.md index e7af9a80f39..d1f48c1473e 100644 --- a/docs/trace/extending-the-sdk/README.md +++ b/docs/trace/extending-the-sdk/README.md @@ -221,7 +221,7 @@ register the exporter, they must be registered manually as shown below: .SetSampler(new MySampler()) .AddSource("OTel.Demo") .AddProcessor(new MyFilteringProcessor( - new SimpleExportProcessor(new MyExporter("ExporterX")), + new SimpleActivityExportProcessor(new MyExporter("ExporterX")), (act) => true)) .Build(); ``` From 0fde29bc584d387ebd8f7f71392e776fae601f20 Mon Sep 17 00:00:00 2001 From: Utkarsh Umesan Pillai Date: Wed, 6 Jan 2021 11:14:16 -0800 Subject: [PATCH 4/5] Updated CHANGELOG.md --- src/OpenTelemetry/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/OpenTelemetry/CHANGELOG.md b/src/OpenTelemetry/CHANGELOG.md index 5bc3778c4a9..5dd4a38b871 100644 --- a/src/OpenTelemetry/CHANGELOG.md +++ b/src/OpenTelemetry/CHANGELOG.md @@ -13,6 +13,10 @@ [#1501](https://github.com/open-telemetry/opentelemetry-dotnet/issues/1501) for more information. ([#1611](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1611)) +* Modified SimpleExportProcessor and BatchExportProcessor to abstract classes; + Added SimpleActivityExportProcessor, SimpleLogRecordExportProcessor, + BatchActivityExportProcessor, BatchLogRecordExportProcessor + ([#1622](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1622)) ## 1.0.0-rc1.1 From a49d96e091d99ee0a5c955ae32bd8707298e896c Mon Sep 17 00:00:00 2001 From: Utkarsh Umesan Pillai Date: Wed, 6 Jan 2021 11:15:39 -0800 Subject: [PATCH 5/5] Updated CHANGELOG.md --- src/OpenTelemetry/CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/OpenTelemetry/CHANGELOG.md b/src/OpenTelemetry/CHANGELOG.md index 5dd4a38b871..0def4ff5982 100644 --- a/src/OpenTelemetry/CHANGELOG.md +++ b/src/OpenTelemetry/CHANGELOG.md @@ -15,7 +15,9 @@ ([#1611](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1611)) * Modified SimpleExportProcessor and BatchExportProcessor to abstract classes; Added SimpleActivityExportProcessor, SimpleLogRecordExportProcessor, - BatchActivityExportProcessor, BatchLogRecordExportProcessor + BatchActivityExportProcessor, BatchLogRecordExportProcessor; Added the check + for Activity.Recorded in SimpleActivityExportProcessor and + BatchActivityExportProcessor ([#1622](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1622)) ## 1.0.0-rc1.1