metric

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ModuleName = "metric.star"
View Source
const Name = "metric"
View Source
const StarlarkTimeFormat = "2006-01-02 15:04:05.999999999 -0700 MST"

Variables

View Source
var (
	ErrQueryArgs      = fmt.Errorf("usage metric.get_queries_by_instant(url,query,time)")
	ErrQueryRangeArgs = fmt.Errorf("usage metric.get_queries_by_range(url,query,start_time,end_time,step)")
	ErrMetaArgs       = fmt.Errorf("usage metric.get_metadata(url,type,match/label_name)")
	ErrData           = fmt.Errorf("can't parse data in response")
	ErrToken          = fmt.Errorf("token must set")
)
View Source
var Module = &starlarkstruct.Module{
	Name: "metric",
	Members: starlark.StringDict{
		"new": context.AddBuiltin("metric.new", New),
	},
}

Functions

func DoRequest

func DoRequest(req *http.Request, v interface{}, timeout int) error

func GetUrl

func GetUrl(urlHead, method string, param map[string]interface{}) (string, error)

func Marshal

func Marshal(d interface{}) (starlark.Value, error)

func New

func New(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func NewRequest

func NewRequest(method, url string, token string, body interface{}) (*http.Request, error)

Types

type ExemplarsData

type ExemplarsData struct {
	Data []ExemplarsItem `json:"data"`
	// contains filtered or unexported fields
}

type ExemplarsItem

type ExemplarsItem struct {
	SeriesLabels map[string]string        `json:"seriesLabels"`
	Exemplars    []map[string]interface{} `json:"exemplars"`
}

type Label

type Label struct {
	Data []string `json:"data"`
	// contains filtered or unexported fields
}

type LabelName

type LabelName struct {
	Data []string `json:"data"`
	// contains filtered or unexported fields
}

type Matrix

type Matrix struct {
	ResultList []MatrixItem `json:"result"`
	// contains filtered or unexported fields
}

type MatrixItem

type MatrixItem struct {
	Metric map[string]interface{} `json:"metric"`
	Values []interface{}          `json:"values"`
}

type Metric

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

func (*Metric) GetMetaData

func (metric *Metric) GetMetaData(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*Metric) GetQueriesByInstant

func (metric *Metric) GetQueriesByInstant(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*Metric) GetQueriesByRange

func (metric *Metric) GetQueriesByRange(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*Metric) GetRules

func (metric *Metric) GetRules(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*Metric) GetTarget

func (metric *Metric) GetTarget(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*Metric) Struct

func (t *Metric) Struct() *starlarkstruct.Struct

type Resp

type Resp struct {
	Status    string      `json:"status"`
	ErrorType string      `json:"errorType"`
	Error     string      `json:"error"`
	Data      interface{} `json:"data"`
}

type Scalars

type Scalars interface{}

type Series

type Series struct {
	Data []map[string]interface{} `json:"data"`
	// contains filtered or unexported fields
}

type UNIXTime

type UNIXTime float64

type Vector

type Vector struct {
	ResultList []VectorItem `json:"result"`
	// contains filtered or unexported fields
}

type VectorItem

type VectorItem struct {
	Metric map[string]interface{} `json:"metric"`
	Value  interface{}            `json:"value"`
}

Jump to

Keyboard shortcuts

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