Skip to content

Commit

Permalink
refactor: Remove unnecesary interface IManagedTracerFactory.
Browse files Browse the repository at this point in the history
It's an internal interface that we don't use anywhere. We can always add it back in if we need it at some point.
  • Loading branch information
amanda-tarafa committed May 24, 2021
1 parent a438215 commit bb0c7b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 33 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

using Google.Api.Gax;

using TraceProto = Google.Cloud.Trace.V1.Trace;

namespace Google.Cloud.Diagnostics.Common
Expand All @@ -24,7 +23,7 @@ namespace Google.Cloud.Diagnostics.Common
/// the needed context to determine the proper <see cref="IManagedTracer"/> then the given
/// <see cref="ITraceOptionsFactory"/> will decide.
/// </summary>
internal class ManagedTracerFactory : IManagedTracerFactory
internal class ManagedTracerFactory
{
private readonly string _projectId;
private readonly IConsumer<TraceProto> _consumer;
Expand All @@ -36,8 +35,8 @@ internal class ManagedTracerFactory : IManagedTracerFactory
/// </summary>
/// <param name="projectId">The Google Cloud Platform project ID. Must not be null.</param>
/// <param name="consumer">A trace consumer for the tracer. Must not be null.</param>
/// <param name="optionsFactory">An options factory to fall back to if the
/// <see cref="TraceHeaderContext"/> does not provide enough context. Must not be null.</param>
/// <param name="optionsFactory">An options factory to fall back to if the
/// <see cref="TraceHeaderContext"/> does not provide enough context. Must not be null.</param>
/// <param name="traceIdFactory">A trace Id factory. Must not be null.</param>
internal ManagedTracerFactory(
string projectId,
Expand All @@ -61,14 +60,14 @@ public IManagedTracer CreateTracer(TraceHeaderContext headerContext)
return NullManagedTracer.Instance;
}
var traceId = headerContext.TraceId ?? _traceIdFactory.NextId();
return SimpleManagedTracer.Create(_consumer, _projectId, traceId, headerContext.SpanId);
return SimpleManagedTracer.Create(_consumer, _projectId, traceId, headerContext.SpanId);
}

/// <summary>
/// True if the tracing should occur. Decision based on a <see cref="TraceHeaderContext"/>
/// and an <see cref="ITraceOptionsFactory"/>.
/// </summary>
internal bool ShouldTrace(TraceHeaderContext headerContext) =>
internal bool ShouldTrace(TraceHeaderContext headerContext) =>
headerContext.ShouldTrace ?? _optionsFactory.CreateOptions().ShouldTrace;
}
}

0 comments on commit bb0c7b2

Please sign in to comment.