Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BodyParser ¶
type BodyParser interface {
// contains filtered or unexported methods
}
BodyParser decode body from different formats, an get some data node
type FordwaderScrapper ¶
type FordwaderScrapper interface { // GetMetric should return the metrics vals as raw string GetMetric() (val interface{}, err error) GetJobName() string GetInstanceName() string }
FordwaderScrapper get metrics from an already metrics endpoint
func NewMetricsForwader ¶
func NewMetricsForwader(pmcls client.ProxyMetricClientCreator, fDefMetrics *metrics.DefaultFordwaderMetrics) FordwaderScrapper
NewMetricsForwader create a scrapper that handle the forwaded metrics
type Histogram ¶
type Histogram struct {
// contains filtered or unexported fields
}
Histogram implements the Client interface(is able to get histogram metrics through `GetMetric`)
func (Histogram) GetDataSource ¶
func (s Histogram) GetDataSource() string
type HistogramValue ¶
HistogramValue hold the required values to create a histogram metric, the Count, Sum and buckets.
type JSONParser ¶
type JSONParser struct { }
JSONParser is a custom body parser that can desserialize json data
type MetricsForwader ¶
type MetricsForwader struct {
// contains filtered or unexported fields
}
MetricsForwader is a scrapper kind capable to forward a metrics endpoint with job and instance labels at least
func (MetricsForwader) GetInstanceName ¶
func (scrapper MetricsForwader) GetInstanceName() string
GetInstanceName return the name of the instance(ip:port)
func (MetricsForwader) GetJobName ¶
func (scrapper MetricsForwader) GetJobName() string
GetJobName return the name of the job(service)
func (MetricsForwader) GetMetric ¶
func (scrapper MetricsForwader) GetMetric() (val interface{}, err error)
GetMetric return the original metrics but with a service name as prefix in his names
type Numeric ¶
type Numeric struct {
// contains filtered or unexported fields
}
Numeric scrapper can get numeric(gauges or counters) metrics
func (Numeric) GetDataSource ¶
func (s Numeric) GetDataSource() string
type NumericVec ¶
type NumericVec struct {
// contains filtered or unexported fields
}
NumericVec implements the Client interface(is able to get numeric metrics through `GetMetric` like Gauge and Counter)
func (NumericVec) GetDataSource ¶
func (s NumericVec) GetDataSource() string
func (NumericVec) GetMetric ¶
func (nv NumericVec) GetMetric(metricsCollector chan<- prometheus.Metric) (val interface{}, err error)
GetMetric returns a numeric(Gauge or Counter) vector metric by using remote data.
type NumericVecItemVal ¶
NumericVecItemVal can instances a numeric(Gauge or Counter) vec item with the required labels values
type NumericVecVals ¶
type NumericVecVals []NumericVecItemVal
NumericVecVals can instances a numeric(Gauge or Counter) vec with values and corresponding labels
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool of workers to run scrap works
var WorkPool *Pool
WorkPool is use to run scrapper task in goroutines
func (*Pool) Apply ¶
func (p *Pool) Apply(ri ScrapRequest)
Apply push a scrapper task to the workers pool to be executed
func (*Pool) StartDispatcher ¶
func (p *Pool) StartDispatcher()
StartDispatcher make the workers pool ready to run scraps
type ScrapErrResult ¶
type ScrapErrResult struct { Err error ConstMetricIdxOut int JobName string InstanceName string DataSource string }
ScrapErrResult is the fail case with the error happened
type ScrapRequest ¶
type ScrapRequest struct { Scrap Scrapper Res chan ScrapResult ConstMetricIdxIn int JobName string InstanceName string DataSource string Err chan ScrapErrResult MetricsCollector chan<- prometheus.Metric }
ScrapRequest have the scrapper to do an scrap, the channels to put the result, and the metric index to return
type ScrapResult ¶
type ScrapResult struct { Val interface{} ConstMetricIdxOut int JobName string InstanceName string DataSource string }
ScrapResult is the success case with the metric value
type Scrapper ¶
type Scrapper interface { // GetMetric recive the metrics collector channel and should return the metric val GetMetric(metricsCollector chan<- prometheus.Metric) (val interface{}, err error) GetJobName() string GetInstanceName() string GetDataSource() string }
Scrapper get metrics from raw data
func NewScrapper ¶
func NewScrapper(cf client.Factory, parser BodyParser, resConf config.RextResourceDef, srvConf config.RextServiceDef, mtrConf config.RextMetricDef, nSolver config.RextNodeSolver) (scrapper Scrapper, err error)
NewScrapper will put all the required info to scrap metrics from the body returned by the client.