prom

package
v6.7.3 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PromOptions = &PromOptionsStruct{Data: make(map[int64]PromOption)}

Data key is cluster name

Functions

This section is empty.

Types

type PromClientMap

type PromClientMap struct {
	sync.RWMutex

	ReaderClients map[int64]prom.API
	WriterClients map[int64]prom.WriterType
	// contains filtered or unexported fields
}

func NewPromClient

func NewPromClient(ctx *ctx.Context) *PromClientMap

func (*PromClientMap) Del

func (pc *PromClientMap) Del(datasourceId int64)

func (*PromClientMap) GetCli

func (pc *PromClientMap) GetCli(datasourceId int64) prom.API

func (*PromClientMap) GetDatasourceIds

func (pc *PromClientMap) GetDatasourceIds() []int64

func (*PromClientMap) GetWriterCli

func (pc *PromClientMap) GetWriterCli(datasourceId int64) prom.WriterType

func (*PromClientMap) Hit

func (pc *PromClientMap) Hit(datasourceIds []int64) []int64

Hit 根据当前有效的 datasourceId 和规则的 datasourceId 配置计算有效的cluster列表

func (*PromClientMap) InitReader

func (pc *PromClientMap) InitReader() error

func (*PromClientMap) IsNil

func (pc *PromClientMap) IsNil(datasourceId int64) bool

func (*PromClientMap) Reset

func (pc *PromClientMap) Reset()

func (*PromClientMap) Set

func (pc *PromClientMap) Set(datasourceId int64, r prom.API, w prom.WriterType)

type PromOption

type PromOption struct {
	ClusterName   string
	Url           string
	WriteAddr     string
	BasicAuthUser string
	BasicAuthPass string

	Timeout     int64
	DialTimeout int64

	MaxIdleConnsPerHost int

	Headers []string

	tlsx.ClientConfig
}

func (*PromOption) Equal

func (po *PromOption) Equal(target PromOption) bool

type PromOptionsStruct

type PromOptionsStruct struct {
	Data map[int64]PromOption
	sync.RWMutex
}

func (*PromOptionsStruct) Del

func (pos *PromOptionsStruct) Del(datasourceId int64)

func (*PromOptionsStruct) Get

func (pos *PromOptionsStruct) Get(datasourceId int64) (PromOption, bool)

func (*PromOptionsStruct) Set

func (pos *PromOptionsStruct) Set(datasourceId int64, po PromOption)

Jump to

Keyboard shortcuts

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