github.com/kiali/kiali@v1.84.0/tracing/jaeger/model/json/model.go (about)

     1  // Copyright (c) 2019 The Jaeger Authors.
     2  // Copyright (c) 2017 Uber Technologies, Inc.
     3  //
     4  // Licensed under the Apache License, Version 2.0 (the "License");
     5  // you may not use this file except in compliance with the License.
     6  // You may obtain a copy of the License at
     7  //
     8  // http://www.apache.org/licenses/LICENSE-2.0
     9  //
    10  // Unless required by applicable law or agreed to in writing, software
    11  // distributed under the License is distributed on an "AS IS" BASIS,
    12  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  // See the License for the specific language governing permissions and
    14  // limitations under the License.
    15  
    16  package json
    17  
    18  // ReferenceType is the reference type of one span to another
    19  type ReferenceType string
    20  
    21  // TraceID is the shared trace ID of all spans in the trace.
    22  type TraceID string
    23  
    24  // SpanID is the id of a span
    25  type SpanID string
    26  
    27  // ProcessID is a hashed value of the Process struct that is unique within the trace.
    28  type ProcessID string
    29  
    30  // ValueType is the type of a value stored in KeyValue struct.
    31  type ValueType string
    32  
    33  const (
    34  	// ChildOf means a span is the child of another span
    35  	ChildOf ReferenceType = "CHILD_OF"
    36  	// FollowsFrom means a span follows from another span
    37  	FollowsFrom ReferenceType = "FOLLOWS_FROM"
    38  
    39  	// StringType indicates a string value stored in KeyValue
    40  	StringType ValueType = "string"
    41  	// BoolType indicates a Boolean value stored in KeyValue
    42  	BoolType ValueType = "bool"
    43  	// Int64Type indicates a 64bit signed integer value stored in KeyValue
    44  	Int64Type ValueType = "int64"
    45  	// Float64Type indicates a 64bit float value stored in KeyValue
    46  	Float64Type ValueType = "float64"
    47  	// BinaryType indicates an arbitrary byte array stored in KeyValue
    48  	BinaryType ValueType = "binary"
    49  )
    50  
    51  // Trace is a list of spans
    52  type Trace struct {
    53  	TraceID   TraceID               `json:"traceID"`
    54  	Spans     []Span                `json:"spans"`
    55  	Processes map[ProcessID]Process `json:"processes"`
    56  	Warnings  []string              `json:"warnings"`
    57  	Matched   int                   `json:"matched"`
    58  }
    59  
    60  // Span is a span denoting a piece of work in some infrastructure
    61  // When converting to UI model, ParentSpanID and Process should be dereferenced into
    62  // References and ProcessID, respectively.
    63  // When converting to ES model, ProcessID and Warnings should be omitted. Even if
    64  // included, ES with dynamic settings off will automatically ignore unneeded fields.
    65  type Span struct {
    66  	TraceID       TraceID     `json:"traceID"`
    67  	SpanID        SpanID      `json:"spanID"`
    68  	ParentSpanID  SpanID      `json:"parentSpanID,omitempty"` // deprecated
    69  	Flags         uint32      `json:"flags,omitempty"`
    70  	OperationName string      `json:"operationName"`
    71  	References    []Reference `json:"references"`
    72  	StartTime     uint64      `json:"startTime"` // microseconds since Unix epoch
    73  	Duration      uint64      `json:"duration"`  // microseconds
    74  	Tags          []KeyValue  `json:"tags"`
    75  	Logs          []Log       `json:"logs"`
    76  	ProcessID     ProcessID   `json:"processID,omitempty"`
    77  	Process       *Process    `json:"process,omitempty"`
    78  	Warnings      []string    `json:"warnings"`
    79  }
    80  
    81  // Reference is a reference from one span to another
    82  type Reference struct {
    83  	RefType ReferenceType `json:"refType"`
    84  	TraceID TraceID       `json:"traceID"`
    85  	SpanID  SpanID        `json:"spanID"`
    86  }
    87  
    88  // Process is the process emitting a set of spans
    89  type Process struct {
    90  	ServiceName string     `json:"serviceName"`
    91  	Tags        []KeyValue `json:"tags"`
    92  }
    93  
    94  // Log is a log emitted in a span
    95  type Log struct {
    96  	Timestamp uint64     `json:"timestamp"`
    97  	Fields    []KeyValue `json:"fields"`
    98  }
    99  
   100  // KeyValue is a key-value pair with typed value.
   101  type KeyValue struct {
   102  	Key   string      `json:"key"`
   103  	Type  ValueType   `json:"type,omitempty"`
   104  	Value interface{} `json:"value"`
   105  }
   106  
   107  // DependencyLink shows dependencies between services
   108  type DependencyLink struct {
   109  	Parent    string `json:"parent"`
   110  	Child     string `json:"child"`
   111  	CallCount uint64 `json:"callCount"`
   112  }
   113  
   114  // Operation defines the data in the operation response when query operation by service and span kind
   115  type Operation struct {
   116  	Name     string `json:"name"`
   117  	SpanKind string `json:"spanKind"`
   118  }