public void StartManula_ActiveScope_UseCurrentScopeAsParent() { var parentSpan = _tracer.StartSpan("Parent"); _tracer.ActivateSpan(parentSpan); var childSpan = _tracer.StartSpan("Child"); Assert.Equal(parentSpan.Context, childSpan.Context.Parent); }
/// <summary> /// Creates a scope for outbound http requests and populates some common details. /// </summary> /// <param name="tracer">The tracer instance to use to create the new scope.</param> /// <param name="httpMethod">The HTTP method used by the request.</param> /// <param name="requestUri">The URI requested by the request.</param> /// <param name="integrationId">The id of the integration creating this scope.</param> /// <param name="tags">The tags associated to the scope</param> /// <param name="traceId">The trace id - this id will be ignored if there's already an active trace</param> /// <param name="spanId">The span id</param> /// <param name="startTime">The start time that should be applied to the span</param> /// <returns>A new pre-populated scope.</returns> internal static Scope CreateOutboundHttpScope(Tracer tracer, string httpMethod, Uri requestUri, IntegrationId integrationId, out HttpTags tags, ulong?traceId = null, ulong?spanId = null, DateTimeOffset?startTime = null) { var span = CreateInactiveOutboundHttpSpan(tracer, httpMethod, requestUri, integrationId, out tags, traceId, spanId, startTime, addToTraceContext: true); if (span != null) { return(tracer.ActivateSpan(span)); } return(null); }