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
2 changes: 1 addition & 1 deletion src/Datadog.Trace.Tests/TracerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void StartActive_NoFinishOnClose_SpanIsNotFinishedWhenScopeIsClosed()
public void StartActive_SetParentManually_ParentIsSet()
{
var parent = _tracer.StartSpan("Parent");
var child = _tracer.StartActive("Child", parent: parent.Context);
var child = _tracer.StartActive("Child", childOf: parent.Context);

Assert.Equal(parent.Context, child.Span.Context.Parent);
}
Expand Down
16 changes: 8 additions & 8 deletions src/Datadog.Trace/Implementations/Tracer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,35 +94,35 @@ public Scope ActivateSpan(Span span, bool finishOnClose = true)
/// This is a shortcut for <see cref="StartSpan"/> and <see cref="ActivateSpan"/>, it creates a new span with the given parameters and makes it active.
/// </summary>
/// <param name="operationName">The span's operation name</param>
/// <param name="parent">The span's parent</param>
/// <param name="childOf">The span's parent</param>
/// <param name="serviceName">The span's service name</param>
/// <param name="startTime">An explicit start time for that span</param>
/// <param name="ignoreActiveScope">If set the span will not be a child of the currently active span</param>
/// <param name="finishOnClose">If set to false, closing the returned scope will not close the enclosed span </param>
/// <returns>A scope wrapping the newly created span</returns>
public Scope StartActive(string operationName, SpanContext parent = null, string serviceName = null, DateTimeOffset? startTime = null, bool ignoreActiveScope = false, bool finishOnClose = true)
public Scope StartActive(string operationName, SpanContext childOf = null, string serviceName = null, DateTimeOffset? startTime = null, bool ignoreActiveScope = false, bool finishOnClose = true)
{
var span = StartSpan(operationName, parent, serviceName, startTime, ignoreActiveScope);
var span = StartSpan(operationName, childOf, serviceName, startTime, ignoreActiveScope);
return _scopeManager.Activate(span, finishOnClose);
}

/// <summary>
/// This create a Span with the given parameters
/// </summary>
/// <param name="operationName">The span's operation name</param>
/// <param name="parent">The span's parent</param>
/// <param name="childOf">The span's parent</param>
/// <param name="serviceName">The span's service name</param>
/// <param name="startTime">An explicit start time for that span</param>
/// <param name="ignoreActiveScope">If set the span will not be a child of the currently active span</param>
/// <returns>The newly created span</returns>
public Span StartSpan(string operationName, SpanContext parent = null, string serviceName = null, DateTimeOffset? startTime = null, bool ignoreActiveScope = false)
public Span StartSpan(string operationName, SpanContext childOf = null, string serviceName = null, DateTimeOffset? startTime = null, bool ignoreActiveScope = false)
{
if (parent == null && !ignoreActiveScope)
if (childOf == null && !ignoreActiveScope)
{
parent = _scopeManager.Active?.Span?.Context;
childOf = _scopeManager.Active?.Span?.Context;
}

var span = new Span(this, parent, operationName, serviceName, startTime);
var span = new Span(this, childOf, operationName, serviceName, startTime);
span.TraceContext.AddSpan(span);
return span;
}
Expand Down