Пример #1
0
        /// <summary>Snippet for CreateSpanAsync</summary>
        public async Task CreateSpanRequestObjectAsync()
        {
            // Snippet: CreateSpanAsync(Span, CallSettings)
            // Additional: CreateSpanAsync(Span, CancellationToken)
            // Create client
            TraceServiceClient traceServiceClient = await TraceServiceClient.CreateAsync();

            // Initialize request argument(s)
            Span request = new Span
            {
                SpanName                = SpanName.FromProjectTraceSpan("[PROJECT]", "[TRACE]", "[SPAN]"),
                SpanId                  = "",
                ParentSpanId            = "",
                DisplayName             = new TruncatableString(),
                StartTime               = new Timestamp(),
                EndTime                 = new Timestamp(),
                Attributes              = new Span.Types.Attributes(),
                StackTrace              = new StackTrace(),
                TimeEvents              = new Span.Types.TimeEvents(),
                Links                   = new Span.Types.Links(),
                Status                  = new Status(),
                SameProcessAsParentSpan = false,
                ChildSpanCount          = 0,
            };
            // Make the request
            Span response = await traceServiceClient.CreateSpanAsync(request);

            // End snippet
        }
        /// <summary>Snippet for CreateSpanAsync</summary>
        public async Task CreateSpanAsync_RequestObject()
        {
            // Snippet: CreateSpanAsync(Span,CallSettings)
            // Create client
            TraceServiceClient traceServiceClient = await TraceServiceClient.CreateAsync();

            // Initialize request argument(s)
            Span request = new Span
            {
                SpanName    = new SpanName("[PROJECT]", "[TRACE]", "[SPAN]"),
                SpanId      = "",
                DisplayName = new TruncatableString(),
                StartTime   = new Timestamp(),
                EndTime     = new Timestamp(),
            };
            // Make the request
            Span response = await traceServiceClient.CreateSpanAsync(request);

            // End snippet
        }