github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/util/tracing/recorded_span.proto (about) 1 // Copyright 2017 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 syntax = "proto3"; 12 package cockroach.util.tracing; 13 option go_package = "tracing"; 14 15 import "gogoproto/gogo.proto"; 16 import "google/protobuf/any.proto"; 17 import "google/protobuf/timestamp.proto"; 18 import "google/protobuf/duration.proto"; 19 20 // LogRecord is a log message recorded in a traced span. 21 message LogRecord { 22 // Time of the log record. 23 google.protobuf.Timestamp time = 1 [(gogoproto.nullable) = false, 24 (gogoproto.stdtime) = true]; 25 message Field { 26 string key = 1; 27 string value = 2; 28 } 29 // Fields with values converted to strings. 30 repeated Field fields = 2 [(gogoproto.nullable) = false]; 31 } 32 33 // RecordedSpan is a span that is part of a recording. It can be transferred 34 // over the wire for snowball tracing. 35 message RecordedSpan { 36 option (gogoproto.goproto_stringer) = false; 37 38 // ID of the trace; spans that are part of the same hierarchy share 39 // the same trace ID. 40 uint64 trace_id = 1 [(gogoproto.customname) = "TraceID"]; 41 // ID of the span. 42 uint64 span_id = 2 [(gogoproto.customname) = "SpanID"]; 43 // Span ID of the parent span. 44 uint64 parent_span_id = 3 [(gogoproto.customname) = "ParentSpanID"]; 45 // Operation name. 46 string operation = 4; 47 // Baggage items get passed from parent to child spans (even through gRPC). 48 // Notably, snowball tracing uses a special `sb` baggage item. 49 map<string, string> baggage = 5; 50 // Tags associated with the span. 51 map<string, string> tags = 6; 52 // Time when the span was started. 53 google.protobuf.Timestamp start_time = 7 [(gogoproto.nullable) = false, 54 (gogoproto.stdtime) = true]; 55 // Duration is the span's duration, measured from start to Finish(). 56 // 57 // A spans whose recording is collected before it's finished will have the 58 // duration set as the time of collection - start_time. Such a span will have 59 // an "unfinished" tag. 60 google.protobuf.Duration duration = 8 [(gogoproto.nullable) = false, 61 (gogoproto.stdduration) = true]; 62 63 // Events logged in the span. 64 repeated LogRecord logs = 9 [(gogoproto.nullable) = false]; 65 66 // Stats collected in this span. 67 google.protobuf.Any stats = 10; 68 } 69 70 // NormalizedSpan is a representation of a RecordedSpan from a trace with all 71 // its children embedded, recursively. This JSON serialization of this proto is 72 // used in the system.statement_diagnostics.trace column. 73 // 74 // See RecordedSpan for the description of the fields. 75 message NormalizedSpan { 76 string operation = 1; 77 map<string, string> tags = 2; 78 google.protobuf.Timestamp start_time = 3 [(gogoproto.nullable) = false, 79 (gogoproto.stdtime) = true]; 80 google.protobuf.Duration duration = 4 [(gogoproto.nullable) = false, 81 (gogoproto.stdduration) = true]; 82 repeated LogRecord logs = 5 [(gogoproto.nullable) = false]; 83 repeated NormalizedSpan children = 6 [(gogoproto.nullable) = false]; 84 }