github.com/siglens/siglens@v0.0.0-20240328180423-f7ce9ae441ed/pkg/segment/tracing/structs/tracestruct.go (about)

     1  package structs
     2  
     3  type TraceResult struct {
     4  	Traces []*Trace `json:"traces"` // Results of Search Traces
     5  }
     6  
     7  type Trace struct {
     8  	TraceId         string `json:"trace_id"`
     9  	StartTime       uint64 `json:"start_time"`
    10  	EndTime         uint64 `json:"end_time"`
    11  	SpanCount       int    `json:"span_count"`
    12  	SpanErrorsCount int    `json:"span_errors_count"`
    13  	ServiceName     string `json:"service_name"`
    14  	OperationName   string `json:"operation_name"`
    15  }
    16  
    17  type Status_StatusCode string
    18  
    19  const (
    20  	// The default status.
    21  	Status_STATUS_CODE_UNSET Status_StatusCode = "STATUS_CODE_UNSET"
    22  	Status_STATUS_CODE_OK    Status_StatusCode = "STATUS_CODE_OK"
    23  	Status_STATUS_CODE_ERROR Status_StatusCode = "STATUS_CODE_ERROR"
    24  )
    25  
    26  type RawSpanData struct {
    27  	Hits RawSpanResponse `json:"hits"`
    28  }
    29  
    30  type RawSpanResponse struct {
    31  	Spans []*Span `json:"records"`
    32  }
    33  
    34  type Span struct {
    35  	TraceID      string `json:"trace_id"`
    36  	SpanID       string `json:"span_id"`
    37  	ParentSpanID string `json:"parent_span_id"`
    38  	StartTime    uint64 `json:"start_time"`
    39  	EndTime      uint64 `json:"end_time"`
    40  	Duration     uint64 `json:"duration"`
    41  	Status       string `json:"status"`
    42  	Service      string `json:"service"`
    43  }
    44  
    45  type RedMetrics struct {
    46  	Rate      float64 // Number of entry spans divided by 60 seconds
    47  	ErrorRate float64 // Percentage of entry spans that errored
    48  	P50       uint64  // p50, p90, p95, p99 latencies are calculated by the list of durations.
    49  	P90       uint64
    50  	P95       uint64
    51  	P99       uint64
    52  }
    53  
    54  // Accept the request body of search traces and act as the request body of the /api/search
    55  type SearchRequestBody struct {
    56  	IndexName     string `json:"indexName"`
    57  	SearchText    string `json:"searchText"`
    58  	StartEpoch    string `json:"startEpoch"`
    59  	EndEpoch      string `json:"endEpoch"`
    60  	QueryLanguage string `json:"queryLanguage"`
    61  	From          int    `json:"from,omitempty"`
    62  	Size          int    `json:"size,omitempty"`
    63  }
    64  
    65  type GanttChartSpan struct {
    66  	SpanID          string                 `json:"span_id"`
    67  	ActualStartTime uint64                 `json:"actual_start_time"`
    68  	StartTime       uint64                 `json:"start_time"`
    69  	EndTime         uint64                 `json:"end_time"`
    70  	Duration        uint64                 `json:"duration"`
    71  	ServiceName     string                 `json:"service_name"`
    72  	OperationName   string                 `json:"operation_name"`
    73  	IsAnomalous     bool                   `json:"is_anomalous"`
    74  	Tags            map[string]interface{} `json:"tags"`
    75  	Children        []*GanttChartSpan      `json:"children"`
    76  }