api

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PodLifeStageMaxInterval = time.Duration(25e9)
)

Variables

View Source
var (
	ApiCalledCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "lunettes_api_called_counter",
			Help: "",
		},
		[]string{"apiname", "useragent", "ip"},
	)
)

Functions

func InitApi

func InitApi(endPoint string, username string, password string)

func QuerySloPodInfo

func QuerySloPodInfo(podUID string) []*xsearch.SloPodInfo

Types

type PerfRequest

type PerfRequest struct {
	// 查询开始时间时间戳(trace开始时间)
	StartTimestamp time.Time `json:"startTimestamp,omitempty"`
	// 查询结束时间时间戳
	FinishTimestamp time.Time `json:"finishTimestamp,omitempty"`
	Cluster         string    `json:"cluster,omitempty"`
	Namespace       string    `json:"namespace,omitempty"`
}

PerfRequest is request query parameters

type Server

type Server struct {
	Config   *ServerConfig
	ESClient *elastic.Client
}

Server is server to query trace stats

func NewAPIServer

func NewAPIServer(config *ServerConfig) (*Server, error)

NewAPIServer create new API server

func (*Server) StartServer

func (s *Server) StartServer(stopCh chan struct{})

StartServer start new api server

type ServerConfig

type ServerConfig struct {
	MetricsAddr string
	ESConfig    *xsearch.ElasticSearchConf
	ListenAddr  string
}

ServerConfig is configuration for api server

type SpanItem

type SpanItem struct {
	// 服务名
	Service string `json:"service,omitempty"`
	// 处理内容
	Operation       string    `json:"operation,omitempty"`
	StartTimestamp  time.Time `json:"startTimestamp,omitempty"`
	FinishTimestamp time.Time `json:"finishTimestamp,omitempty"`
	// 是否出错
	Error bool `json:"error,omitempty"`
	// 该span在总的trace中耗时的百分比
	DurationPercent float64 `json:"durationPercent,omitempty"`
}

SpanItem is one span in a trace

type TraceItem

type TraceItem struct {
	UID       string `json:"uid,omitempty"`
	Cluster   string `json:"cluster,omitempty"`
	Namespace string `json:"namespace,omitempty"`
	Name      string `json:"name,omitempty"`
	TraceType string `json:"traceType,omitempty"`
	// true 表示失败的trace
	Error bool `json:"error,omitempty"`
	// 失败原因
	FailedReason string `json:"failedReason,omitempty"`
	// 所属模块,network/storage/image/...
	Module          string    `json:"module,omitempty"`
	FailedMessage   string    `json:"failedMessage,omitempty"`
	StartTimestamp  time.Time `json:"startTimestamp,omitempty"`
	FinishTimestamp time.Time `json:"finishTimestamp,omitempty"`
	HostIP          string    `json:"hostIP,omitempty"`
	NodeName        string    `json:"nodeName,omitempty"`
	// 管理组件,直接创建的Pod为空
	OwnerType string `json:"ownerType,omitempty"`
	// jaeger里的trace id,可以直接拼接到jaeger ui的链接后面打开jaeger
	JaegerTraceID string `json:"jaegerTraceID,omitempty"`
	JaegerURL     string `json:"jaegerURL,omitempty"`
	// 是否为job类型的pod
	IsJob bool `json:"isJob,omitempty"`
	// 每个span的概要。
	Spans []SpanItem `json:"spans,omitempty"`
}

TraceItem is one trace item for a pod creation/deletion

type TraceRequest

type TraceRequest struct {
	// create/delete/start/stop/upgrade/update
	TraceType string `json:"traceType,omitempty"`
	// 查询开始时间时间戳(trace开始时间)
	StartTimestamp time.Time `json:"startTimestamp,omitempty"`
	// 查询结束时间时间戳
	FinishTimestamp time.Time `json:"finishTimestamp,omitempty"`
	Hostname        string    `json:"hostname,omitempty"`
	RequestID       string    `json:"requestID,omitempty"`
	// Pod's meta data
	UID       string `json:"uid,omitempty"`
	Cluster   string `json:"cluster,omitempty"`
	Namespace string `json:"namespace,omitempty"`
	Name      string `json:"name,omitempty"`
	Error     bool   `json:"error,omitempty"`
	HasError  string `json:"haserr,omitempty"`
}

TraceRequest is request query parameters

type TraceResponse

type TraceResponse []TraceItem

Response is response for query result

type WatchParam

type WatchParam struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL