suanliclient

package
v0.0.0-...-faa1211 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package suanliclient suanli client

Index

Constants

View Source
const (
	// LongDateTimeFormat long date time format
	LongDateTimeFormat = "2006-01-02 15:04:05"
	// LongDateTimeMminuteFormat long datetime minute format
	LongDateTimeMminuteFormat = "2006-01-02 15:04"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChartInfo

type ChartInfo struct {
	Title          string        `json:"title"`
	DetailDataList []*DetailData `json:"detail_data_list"`
}

ChartInfo chart info

func (*ChartInfo) ToSeries

func (c *ChartInfo) ToSeries(labels []prompb.Label, loc *time.Location) (*prompb.TimeSeries, error)

ToSeries to series

type Data

type Data struct {
	PageNum        int64             `json:"page_num"`
	MetricUnitDict map[string]string `json:"metric_unit_dict"`
	ChartInfoList  []*ChartInfo      `json:"chart_info"`
	TotalNum       int64             `json:"total_num"`
}

Data data

type DetailData

type DetailData struct {
	Current *float64 `json:"current"`
	Time    string   `json:"time"`
}

DetailData detail data

func (*DetailData) ToSample

func (d *DetailData) ToSample(loc *time.Location) (*prompb.Sample, error)

ToSample to sample

type Response

type Response struct {
	Msg  string `json:"msg"`
	Code int    `json:"code"`
	Data *Data  `json:"data"`
}

Response response

type SuanLiClient

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

SuanLiClient xxx

func NewSuanLiClient

func NewSuanLiClient(config *SuanLiConfig) (*SuanLiClient, error)

NewSuanLiClient xxx

func (*SuanLiClient) Loc

func (c *SuanLiClient) Loc() *time.Location

Loc xxx

func (*SuanLiClient) QueryInfo

func (c *SuanLiClient) QueryInfo(ctx context.Context, metricName string, tagFilters []*TagFilter, startTime,
	endTime int64) (*Response, error)

QueryInfo 分钟级监控数据

func (*SuanLiClient) QuerySecondInfo

func (c *SuanLiClient) QuerySecondInfo(ctx context.Context, metricName string, tagFilters []*TagFilter, startTime,
	endTime int64) (*Response, error)

QuerySecondInfo 秒级监控数据

type SuanLiConfig

type SuanLiConfig struct {
	ProjectName string `yaml:"project_name"`
	Host        string `yaml:"host"`
	Token       string `yaml:"token"`
	AppMark     string `yaml:"app_mark"`
	Env         string `yaml:"env"`
}

SuanLiConfig suanli config

type TagFilter

type TagFilter struct {
	Key   string   `json:"key"`
	Value []string `json:"value"`
}

TagFilter tag filter

Jump to

Keyboard shortcuts

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