Documentation ¶
Overview ¶
Module for defining collectors and their good/bad events API.
There are registered manually in preconfigured metrics builder in `def.go`
There are registered automatically to an auto-instrumentation server in `pkg/test/instrumentation.go`
Index ¶
- Constants
- Variables
- func MatchMinLength(metrics []string) string
- type HistogramQuery
- func (hq HistogramQuery) BestMatch(in []string) string
- func (hq HistogramQuery) Construct(serv ServiceInfo) (string, error)
- func (hq HistogramQuery) FillQueryTemplate(info templateExecutor) (string, error)
- func (hq HistogramQuery) GetGoodCollector() prometheus.Collector
- func (hq HistogramQuery) GetGoodEvents() func(w http.ResponseWriter, r *http.Request)
- func (hq HistogramQuery) GetMetricFilter() string
- func (hq HistogramQuery) GetTotalCollector() prometheus.Collector
- func (hq HistogramQuery) GetTotalEvents() func(w http.ResponseWriter, r *http.Request)
- func (hq HistogramQuery) IsHistogram() bool
- func (hq HistogramQuery) IsRatio() bool
- func (hq HistogramQuery) Validate() error
- type MetricQuery
- type PrometheusQueryImpl
- func (p *PrometheusQueryImpl) Construct(service ServiceInfo) (*SLOQueryResult, error)
- func (p *PrometheusQueryImpl) Datasource() string
- func (p *PrometheusQueryImpl) Description() string
- func (p *PrometheusQueryImpl) GetBadEventGenerator() func(w http.ResponseWriter, r *http.Request)
- func (p *PrometheusQueryImpl) GetCollector() prometheus.Collector
- func (p *PrometheusQueryImpl) GetGoodEventGenerator() func(w http.ResponseWriter, r *http.Request)
- func (p *PrometheusQueryImpl) GetGoodQuery() Query
- func (p *PrometheusQueryImpl) GetTotalQuery() Query
- func (p *PrometheusQueryImpl) Name() string
- type Query
- type QueryBuilder
- type RatioQuery
- func (rq RatioQuery) BestMatch(in []string) string
- func (rq RatioQuery) Construct(serv ServiceInfo) (string, error)
- func (rq RatioQuery) FillQueryTemplate(info templateExecutor) (string, error)
- func (rq RatioQuery) GetGoodCollector() prometheus.Collector
- func (rq RatioQuery) GetGoodEvents() func(w http.ResponseWriter, r *http.Request)
- func (rq RatioQuery) GetMetricFilter() string
- func (rq RatioQuery) GetTotalCollector() prometheus.Collector
- func (rq RatioQuery) GetTotalEvents() func(w http.ResponseWriter, r *http.Request)
- func (rq RatioQuery) IsHistogram() bool
- func (rq RatioQuery) IsRatio() bool
- func (rq RatioQuery) Validate() error
- type SLOQueryResult
- type ServiceInfo
- type SloQueryBuilder
Constants ¶
View Source
const MockTestServerName = "MyServer"
must not contain spaces
Variables ¶
View Source
var ( AvailableQueries = make(map[string]MetricQuery) GetDownstreamMetricQueryTempl = template.Must(template.New("").Parse(` group by(__name__)({__name__=~"{{.NameRegex}}"}) `)) )
Functions ¶
func MatchMinLength ¶
Types ¶
type HistogramQuery ¶
type HistogramQuery struct {
// contains filtered or unexported fields
}
func (HistogramQuery) BestMatch ¶
func (hq HistogramQuery) BestMatch(in []string) string
func (HistogramQuery) Construct ¶
func (hq HistogramQuery) Construct(serv ServiceInfo) (string, error)
func (HistogramQuery) FillQueryTemplate ¶
func (hq HistogramQuery) FillQueryTemplate(info templateExecutor) (string, error)
func (HistogramQuery) GetGoodCollector ¶
func (hq HistogramQuery) GetGoodCollector() prometheus.Collector
func (HistogramQuery) GetGoodEvents ¶
func (hq HistogramQuery) GetGoodEvents() func(w http.ResponseWriter, r *http.Request)
func (HistogramQuery) GetMetricFilter ¶
func (hq HistogramQuery) GetMetricFilter() string
func (HistogramQuery) GetTotalCollector ¶
func (hq HistogramQuery) GetTotalCollector() prometheus.Collector
func (HistogramQuery) GetTotalEvents ¶
func (hq HistogramQuery) GetTotalEvents() func(w http.ResponseWriter, r *http.Request)
func (HistogramQuery) IsHistogram ¶
func (hq HistogramQuery) IsHistogram() bool
func (HistogramQuery) IsRatio ¶
func (hq HistogramQuery) IsRatio() bool
func (HistogramQuery) Validate ¶
func (hq HistogramQuery) Validate() error
type MetricQuery ¶
type MetricQuery interface { // User facing name of the pre-confured metric Name() string // User-facing description of the pre-configured metric Description() string // Each metric has a unique opni datasource (monitoring vs logging) by which it is filtered by Datasource() string Construct(ServiceInfo) (*SLOQueryResult, error) // Some metrics will have different labels for metrics, so handle them independently GetGoodQuery() Query GetTotalQuery() Query GetCollector() prometheus.Collector GetGoodEventGenerator() func(w http.ResponseWriter, r *http.Request) GetBadEventGenerator() func(w http.ResponseWriter, r *http.Request) }
type PrometheusQueryImpl ¶
type PrometheusQueryImpl struct { GoodQuery Query TotalQuery Query LabelRegex regexp.Regexp // contains filtered or unexported fields }
func (*PrometheusQueryImpl) Construct ¶
func (p *PrometheusQueryImpl) Construct(service ServiceInfo) (*SLOQueryResult, error)
The actual metricId and window are only known at SLO creation time
func (*PrometheusQueryImpl) Datasource ¶
func (p *PrometheusQueryImpl) Datasource() string
func (*PrometheusQueryImpl) Description ¶
func (p *PrometheusQueryImpl) Description() string
func (*PrometheusQueryImpl) GetBadEventGenerator ¶
func (p *PrometheusQueryImpl) GetBadEventGenerator() func(w http.ResponseWriter, r *http.Request)
func (*PrometheusQueryImpl) GetCollector ¶
func (p *PrometheusQueryImpl) GetCollector() prometheus.Collector
func (*PrometheusQueryImpl) GetGoodEventGenerator ¶
func (p *PrometheusQueryImpl) GetGoodEventGenerator() func(w http.ResponseWriter, r *http.Request)
func (*PrometheusQueryImpl) GetGoodQuery ¶
func (p *PrometheusQueryImpl) GetGoodQuery() Query
func (*PrometheusQueryImpl) GetTotalQuery ¶
func (p *PrometheusQueryImpl) GetTotalQuery() Query
func (*PrometheusQueryImpl) Name ¶
func (p *PrometheusQueryImpl) Name() string
type QueryBuilder ¶
type QueryBuilder interface { Query(string) QueryBuilder MetricFilter(string) QueryBuilder Matcher(*matcher) QueryBuilder BuildRatio() RatioQuery BuildHistogram() HistogramQuery }
func NewQueryBuilder ¶
func NewQueryBuilder() QueryBuilder
type RatioQuery ¶
type RatioQuery struct {
// contains filtered or unexported fields
}
func (RatioQuery) BestMatch ¶
func (rq RatioQuery) BestMatch(in []string) string
func (RatioQuery) Construct ¶
func (rq RatioQuery) Construct(serv ServiceInfo) (string, error)
func (RatioQuery) FillQueryTemplate ¶
func (rq RatioQuery) FillQueryTemplate(info templateExecutor) (string, error)
func (RatioQuery) GetGoodCollector ¶
func (rq RatioQuery) GetGoodCollector() prometheus.Collector
func (RatioQuery) GetGoodEvents ¶
func (rq RatioQuery) GetGoodEvents() func(w http.ResponseWriter, r *http.Request)
func (RatioQuery) GetMetricFilter ¶
func (rq RatioQuery) GetMetricFilter() string
func (RatioQuery) GetTotalCollector ¶
func (rq RatioQuery) GetTotalCollector() prometheus.Collector
func (RatioQuery) GetTotalEvents ¶
func (rq RatioQuery) GetTotalEvents() func(w http.ResponseWriter, r *http.Request)
func (RatioQuery) IsHistogram ¶
func (rq RatioQuery) IsHistogram() bool
func (RatioQuery) IsRatio ¶
func (rq RatioQuery) IsRatio() bool
func (RatioQuery) Validate ¶
func (rq RatioQuery) Validate() error
type SLOQueryResult ¶
type ServiceInfo ¶ added in v0.9.2
type SloQueryBuilder ¶
type SloQueryBuilder interface { Name(name string) SloQueryBuilder GoodQuery(q Query) SloQueryBuilder TotalQuery(q Query) SloQueryBuilder Description(description string) SloQueryBuilder Datasource(datasource string) SloQueryBuilder Collector(prometheus.Collector) SloQueryBuilder GoodEventGenerator(goodEvents func(w http.ResponseWriter, r *http.Request)) SloQueryBuilder BadEventGenerator(badEvents func(w http.ResponseWriter, r *http.Request)) SloQueryBuilder Build() PrometheusQueryImpl }
func New ¶
func New() SloQueryBuilder
Click to show internal directories.
Click to hide internal directories.