Пример #1
0
        /// <inheritdoc />
        public IManagedTracer CreateTracer(TraceHeaderContext headerContext)
        {
            GaxPreconditions.CheckNotNull(headerContext, nameof(headerContext));
            if (!ShouldTrace(headerContext))
            {
                return(NullManagedTracer.Instance);
            }
            var traceId = headerContext.TraceId ?? _traceIdFactory.NextId();

            return(SimpleManagedTracer.Create(_consumer, _projectId, traceId, headerContext.SpanId));
        }
Пример #2
0
        /// <inheritdoc />
        internal IManagedTracer CreateTracer(ITraceContext traceContext)
        {
            GaxPreconditions.CheckNotNull(traceContext, nameof(traceContext));
            if (!ShouldTrace(traceContext))
            {
                return(NullManagedTracer.Instance);
            }
            var traceId = traceContext.TraceId ?? _traceIdFactory.NextId();

            return(SimpleManagedTracer.Create(_consumer, _projectId, traceId, traceContext.SpanId));
        }
Пример #3
0
        /// <inheritdoc />
        public IManagedTracer CreateTracer(TraceHeaderContext headerContext)
        {
            GaxPreconditions.CheckNotNull(headerContext, nameof(headerContext));
            if (!ShouldTrace(headerContext))
            {
                return(DoNothingTracer.Instance);
            }

            TraceProto trace = new TraceProto
            {
                ProjectId = _projectId,
                TraceId   = headerContext.TraceId ?? _traceIdFactory.NextId(),
            };

            return(SimpleManagedTracer.Create(_consumer, trace, headerContext.SpanId));
        }