Skip to content
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
1 change: 1 addition & 0 deletions src/OpenTelemetry/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

* Renaming `BroadcastActivityProcessor` to `FanOutActivityProcessor` (#1015)
* Introduce `SuppressInstrumentationScope` API (#988).
* `ActivityProcessor` implements `IDisposable`.
* When `Dispose` occurs, it calls `ShutdownAsync`.
Expand Down
2 changes: 1 addition & 1 deletion src/OpenTelemetry/Sdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static TracerProvider CreateTracerProvider(Action<TracerProviderBuilder>
processors[i] = tracerProviderBuilder.ProcessingPipelines[i].Build();
}

activityProcessor = new BroadcastActivityProcessor(processors);
activityProcessor = new FanOutActivityProcessor(processors);
}

tracerProviderSdk.Resource = tracerProviderBuilder.Resource;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="BroadcastActivityProcessor.cs" company="OpenTelemetry Authors">
// <copyright file="FanOutActivityProcessor.cs" company="OpenTelemetry Authors">
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -24,12 +24,12 @@

namespace OpenTelemetry.Trace.Internal
{
internal class BroadcastActivityProcessor : ActivityProcessor
internal class FanOutActivityProcessor : ActivityProcessor
{
private readonly IEnumerable<ActivityProcessor> processors;
private readonly List<ActivityProcessor> processors;
private bool disposed;

public BroadcastActivityProcessor(IEnumerable<ActivityProcessor> processors)
public FanOutActivityProcessor(IEnumerable<ActivityProcessor> processors)
{
if (processors == null)
{
Expand All @@ -41,7 +41,7 @@ public BroadcastActivityProcessor(IEnumerable<ActivityProcessor> processors)
throw new ArgumentException($"{nameof(processors)} collection is empty");
}

this.processors = processors;
this.processors = new List<ActivityProcessor>(processors);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we cast instead of creating a new. Earlier implementation of using IEnumerable was good. Is there a reason to change this to list?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue #980 points to a perf issue

Copy link
Copy Markdown
Member

@CodeBlanch CodeBlanch Aug 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My guess would be it was changed so that if the user changes it after the call, it won't impact us. But I like it because it will also save two allocations on every Activity (when doing the foreach in OnStart & OnEnd).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

public override void OnEnd(Activity activity)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="BroadcastActivityProcessorTests.cs" company="OpenTelemetry Authors">
// <copyright file="FanOutActivityProcessorTests.cs" company="OpenTelemetry Authors">
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -23,13 +23,13 @@

namespace OpenTelemetry.Tests.Impl.Trace.Config
{
public class BroadcastActivityProcessorTests
public class FanOutActivityProcessorTests
{
[Fact]
public void BroadcastProcessor_BadArgs()
{
Assert.Throws<ArgumentNullException>(() => new BroadcastActivityProcessor(null));
Assert.Throws<ArgumentException>(() => new BroadcastActivityProcessor(new SimpleActivityProcessor[0]));
Assert.Throws<ArgumentNullException>(() => new FanOutActivityProcessor(null));
Assert.Throws<ArgumentException>(() => new FanOutActivityProcessor(new SimpleActivityProcessor[0]));
}

[Fact]
Expand Down Expand Up @@ -68,7 +68,7 @@ public void BroadcastProcessor_CallsAllProcessorSequentially()
Assert.True(end1Called);
});

var broadcastProcessor = new BroadcastActivityProcessor(new[] { processor1, processor2 });
var broadcastProcessor = new FanOutActivityProcessor(new[] { processor1, processor2 });

var activity = new Activity("somename");
broadcastProcessor.OnStart(activity);
Expand Down Expand Up @@ -120,7 +120,7 @@ public void BroadcastProcessor_OneProcessorThrows()
Assert.True(end1Called);
});

var broadcastProcessor = new BroadcastActivityProcessor(new[] { processor1, processor2 });
var broadcastProcessor = new FanOutActivityProcessor(new[] { processor1, processor2 });

var activity = new Activity("somename");
broadcastProcessor.OnStart(activity);
Expand All @@ -138,7 +138,7 @@ public void BroadcastProcessor_ShutsDownAll()
var processor1 = new TestActivityProcessor(null, null);
var processor2 = new TestActivityProcessor(null, null);

var broadcastProcessor = new BroadcastActivityProcessor(new[] { processor1, processor2 });
var broadcastProcessor = new FanOutActivityProcessor(new[] { processor1, processor2 });

broadcastProcessor.ShutdownAsync(default);
Assert.True(processor1.ShutdownCalled);
Expand All @@ -155,7 +155,7 @@ public void BroadcastProcessor_ForceFlush()
var processor1 = new TestActivityProcessor(null, null);
var processor2 = new TestActivityProcessor(null, null);

var broadcastProcessor = new BroadcastActivityProcessor(new[] { processor1, processor2 });
var broadcastProcessor = new FanOutActivityProcessor(new[] { processor1, processor2 });

broadcastProcessor.ForceFlushAsync(default);
Assert.True(processor1.ForceFlushCalled);
Expand Down