Documentation ¶
Index ¶
- Constants
- func Aggregate(m []Metric) map[SetKey]MetricSet
- func CounterFromMetric(m *dto.Metric) uint64
- type Client
- type Counter
- type DataPoint
- type DataPointGroup
- type DataPointGroupIterator
- type DataPointView
- func (v *DataPointView) FindByIngress(table, ingress string, from, to time.Time) DataPoints
- func (v *DataPointView) FindByIngressAndService(table, ingress, service string, from, to time.Time) (DataPoints, error)
- func (v *DataPointView) FindByService(table, service string, from, to time.Time) DataPoints
- type DataPoints
- type ForEachFunc
- type Histogram
- type Manager
- type Metric
- type MetricSet
- type Parser
- type ScrapeState
- type Scraper
- type ServiceHistogram
- type SetKey
- type Store
- func (s *Store) Cleanup()
- func (s *Store) CommitMarks(tbl string, marks WaterMarks)
- func (s *Store) ForEach(tbl string, fn ForEachFunc)
- func (s *Store) ForEachUnmarked(tbl string, fn ForEachFunc) WaterMarks
- func (s *Store) Insert(svcs map[SetKey]DataPoint)
- func (s *Store) Populate(tbl string, grps []DataPointGroup) error
- func (s *Store) RollUp()
- type TraefikParser
- type WaterMarks
Constants ¶
const ( MetricRequestDuration = "request_duration" MetricRequests = "requests" MetricRequestErrors = "request_errors" MetricRequestClientErrors = "request_client_errors" )
Metric names.
const (
ParserTraefik = "traefik"
)
Parser names. This should match the topology types.
Variables ¶
This section is empty.
Functions ¶
func CounterFromMetric ¶
CounterFromMetric returns a counter metric from a prometheus metric.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for the token service.
func (*Client) GetPreviousData ¶
GetPreviousData gets the agent configuration.
type Counter ¶
Counter represents a counter metric.
func (Counter) EdgeIngressName ¶
EdgeIngressName returns the metric edge ingress name.
func (Counter) IngressName ¶
IngressName returns the metric ingress name.
func (Counter) ServiceName ¶
ServiceName returns the metric service name.
type DataPoint ¶
type DataPoint struct { Timestamp int64 `avro:"timestamp"` ReqPerS float64 `avro:"req_per_s"` RequestErrPerS float64 `avro:"request_error_per_s"` RequestErrPercent float64 `avro:"request_error_per"` RequestClientErrPerS float64 `avro:"request_client_error_per_s"` RequestClientErrPercent float64 `avro:"request_client_error_per"` AvgResponseTime float64 `avro:"avg_response_time"` Seconds int64 `avro:"seconds"` Requests int64 `avro:"requests"` RequestErrs int64 `avro:"request_errors"` RequestClientErrs int64 `avro:"request_client_errors"` ResponseTimeSum float64 `avro:"response_time_sum"` ResponseTimeCount int64 `avro:"response_time_count"` }
DataPoint contains fully aggregated metrics.
type DataPointGroup ¶
type DataPointGroup struct { Ingress string `avro:"ingress"` EdgeIngress string `avro:"edge_ingress"` Service string `avro:"service"` DataPoints []DataPoint `avro:"data_points"` }
DataPointGroup contains a unique group of data points (primary keys).
type DataPointGroupIterator ¶
type DataPointGroupIterator interface {
ForEach(tbl string, fn ForEachFunc)
}
DataPointGroupIterator is capable of iterating over data point groups.
type DataPointView ¶
type DataPointView struct {
// contains filtered or unexported fields
}
DataPointView provides a view for querying data points from a store.
func NewDataPointView ¶
func NewDataPointView(s DataPointGroupIterator) *DataPointView
NewDataPointView creates a new DataPointView instance.
func (*DataPointView) FindByIngress ¶
func (v *DataPointView) FindByIngress(table, ingress string, from, to time.Time) DataPoints
FindByIngress finds the data points for the traffic on the given ingress for the specified time range (inclusive).
func (*DataPointView) FindByIngressAndService ¶
func (v *DataPointView) FindByIngressAndService(table, ingress, service string, from, to time.Time) (DataPoints, error)
FindByIngressAndService finds the data points for the traffic on the given service via the given ingress for the specified time range (inclusive).
func (*DataPointView) FindByService ¶
func (v *DataPointView) FindByService(table, service string, from, to time.Time) DataPoints
FindByService finds the data points for the traffic on the given service for the specified time range (inclusive). If the traffic coming this service comes from multiple ingresses, the resulting data points will be an aggregated view of all these ingresses.
type DataPoints ¶
type DataPoints []DataPoint
DataPoints contains a slice of data points.
func (DataPoints) Aggregate ¶
func (p DataPoints) Aggregate() DataPoint
Aggregate aggregates the data points p.
type ForEachFunc ¶
type ForEachFunc func(edgeIngr, ingr, svc string, pnts DataPoints)
ForEachFunc represents a function that will be called while iterating over a table. Each time this function is called, a unique ingress and service will be given with their set of points.
type Histogram ¶
type Histogram struct { Name string Relative bool EdgeIngress string Ingress string Service string Sum float64 Count uint64 }
Histogram represents a histogram metric.
func HistogramFromMetric ¶
HistogramFromMetric returns a histogram metric from a prometheus metric.
func (Histogram) EdgeIngressName ¶
EdgeIngressName returns the metric edge ingress name.
func (Histogram) IngressName ¶
IngressName returns the metric ingress name.
func (Histogram) ServiceName ¶
ServiceName returns the metric service name.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager orchestrates metrics scraping and sending.
func NewManager ¶
NewManager returns a manager.
type MetricSet ¶
type MetricSet struct { Requests int64 RequestErrors int64 RequestClientErrors int64 RequestDuration ServiceHistogram }
MetricSet contains assembled metrics for an ingress or service.
func (MetricSet) RelativeTo ¶
RelativeTo returns a service metric relative to o.
func (MetricSet) ToDataPoint ¶
ToDataPoint returns a data point calculated from s.
type Parser ¶
type Parser interface {
Parse(m *dto.MetricFamily, state ScrapeState) []Metric
}
Parser represents a platform-specific metrics parser.
type ScrapeState ¶
type ScrapeState struct {
Ingresses map[string]struct{}
}
ScrapeState contains the state used while scraping.
type Scraper ¶
type Scraper struct {
// contains filtered or unexported fields
}
Scraper scrapes metrics from Prometheus.
func NewScraper ¶
NewScraper returns a scraper instance with parser p.
type ServiceHistogram ¶
ServiceHistogram contains histogram metrics.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a metrics store.
func (*Store) Cleanup ¶
func (s *Store) Cleanup()
Cleanup removes old data points no longer needed for roll up.
func (*Store) CommitMarks ¶
func (s *Store) CommitMarks(tbl string, marks WaterMarks)
CommitMarks sets the new low water marks for a table.
func (*Store) ForEach ¶
func (s *Store) ForEach(tbl string, fn ForEachFunc)
ForEach iterates over a table, executing fn for each row.
func (*Store) ForEachUnmarked ¶
func (s *Store) ForEachUnmarked(tbl string, fn ForEachFunc) WaterMarks
ForEachUnmarked iterates over a table, executing fn for each row that has not been marked.
type TraefikParser ¶
type TraefikParser struct {
// contains filtered or unexported fields
}
TraefikParser parses Traefik metrics into a common form.
func NewTraefikParser ¶
func NewTraefikParser() TraefikParser
NewTraefikParser returns an Traefik metrics parser.
func (TraefikParser) Parse ¶
func (p TraefikParser) Parse(m *dto.MetricFamily, state ScrapeState) []Metric
Parse parses metrics into a common form.