Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Exporter type to Zipkin exporter options #1504

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
OpenTelemetry.Exporter.Zipkin.ZipkinExporter
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.BatchExportProcessorOptions.get -> OpenTelemetry.BatchExportProcessorOptions<System.Diagnostics.Activity>
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.BatchExportProcessorOptions.set -> void
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.Endpoint.get -> System.Uri
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.Endpoint.set -> void
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.ExportProcessorType.get -> OpenTelemetry.ExportProcessorType
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.ExportProcessorType.set -> void
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.ServiceName.get -> string
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.ServiceName.set -> void
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.UseShortTraceIds.get -> bool
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
OpenTelemetry.Exporter.Zipkin.ZipkinExporter
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.BatchExportProcessorOptions.get -> OpenTelemetry.BatchExportProcessorOptions<System.Diagnostics.Activity>
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.BatchExportProcessorOptions.set -> void
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.Endpoint.get -> System.Uri
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.Endpoint.set -> void
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.ExportProcessorType.get -> OpenTelemetry.ExportProcessorType
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.ExportProcessorType.set -> void
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.MaxPayloadSizeInBytes.get -> int?
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.MaxPayloadSizeInBytes.set -> void
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.ServiceName.get -> string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
OpenTelemetry.Exporter.Zipkin.ZipkinExporter
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.BatchExportProcessorOptions.get -> OpenTelemetry.BatchExportProcessorOptions<System.Diagnostics.Activity>
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.BatchExportProcessorOptions.set -> void
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.Endpoint.get -> System.Uri
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.Endpoint.set -> void
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.ExportProcessorType.get -> OpenTelemetry.ExportProcessorType
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.ExportProcessorType.set -> void
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.MaxPayloadSizeInBytes.get -> int?
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.MaxPayloadSizeInBytes.set -> void
OpenTelemetry.Exporter.Zipkin.ZipkinExporterOptions.ServiceName.get -> string
Expand Down
2 changes: 2 additions & 0 deletions src/OpenTelemetry.Exporter.Zipkin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

* Added ExportProcessorType to exporter options
([#1504](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1504))
* Zipkin tags used for InstrumentationLibrary changed from library.name,
library.version to otel.library.name, otel.library.version respectively.
* Sending `service.namespace` as Zipkin tag.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,19 @@ public static TracerProviderBuilder AddZipkinExporter(this TracerProviderBuilder
configure?.Invoke(exporterOptions);
var zipkinExporter = new ZipkinExporter(exporterOptions);

// TODO: Pick Simple vs Batching based on ZipkinExporterOptions
return builder.AddProcessor(new BatchExportProcessor<Activity>(zipkinExporter));
if (exporterOptions.ExportProcessorType == ExportProcessorType.Simple)
{
return builder.AddProcessor(new SimpleExportProcessor<Activity>(zipkinExporter));
utpilla marked this conversation as resolved.
Show resolved Hide resolved
}
else
{
return builder.AddProcessor(new BatchExportProcessor<Activity>(
zipkinExporter,
exporterOptions.BatchExportProcessorOptions.MaxQueueSize,
exporterOptions.BatchExportProcessorOptions.ScheduledDelayMilliseconds,
exporterOptions.BatchExportProcessorOptions.ExporterTimeoutMilliseconds,
exporterOptions.BatchExportProcessorOptions.MaxExportBatchSize));
}
}
}
}
11 changes: 11 additions & 0 deletions src/OpenTelemetry.Exporter.Zipkin/ZipkinExporterOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// </copyright>

using System;
using System.Diagnostics;

namespace OpenTelemetry.Exporter.Zipkin
{
Expand Down Expand Up @@ -51,5 +52,15 @@ public sealed class ZipkinExporterOptions
/// </summary>
public int? MaxPayloadSizeInBytes { get; set; } = DefaultMaxPayloadSizeInBytes;
#endif

/// <summary>
/// Gets or sets the export processor type to be used with Zipkin Exporter.
/// </summary>
public ExportProcessorType ExportProcessorType { get; set; } = ExportProcessorType.Batch;

/// <summary>
/// Gets or sets the BatchExportProcessor options. Ignored unless ExportProcessorType is BatchExporter.
/// </summary>
public BatchExportProcessorOptions<Activity> BatchExportProcessorOptions { get; set; } = new BatchExportProcessorOptions<Activity>();
}
}
13 changes: 13 additions & 0 deletions src/OpenTelemetry/.publicApi/net452/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,22 @@ OpenTelemetry.Batch<T>.Enumerator.Reset() -> void
OpenTelemetry.Batch<T>.GetEnumerator() -> OpenTelemetry.Batch<T>.Enumerator
OpenTelemetry.BatchExportProcessor<T>
OpenTelemetry.BatchExportProcessor<T>.BatchExportProcessor(OpenTelemetry.BaseExporter<T> exporter, int maxQueueSize = 2048, int scheduledDelayMilliseconds = 5000, int exporterTimeoutMilliseconds = 30000, int maxExportBatchSize = 512) -> void
OpenTelemetry.BatchExportProcessorOptions<T>
OpenTelemetry.BatchExportProcessorOptions<T>.BatchExportProcessorOptions() -> void
OpenTelemetry.BatchExportProcessorOptions<T>.ExporterTimeoutMilliseconds.get -> int
OpenTelemetry.BatchExportProcessorOptions<T>.ExporterTimeoutMilliseconds.set -> void
OpenTelemetry.BatchExportProcessorOptions<T>.MaxExportBatchSize.get -> int
OpenTelemetry.BatchExportProcessorOptions<T>.MaxExportBatchSize.set -> void
OpenTelemetry.BatchExportProcessorOptions<T>.MaxQueueSize.get -> int
OpenTelemetry.BatchExportProcessorOptions<T>.MaxQueueSize.set -> void
OpenTelemetry.BatchExportProcessorOptions<T>.ScheduledDelayMilliseconds.get -> int
OpenTelemetry.BatchExportProcessorOptions<T>.ScheduledDelayMilliseconds.set -> void
OpenTelemetry.CompositeProcessor<T>
OpenTelemetry.CompositeProcessor<T>.AddProcessor(OpenTelemetry.BaseProcessor<T> processor) -> OpenTelemetry.CompositeProcessor<T>
OpenTelemetry.CompositeProcessor<T>.CompositeProcessor(System.Collections.Generic.IEnumerable<OpenTelemetry.BaseProcessor<T>> processors) -> void
OpenTelemetry.ExportProcessorType
OpenTelemetry.ExportProcessorType.Batch = 1 -> OpenTelemetry.ExportProcessorType
OpenTelemetry.ExportProcessorType.Simple = 0 -> OpenTelemetry.ExportProcessorType
OpenTelemetry.ExportResult
OpenTelemetry.ExportResult.Failure = 1 -> OpenTelemetry.ExportResult
OpenTelemetry.ExportResult.Success = 0 -> OpenTelemetry.ExportResult
Expand Down
13 changes: 13 additions & 0 deletions src/OpenTelemetry/.publicApi/net46/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,22 @@ OpenTelemetry.Batch<T>.Enumerator.Reset() -> void
OpenTelemetry.Batch<T>.GetEnumerator() -> OpenTelemetry.Batch<T>.Enumerator
OpenTelemetry.BatchExportProcessor<T>
OpenTelemetry.BatchExportProcessor<T>.BatchExportProcessor(OpenTelemetry.BaseExporter<T> exporter, int maxQueueSize = 2048, int scheduledDelayMilliseconds = 5000, int exporterTimeoutMilliseconds = 30000, int maxExportBatchSize = 512) -> void
OpenTelemetry.BatchExportProcessorOptions<T>
OpenTelemetry.BatchExportProcessorOptions<T>.BatchExportProcessorOptions() -> void
OpenTelemetry.BatchExportProcessorOptions<T>.ExporterTimeoutMilliseconds.get -> int
OpenTelemetry.BatchExportProcessorOptions<T>.ExporterTimeoutMilliseconds.set -> void
OpenTelemetry.BatchExportProcessorOptions<T>.MaxExportBatchSize.get -> int
OpenTelemetry.BatchExportProcessorOptions<T>.MaxExportBatchSize.set -> void
OpenTelemetry.BatchExportProcessorOptions<T>.MaxQueueSize.get -> int
OpenTelemetry.BatchExportProcessorOptions<T>.MaxQueueSize.set -> void
OpenTelemetry.BatchExportProcessorOptions<T>.ScheduledDelayMilliseconds.get -> int
OpenTelemetry.BatchExportProcessorOptions<T>.ScheduledDelayMilliseconds.set -> void
OpenTelemetry.CompositeProcessor<T>
OpenTelemetry.CompositeProcessor<T>.AddProcessor(OpenTelemetry.BaseProcessor<T> processor) -> OpenTelemetry.CompositeProcessor<T>
OpenTelemetry.CompositeProcessor<T>.CompositeProcessor(System.Collections.Generic.IEnumerable<OpenTelemetry.BaseProcessor<T>> processors) -> void
OpenTelemetry.ExportProcessorType
OpenTelemetry.ExportProcessorType.Batch = 1 -> OpenTelemetry.ExportProcessorType
OpenTelemetry.ExportProcessorType.Simple = 0 -> OpenTelemetry.ExportProcessorType
OpenTelemetry.ExportResult
OpenTelemetry.ExportResult.Failure = 1 -> OpenTelemetry.ExportResult
OpenTelemetry.ExportResult.Success = 0 -> OpenTelemetry.ExportResult
Expand Down
13 changes: 13 additions & 0 deletions src/OpenTelemetry/.publicApi/net461/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,22 @@ OpenTelemetry.Batch<T>.Enumerator.Reset() -> void
OpenTelemetry.Batch<T>.GetEnumerator() -> OpenTelemetry.Batch<T>.Enumerator
OpenTelemetry.BatchExportProcessor<T>
OpenTelemetry.BatchExportProcessor<T>.BatchExportProcessor(OpenTelemetry.BaseExporter<T> exporter, int maxQueueSize = 2048, int scheduledDelayMilliseconds = 5000, int exporterTimeoutMilliseconds = 30000, int maxExportBatchSize = 512) -> void
OpenTelemetry.BatchExportProcessorOptions<T>
OpenTelemetry.BatchExportProcessorOptions<T>.BatchExportProcessorOptions() -> void
OpenTelemetry.BatchExportProcessorOptions<T>.ExporterTimeoutMilliseconds.get -> int
OpenTelemetry.BatchExportProcessorOptions<T>.ExporterTimeoutMilliseconds.set -> void
OpenTelemetry.BatchExportProcessorOptions<T>.MaxExportBatchSize.get -> int
OpenTelemetry.BatchExportProcessorOptions<T>.MaxExportBatchSize.set -> void
OpenTelemetry.BatchExportProcessorOptions<T>.MaxQueueSize.get -> int
OpenTelemetry.BatchExportProcessorOptions<T>.MaxQueueSize.set -> void
OpenTelemetry.BatchExportProcessorOptions<T>.ScheduledDelayMilliseconds.get -> int
OpenTelemetry.BatchExportProcessorOptions<T>.ScheduledDelayMilliseconds.set -> void
OpenTelemetry.CompositeProcessor<T>
OpenTelemetry.CompositeProcessor<T>.AddProcessor(OpenTelemetry.BaseProcessor<T> processor) -> OpenTelemetry.CompositeProcessor<T>
OpenTelemetry.CompositeProcessor<T>.CompositeProcessor(System.Collections.Generic.IEnumerable<OpenTelemetry.BaseProcessor<T>> processors) -> void
OpenTelemetry.ExportProcessorType
OpenTelemetry.ExportProcessorType.Batch = 1 -> OpenTelemetry.ExportProcessorType
OpenTelemetry.ExportProcessorType.Simple = 0 -> OpenTelemetry.ExportProcessorType
OpenTelemetry.ExportResult
OpenTelemetry.ExportResult.Failure = 1 -> OpenTelemetry.ExportResult
OpenTelemetry.ExportResult.Success = 0 -> OpenTelemetry.ExportResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,22 @@ OpenTelemetry.Batch<T>.Enumerator.Reset() -> void
OpenTelemetry.Batch<T>.GetEnumerator() -> OpenTelemetry.Batch<T>.Enumerator
OpenTelemetry.BatchExportProcessor<T>
OpenTelemetry.BatchExportProcessor<T>.BatchExportProcessor(OpenTelemetry.BaseExporter<T> exporter, int maxQueueSize = 2048, int scheduledDelayMilliseconds = 5000, int exporterTimeoutMilliseconds = 30000, int maxExportBatchSize = 512) -> void
OpenTelemetry.BatchExportProcessorOptions<T>
OpenTelemetry.BatchExportProcessorOptions<T>.BatchExportProcessorOptions() -> void
OpenTelemetry.BatchExportProcessorOptions<T>.ExporterTimeoutMilliseconds.get -> int
OpenTelemetry.BatchExportProcessorOptions<T>.ExporterTimeoutMilliseconds.set -> void
OpenTelemetry.BatchExportProcessorOptions<T>.MaxExportBatchSize.get -> int
OpenTelemetry.BatchExportProcessorOptions<T>.MaxExportBatchSize.set -> void
OpenTelemetry.BatchExportProcessorOptions<T>.MaxQueueSize.get -> int
OpenTelemetry.BatchExportProcessorOptions<T>.MaxQueueSize.set -> void
OpenTelemetry.BatchExportProcessorOptions<T>.ScheduledDelayMilliseconds.get -> int
OpenTelemetry.BatchExportProcessorOptions<T>.ScheduledDelayMilliseconds.set -> void
OpenTelemetry.CompositeProcessor<T>
OpenTelemetry.CompositeProcessor<T>.AddProcessor(OpenTelemetry.BaseProcessor<T> processor) -> OpenTelemetry.CompositeProcessor<T>
OpenTelemetry.CompositeProcessor<T>.CompositeProcessor(System.Collections.Generic.IEnumerable<OpenTelemetry.BaseProcessor<T>> processors) -> void
OpenTelemetry.ExportProcessorType
OpenTelemetry.ExportProcessorType.Batch = 1 -> OpenTelemetry.ExportProcessorType
OpenTelemetry.ExportProcessorType.Simple = 0 -> OpenTelemetry.ExportProcessorType
OpenTelemetry.ExportResult
OpenTelemetry.ExportResult.Failure = 1 -> OpenTelemetry.ExportResult
OpenTelemetry.ExportResult.Success = 0 -> OpenTelemetry.ExportResult
Expand Down
13 changes: 9 additions & 4 deletions src/OpenTelemetry/BatchExportProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ namespace OpenTelemetry
public class BatchExportProcessor<T> : BaseExportProcessor<T>
where T : class
{
internal const int DefaultMaxQueueSize = 2048;
internal const int DefaultScheduledDelayMilliseconds = 5000;
internal const int DefaultExporterTimeoutMilliseconds = 30000;
internal const int DefaultMaxExportBatchSize = 512;

private readonly CircularBuffer<T> circularBuffer;
private readonly int scheduledDelayMilliseconds;
private readonly int exporterTimeoutMilliseconds;
Expand All @@ -49,10 +54,10 @@ public class BatchExportProcessor<T> : BaseExportProcessor<T>
/// <param name="maxExportBatchSize">The maximum batch size of every export. It must be smaller or equal to maxQueueSize. The default value is 512.</param>
public BatchExportProcessor(
BaseExporter<T> exporter,
int maxQueueSize = 2048,
int scheduledDelayMilliseconds = 5000,
int exporterTimeoutMilliseconds = 30000,
int maxExportBatchSize = 512)
int maxQueueSize = DefaultMaxQueueSize,
int scheduledDelayMilliseconds = DefaultScheduledDelayMilliseconds,
int exporterTimeoutMilliseconds = DefaultExporterTimeoutMilliseconds,
int maxExportBatchSize = DefaultMaxExportBatchSize)
: base(exporter)
{
if (maxQueueSize <= 0)
Expand Down
47 changes: 47 additions & 0 deletions src/OpenTelemetry/BatchExportProcessorOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// <copyright file="BatchExportProcessorOptions.cs" company="OpenTelemetry Authors">
// 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.
// </copyright>

using System;
using System.Diagnostics;
using System.Threading;
using OpenTelemetry.Internal;

namespace OpenTelemetry
{
public class BatchExportProcessorOptions<T>
where T : class
{
/// <summary>
/// Gets or sets the maximum queue size. The queue drops the data if the maximum size is reached. The default value is 2048.
/// </summary>
public int MaxQueueSize { get; set; } = BatchExportProcessor<T>.DefaultMaxQueueSize;

/// <summary>
/// Gets or sets the delay interval (in milliseconds) between two consecutive exports. The default value is 5000.
/// </summary>
public int ScheduledDelayMilliseconds { get; set; } = BatchExportProcessor<T>.DefaultScheduledDelayMilliseconds;

/// <summary>
/// Gets or sets the timeout (in milliseconds) after which the export is cancelled. The default value is 30000.
/// </summary>
public int ExporterTimeoutMilliseconds { get; set; } = BatchExportProcessor<T>.DefaultExporterTimeoutMilliseconds;

/// <summary>
/// Gets or sets the maximum batch size of every export. It must be smaller or equal to MaxQueueLength. The default value is 512.
/// </summary>
public int MaxExportBatchSize { get; set; } = BatchExportProcessor<T>.DefaultMaxExportBatchSize;
}
}
38 changes: 38 additions & 0 deletions src/OpenTelemetry/ExportProcessorType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// <copyright file="ExportProcessorType.cs" company="OpenTelemetry Authors">
// 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.
// </copyright>

namespace OpenTelemetry
{
/// <summary>
/// Type of Export Processor to be used.
/// </summary>
public enum ExportProcessorType
{
/// <summary>
/// Use SimpleExportProcessor.
/// Refer to the <a href="https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/sdk.md#simple-processor">
/// specification</a> for more information.
/// </summary>
Simple,

/// <summary>
/// Use BatchExportProcessor.
/// Refer to <a href="https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/sdk.md#batching-processor">
/// specification</a> for more information.
/// </summary>
Batch,
}
}