pushgateway

package
v0.0.0-...-8dea7e7 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricPrefix = "metric"
)

Variables

View Source
var (
	MetricsChannel = make(chan *PushData, global.Config.RedisAgent.KeyCount)
)

Functions

This section is empty.

Types

type Metric

type Metric struct {
	MetricName  string            `json:"metric_name"`            // metric name, like test_metric
	MetricValue float64           `json:"metric_value,omitempty"` // metric value
	Labels      map[string]string `json:"labels"`                 // Label
}

type PipelineData

type PipelineData struct {
	Expire int
	Key    string
	Value  []byte
}

type PoolRunner

type PoolRunner struct {
	Keys     []string
	TextChan chan []string
}

type PushData

type PushData struct {
	Metrics    []Metric `json:"metrics"`
	JobName    string   `json:"job_name"`              // Job Name
	ID         string   `json:"id"`                    // Id
	ExpireTime int      `json:"expire_time,omitempty"` // metric expire time,default 1800 seconds
}

type PushGateWay

type PushGateWay struct {
	Agent          *redis.Agent
	MetricTemplate *template.Template
	// contains filtered or unexported fields
}

func NewPushGateWayController

func NewPushGateWayController(agent *redis.Agent) *PushGateWay

func (*PushGateWay) CacheMetric

func (p *PushGateWay) CacheMetric(data *PushData) (respData *RespData, err error)

func (*PushGateWay) CacheMetrics

func (p *PushGateWay) CacheMetrics()

func (*PushGateWay) GetMetric

func (p *PushGateWay) GetMetric(jobName, id string) (metric *PushData, err error)

func (*PushGateWay) GetMetrics

func (p *PushGateWay) GetMetrics() (metricByte []byte, err error)

func (*PushGateWay) Paging

func (p *PushGateWay) Paging(keys []string) (keysGroup [][]string)

func (*PushGateWay) ReadFromRedisPipeline

func (p *PushGateWay) ReadFromRedisPipeline(keys []string) (metricValues [][]byte, err error)

func (*PushGateWay) WriteToRedisPipeline

func (p *PushGateWay) WriteToRedisPipeline(metrics []*PushData) (err error)

type RespData

type RespData struct {
	Status       string `json:"status"`
	Code         int    `json:"code"`
	ErrorMessage string `json:"error_message"`
}

Jump to

Keyboard shortcuts

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