sender

package
v0.0.0-...-701cacc Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSendQueueMaxSize      = 10240
	DefaultSendTaskSleepInterval = time.Millisecond * 50 //默认睡眠间隔为50ms
)

Variables

View Source
var BackendConstructors = []func(cfg *BackendConfig) Backend{
	newRiemannBackend,
	newInfluxdbBackend,
	newTsdbBackend,
	newTransferBackend,
}
View Source
var Backends = make([]Backend, 0, 5)

Functions

func Send

func Send(items []*cmodel.MetricValue)

func Start

func Start()

连接池 初始化数据发送服务, 在main函数中调用

Types

type Backend

type Backend interface {
	GetConfig() *BackendConfig
	Start() error
	Send(items []*cmodel.MetricValue)
	GetStats() *BackendStats
}

type BackendCommon

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

func (*BackendCommon) GetConfig

func (this *BackendCommon) GetConfig() *BackendConfig

func (*BackendCommon) GetStats

func (this *BackendCommon) GetStats() *BackendStats

type BackendConfig

type BackendConfig struct {
	Name         string
	Engine       string
	Protocol     string
	ConnTimeout  int
	CallTimeout  int
	SendInterval int
	Batch        int
	MaxConn      int
	MaxIdle      int
	Retry        int
	Url          url.URL
}

type BackendStats

type BackendStats struct {
	Send          *nproc.SCounterQps
	Drop          *nproc.SCounterQps
	Fail          *nproc.SCounterQps
	QueueLength   *nproc.SCounterBase
	ConnPoolStats []*cpool.ConnPoolStats
}

type InfluxdbBackend

type InfluxdbBackend struct {
	BackendCommon
}

func (*InfluxdbBackend) Send

func (this *InfluxdbBackend) Send(items []*cmodel.MetricValue)

Push data to 3rd-party database

func (*InfluxdbBackend) Start

func (this *InfluxdbBackend) Start() error

type InfluxdbClient

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

func (InfluxdbClient) Call

func (this InfluxdbClient) Call(arg interface{}) (interface{}, error)

func (InfluxdbClient) Close

func (this InfluxdbClient) Close() error

func (InfluxdbClient) Closed

func (this InfluxdbClient) Closed() bool

func (InfluxdbClient) Name

func (this InfluxdbClient) Name() string

type RiemannBackend

type RiemannBackend struct {
	BackendCommon
}

func (*RiemannBackend) Send

func (this *RiemannBackend) Send(items []*cmodel.MetricValue)

将原始数据入到riemann发送缓存队列

func (*RiemannBackend) Start

func (this *RiemannBackend) Start() error

type RiemannClient

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

func (RiemannClient) Call

func (this RiemannClient) Call(items interface{}) (interface{}, error)

func (RiemannClient) Close

func (this RiemannClient) Close() error

func (RiemannClient) Closed

func (this RiemannClient) Closed() bool

func (RiemannClient) Name

func (this RiemannClient) Name() string

type TransferBackend

type TransferBackend struct {
	BackendCommon
	// contains filtered or unexported fields
}

func (*TransferBackend) GetStats

func (this *TransferBackend) GetStats() *BackendStats

func (*TransferBackend) Send

func (this *TransferBackend) Send(items []*cmodel.MetricValue)

将原始数据入到riemann发送缓存队列

func (*TransferBackend) Start

func (this *TransferBackend) Start() error

type TransferClient

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

func (*TransferClient) Call

func (this *TransferClient) Call(metrics interface{}) (interface{}, error)

func (*TransferClient) Close

func (this *TransferClient) Close() error

func (*TransferClient) Closed

func (this *TransferClient) Closed() bool

func (*TransferClient) Name

func (this *TransferClient) Name() string

type TsdbBackend

type TsdbBackend struct {
	BackendCommon
}

func (*TsdbBackend) Send

func (this *TsdbBackend) Send(items []*cmodel.MetricValue)

将原始数据入到tsdb发送缓存队列

func (*TsdbBackend) Start

func (this *TsdbBackend) Start() error

type TsdbClient

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

func (TsdbClient) Call

func (this TsdbClient) Call(items interface{}) (interface{}, error)

func (TsdbClient) Close

func (this TsdbClient) Close() error

func (TsdbClient) Closed

func (this TsdbClient) Closed() bool

func (TsdbClient) Name

func (this TsdbClient) Name() string

type TsdbItem

type TsdbItem struct {
	Metric    string            `json:"metric"`
	Tags      map[string]string `json:"tags"`
	Value     float64           `json:"value"`
	Timestamp int64             `json:"timestamp"`
}

func (*TsdbItem) String

func (this *TsdbItem) String() string

func (*TsdbItem) TsdbString

func (this *TsdbItem) TsdbString() (s string)

Jump to

Keyboard shortcuts

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