public ISpan Start()
        {
            Trace trace = CreateTrace();

            OtSpanKind spanKind = GetSpanKind();

            RecordAnnotation(trace, GetOpeningAnnotation(spanKind));

            RecordAnnotation(trace, Annotations.ServiceName(_tracer.ServiceName));
            RecordAnnotation(trace, Annotations.Rpc(_operationName));

            return(new OtSpan(trace, spanKind, _tags));
        }
示例#2
0
        public OtSpan(Trace trace, OtSpanKind spanKind, Dictionary <string, string> tags)
        {
            _spanKind = spanKind;
            Trace     = trace;
            Context   = new OtSpanContext(trace);

            if (tags != null)
            {
                foreach (var entry in tags)
                {
                    SetZipkinTag(entry.Key, entry.Value);
                }
            }
        }
示例#3
0
        private static IAnnotation GetClosingAnnotation(OtSpanKind spanKind)
        {
            switch (spanKind)
            {
            case OtSpanKind.Client:
                return(Annotations.ClientRecv());

            case OtSpanKind.Server:
                return(Annotations.ServerSend());

            case OtSpanKind.Local:
                return(Annotations.LocalOperationStop());

            default:
                throw new NotSupportedException("SpanKind: " + spanKind + " unknown.");
            }
        }
        private IAnnotation GetOpeningAnnotation(OtSpanKind spanKind)
        {
            switch (spanKind)
            {
            case OtSpanKind.Client:
                return(Annotations.ClientSend());

            case OtSpanKind.Server:
                return(Annotations.ServerRecv());

            case OtSpanKind.Local:
                return(Annotations.LocalOperationStart(_tracer.ServiceName));

            default:
                throw new NotSupportedException("SpanKind: " + spanKind + " unknown.");
            }
        }
示例#5
0
        public ISpan Start()
        {
            Trace trace = CreateTrace();

            OtSpanKind spanKind = GetSpanKind();

            RecordAnnotation(trace, GetOpeningAnnotation(spanKind));
            RecordAnnotation(trace, Annotations.ServiceName(_tracer.ServiceName));
            if (spanKind == OtSpanKind.Producer || spanKind == OtSpanKind.Consumer)
            {
                RecordAnnotation(trace, Annotations.Rpc(_operationName));
            }
            else
            {
                RecordAnnotation(trace, Annotations.Rpc(_operationName));
            }

            return(new OtSpan(trace, spanKind, _tags));
        }