writer

package
v0.0.0-...-cc59c3f Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Replace   string = "replace"
	Keep      string = "keep"
	Drop      string = "drop"
	HashMod   string = "hashmod"
	LabelMap  string = "labelmap"
	LabelDrop string = "labeldrop"
	LabelKeep string = "labelkeep"
	Lowercase string = "lowercase"
	Uppercase string = "uppercase"
)

标签操作的常量

Variables

This section is empty.

Functions

func Process

func Process(labels []*prompb.Label, cfgs ...*pconf.RelabelConfig) []*prompb.Label

接收一组标签 []*prompb.Label 和一组重新标签配置 *pconf.RelabelConfig。 对标签应用指定的重新标签规则,并返回处理后的标签。

Types

type IdentQueue

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

标识队列

type LabelBuilder

type LabelBuilder struct {
	LabelSet map[string]string
}

构建新的标签集合

type SafeList

type SafeList struct {
	sync.RWMutex // 读写锁,安全访问列表
	L            *list.List
}

func NewSafeList

func NewSafeList() *SafeList

func (*SafeList) Len

func (sl *SafeList) Len() int

获取列表的长度

func (*SafeList) PopBack

func (sl *SafeList) PopBack(max int) []*prompb.TimeSeries

从列表的尾部弹出指定数量的元素,并返回 *prompb.TimeSeries 的切片

func (*SafeList) PushFront

func (sl *SafeList) PushFront(v interface{}) *list.Element

将一个元素插入到列表的头部,并返回插入的元素

func (*SafeList) PushFrontBatch

func (sl *SafeList) PushFrontBatch(vs []interface{})

将多个元素批量插入到列表的头部

func (*SafeList) RemoveAll

func (sl *SafeList) RemoveAll()

清空列表中的所有元素

type SafeListLimited

type SafeListLimited struct {
	SL *SafeList // 继承 SafeList
	// contains filtered or unexported fields
}

SafeList with Limited Size

func NewSafeListLimited

func NewSafeListLimited(maxSize int) *SafeListLimited

func (*SafeListLimited) Len

func (sll *SafeListLimited) Len() int

func (*SafeListLimited) PopBack

func (sll *SafeListLimited) PopBack(max int) []*prompb.TimeSeries

func (*SafeListLimited) PushFront

func (sll *SafeListLimited) PushFront(v interface{}) bool

func (*SafeListLimited) PushFrontBatch

func (sll *SafeListLimited) PushFrontBatch(vs []interface{}) bool

func (*SafeListLimited) RemoveAll

func (sll *SafeListLimited) RemoveAll()

type WriterType

type WriterType struct {
	Opts             pconf.WriterOptions // 配置信息,包括 URL、认证信息等。
	ForceUseServerTS bool                // 是否强制使用服务器时间戳
	Client           api.Client          // Prometheus 客户端,用于发送数据到远程目标
}

写入目标的配置信息和客户端

func (WriterType) Post

func (w WriterType) Post(req []byte, headers ...map[string]string) error

发送 HTTP POST 请求到远程目标

func (WriterType) Write

func (w WriterType) Write(items []*prompb.TimeSeries, sema *semaphore.Semaphore, headers ...map[string]string)

将时间序列数据写入远程目标,根据配置进行数据的重写和请求的发送

type WritersType

type WritersType struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

多个时间序列数据写入目标的集合

func NewWriters

func NewWriters(pushgwConfig pconf.Pushgw) *WritersType

func (*WritersType) CleanExpQueue

func (ws *WritersType) CleanExpQueue()

清理过期的标识队列

func (*WritersType) Init

func (ws *WritersType) Init() error

初始化时间序列数据写入目标,包括创建 Prometheus 客户端、设置 HTTP Transport 选项等

func (*WritersType) PushSample

func (ws *WritersType) PushSample(ident string, v interface{})

将时间序列数据推送到指定的目标队列

func (*WritersType) Put

func (ws *WritersType) Put(name string, writer WriterType)

func (*WritersType) StartConsumer

func (ws *WritersType) StartConsumer(identQueue *IdentQueue)

消费队列

Jump to

Keyboard shortcuts

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