promclient

package
v0.0.0-...-c91c74a Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package promclient prom client

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QueryInstantVector

func QueryInstantVector(ctx context.Context, rawURL string, header http.Header, promql string,
	t time.Time) (model.Vector, []string, error)

QueryInstantVector 查询实时数据

func QueryLabelValues

func QueryLabelValues(ctx context.Context, rawURL string, header http.Header,
	r *storepb.LabelValuesRequest) ([]string, error)

QueryLabelValues query label values

func QueryLabels

func QueryLabels(ctx context.Context, rawURL string, header http.Header,
	r *storepb.LabelNamesRequest) ([]string, error)

QueryLabels query labels

func QueryRangeMatrix

func QueryRangeMatrix(ctx context.Context, rawURL string, header http.Header, promql string, start time.Time,
	end time.Time, step time.Duration) (model.Matrix, []string, error)

QueryRangeMatrix 查询历史数据

Types

type BaseResponse

type BaseResponse struct {
	Status PromStatus `json:"status"`
	// Only set if status is "error".
	Error     string   `json:"error,omitempty"`
	ErrorType string   `json:"errorType,omitempty"`
	Warnings  []string `json:"warnings,omitempty"` // Extra field supported by Thanos Querier.
}

BaseResponse prometheus api response

func (BaseResponse) IsSuccess

func (r BaseResponse) IsSuccess() bool

IsSuccess check prometheus api is success

type LabelValuesResponse

type LabelValuesResponse struct {
	Data []string `json:"data"`
	BaseResponse
}

LabelValuesResponse label values response

type PromStatus

type PromStatus string

PromStatus prometheus api status

const (
	// PromSuccess prometheus api success
	PromSuccess PromStatus = "success"
	// PromError prometheus api error
	PromError PromStatus = "error"
)

type Result

type Result struct {
	Data ResultData `json:"data"`
	BaseResponse
}

Result xxx Decode only ResultType and load Result only as RawJson since we don't know structure of the Result yet.

func QueryInstant

func QueryInstant(ctx context.Context, rawURL string, header http.Header, promql string, t time.Time) (*Result, error)

QueryInstant 查询实时数据

func QueryRange

func QueryRange(ctx context.Context, rawURL string, header http.Header, promql string, start time.Time, end time.Time,
	step time.Duration) (*Result, error)

QueryRange 查询历史数据

type ResultData

type ResultData struct {
	ResultType string          `json:"resultType"`
	Result     json.RawMessage `json:"result"`
}

ResultData :

Jump to

Keyboard shortcuts

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