| // Copyright 2015 The Vanadium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| |
| package vtrace |
| |
| import ( |
| "time" |
| "v.io/v23/uniqueid" |
| ) |
| |
| type TraceRecord struct { |
| Id uniqueid.Id |
| Spans []SpanRecord |
| } |
| |
| // An Annotation represents data that is relevant at a specific moment. |
| // They can be attached to spans to add useful debugging information. |
| type Annotation struct { |
| // When the annotation was added. |
| When time.Time |
| |
| // The annotation message. |
| // TODO(mattr): Allow richer annotations. |
| Message string |
| } |
| |
| // A SpanRecord is the wire format for a Span. |
| type SpanRecord struct { |
| Id uniqueid.Id // The Id of the Span. |
| Parent uniqueid.Id // The Id of this Span's parent. |
| Name string // The Name of this span. |
| |
| Start time.Time // The start time of this span. |
| End time.Time // The end time of this span. |
| |
| // A series of annotations. |
| Annotations []Annotation |
| } |
| |
| type TraceFlags int32 |
| |
| const ( |
| Empty = TraceFlags(0) |
| CollectInMemory = TraceFlags(1) |
| ) |
| |
| // Request is the object that carries trace informtion between processes. |
| type Request struct { |
| SpanId uniqueid.Id // The Id of the span that originated the RPC call. |
| TraceId uniqueid.Id // The Id of the trace this call is a part of. |
| Flags TraceFlags |
| LogLevel int32 |
| } |
| |
| type Response struct { |
| // Flags give options for trace collection, the client should alter its |
| // collection for this trace according to the flags sent back from the |
| // server. |
| Flags TraceFlags |
| |
| // Trace is collected trace data. This may be empty. |
| Trace TraceRecord |
| } |