Ejemplo n.º 1
0
        private void RunGetRequestedData(Activity activity)
        {
            var samplingParameters = new ActivitySamplingParameters(
                activity.Context,
                activity.TraceId,
                activity.DisplayName,
                activity.Kind,
                activity.Tags,
                activity.Links);

            var samplingDecision = this.activitySampler.ShouldSample(samplingParameters);

            activity.IsAllDataRequested = samplingDecision.IsSampled;
            if (samplingDecision.IsSampled)
            {
                activity.ActivityTraceFlags |= ActivityTraceFlags.Recorded;
            }
        }
Ejemplo n.º 2
0
        private void RunGetRequestedData(Activity activity)
        {
            ActivityContext parentContext;

            if (string.IsNullOrEmpty(activity.ParentId))
            {
                parentContext = default(ActivityContext);
            }
            else
            {
                if (activity.Parent != null)
                {
                    parentContext = activity.Parent.Context;
                }
                else
                {
                    parentContext = new ActivityContext(activity.TraceId, activity.ParentSpanId, activity.ActivityTraceFlags, activity.TraceStateString);

                    // TODO: once IsRemote is exposed on ActivityContext set parentContext's IsRemote=true
                }
            }

            var samplingParameters = new ActivitySamplingParameters(
                parentContext,
                activity.TraceId,
                activity.DisplayName,
                activity.Kind,
                activity.Tags,
                activity.Links);

            var samplingDecision = this.activitySampler.ShouldSample(samplingParameters);

            activity.IsAllDataRequested = samplingDecision.IsSampled;
            if (samplingDecision.IsSampled)
            {
                activity.ActivityTraceFlags |= ActivityTraceFlags.Recorded;
            }
        }