Documentation ¶
Index ¶
- func ActiveAlertsToProto(s storepb.PartialResponseStrategy, a *rules.AlertingRule) []*rulespb.AlertInstance
- func NewPromClientsQueryable(logger log.Logger, queryClients []*clientconfig.HTTPClient, ...) *promClientsQueryable
- func RegisterRulesServer(rulesSrv rulespb.RulesServer) func(*grpc.Server)
- func RemoveDuplicateQueryEndpoints(logger log.Logger, duplicatedQueriers prometheus.Counter, urls []*url.URL) []*url.URL
- func ValidateAndCount(group io.Reader) (numRules int, errs errutil.MultiError)
- type GRPCClient
- type Group
- type Manager
- func (m *Manager) Active() []*rulespb.AlertInstance
- func (m *Manager) RuleGroups() []Group
- func (m *Manager) Rules(r *rulespb.RulesRequest, s rulespb.Rules_RulesServer) (err error)
- func (m *Manager) Run()
- func (m *Manager) Stop()
- func (m *Manager) Update(evalInterval time.Duration, files []string) error
- type Prometheus
- type Proxy
- type UnaryClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActiveAlertsToProto ¶
func ActiveAlertsToProto(s storepb.PartialResponseStrategy, a *rules.AlertingRule) []*rulespb.AlertInstance
func NewPromClientsQueryable ¶ added in v0.30.0
func NewPromClientsQueryable(logger log.Logger, queryClients []*clientconfig.HTTPClient, promClients []*promclient.Client, httpMethod string, step time.Duration, ignoredLabelNames []string) *promClientsQueryable
NewPromClientsQueryable creates a queryable that queries queriers from Prometheus clients.
func RegisterRulesServer ¶ added in v0.16.0
func RegisterRulesServer(rulesSrv rulespb.RulesServer) func(*grpc.Server)
func RemoveDuplicateQueryEndpoints ¶ added in v0.30.0
func RemoveDuplicateQueryEndpoints(logger log.Logger, duplicatedQueriers prometheus.Counter, urls []*url.URL) []*url.URL
RemoveDuplicateQueryEndpoints removes duplicate endpoints from the list of urls.
func ValidateAndCount ¶
func ValidateAndCount(group io.Reader) (numRules int, errs errutil.MultiError)
ValidateAndCount validates all rules in the rule groups and return overall number of rules in all groups. TODO(bwplotka): Replace this with upstream implementation after https://github.com/prometheus/prometheus/issues/7128 is fixed.
Types ¶
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
GRPCClient allows to retrieve rules from local gRPC streaming server implementation. TODO(bwplotka): Switch to native gRPC transparent client->server adapter once available.
func NewGRPCClient ¶
func NewGRPCClient(rs rulespb.RulesServer) *GRPCClient
func NewGRPCClientWithDedup ¶
func NewGRPCClientWithDedup(rs rulespb.RulesServer, replicaLabels []string) *GRPCClient
func (*GRPCClient) Rules ¶
func (rr *GRPCClient) Rules(ctx context.Context, req *rulespb.RulesRequest) (*rulespb.RuleGroups, annotations.Annotations, error)
type Group ¶
type Group struct { *rules.Group OriginalFile string PartialResponseStrategy storepb.PartialResponseStrategy }
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is a partial response strategy and proto compatible Manager. Manager also implements rulespb.Rules gRPC service.
func NewManager ¶
func NewManager( ctx context.Context, reg prometheus.Registerer, dataDir string, baseOpts rules.ManagerOptions, queryFuncCreator func(partialResponseStrategy storepb.PartialResponseStrategy) rules.QueryFunc, extLset labels.Labels, externalURL string, ) *Manager
NewManager creates new Manager. QueryFunc from baseOpts will be rewritten.
func (*Manager) Active ¶
func (m *Manager) Active() []*rulespb.AlertInstance
func (*Manager) RuleGroups ¶
func (*Manager) Rules ¶
func (m *Manager) Rules(r *rulespb.RulesRequest, s rulespb.Rules_RulesServer) (err error)
Rules returns specified rules from manager. This is used by gRPC and locally for HTTP and UI purposes.
type Prometheus ¶
type Prometheus struct {
// contains filtered or unexported fields
}
Prometheus implements rulespb.Rules gRPC that allows to fetch rules from Prometheus HTTP api/v1/rules endpoint.
func NewPrometheus ¶
func NewPrometheus(base *url.URL, client *promclient.Client, extLabels func() labels.Labels) *Prometheus
NewPrometheus creates new rules.Prometheus.
func (*Prometheus) Rules ¶
func (p *Prometheus) Rules(r *rulespb.RulesRequest, s rulespb.Rules_RulesServer) error
Rules returns all specified rules from Prometheus.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy implements rulespb.Rules gRPC that fanouts requests to given rulespb.Rules and deduplication on the way.
func NewProxy ¶
func NewProxy(logger log.Logger, rules func() []rulespb.RulesClient) *Proxy
NewProxy returns new rules.Proxy.
func (*Proxy) Rules ¶
func (s *Proxy) Rules(req *rulespb.RulesRequest, srv rulespb.Rules_RulesServer) error
type UnaryClient ¶
type UnaryClient interface {
Rules(ctx context.Context, req *rulespb.RulesRequest) (*rulespb.RuleGroups, annotations.Annotations, error)
}
UnaryClient is gRPC rulespb.Rules client which expands streaming rules API. Useful for consumers that does not support streaming.