github.com/blend/go-sdk@v1.20220411.3/datadog/traceserver/span.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package traceserver
     9  
    10  type (
    11  	// SpanList implements msgp.Encodable on top of a slice of spans.
    12  	SpanList []*Span
    13  
    14  	// SpanLists implements msgp.Decodable on top of a slice of spanList.
    15  	// This type is only used in tests.
    16  	SpanLists []SpanList
    17  )
    18  
    19  // Span represents a computation. Callers must call Finish when a span is
    20  // complete to ensure it's submitted.
    21  type Span struct {
    22  	Name     string             `json:"name" msg:"name"`                           // operation name
    23  	Service  string             `json:"service" msg:"service"`                     // service name (i.e. "grpc.server", "http.request")
    24  	Resource string             `json:"resource" msg:"resource"`                   // resource name (i.e. "/user?id=123", "SELECT * FROM users")
    25  	Type     string             `json:"type" msg:"type"`                           // protocol associated with the span (i.e. "web", "db", "cache")
    26  	Start    int64              `json:"start" msg:"start"`                         // span start time expressed in nanoseconds since epoch
    27  	Duration int64              `json:"duration" msg:"duration"`                   // duration of the span expressed in nanoseconds
    28  	Meta     map[string]string  `json:"meta,omitempty" msg:"meta,omitempty"`       // arbitrary map of metadata
    29  	Metrics  map[string]float64 `json:"metrics,omitempty" msg:"metrics,omitempty"` // arbitrary map of numeric metrics
    30  	SpanID   uint64             `json:"span_id" msg:"span_id"`                     // identifier of this span
    31  	TraceID  uint64             `json:"trace_id" msg:"trace_id"`                   // identifier of the root span
    32  	ParentID uint64             `json:"parent_id" msg:"parent_id"`                 // identifier of the span's direct parent
    33  	Error    int32              `json:"error" msg:"error"`                         // error status of the span; 0 means no errors
    34  }