Documentation
¶
Index ¶
- Constants
- Variables
- func CreateAggregatedPrometheusRule(sloCompositionName, sloCompositionNamespace string, ...) (monitoringv1.PrometheusRule, error)
- func CreatePrometheusRule(sloName, sloNamespace string, objective observabilityv1alpha1.Objective) (monitoringv1.PrometheusRule, error)
- type CacheEntry
- type CachedClient
- type Client
- type PrometheusClient
Constants ¶
View Source
const ( LabelNamespace = "namespace" LabelServiceLevelObjective = "service_level_objective" LabelObjectiveName = "objective_name" LabelObjectiveId = "objective_id" LabelStatus = "status" )
Metric labels used across all metrics
Variables ¶
View Source
var ( // ObjectiveStatus indicates whether the SLO objective is met (1) or not (0) ObjectiveStatus = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Name: "slok_slo_objective_status", Help: "Status of the SLO objective (1 = met, 0 = not met)", }, []string{LabelNamespace, LabelServiceLevelObjective, LabelObjectiveName, LabelStatus, LabelObjectiveId}, ) ObjectivePercentRemaining = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Name: "slok_slo_objective_percent_remaining", Help: "Percentage of error budget remaining for the SLOss objective", }, []string{LabelNamespace, LabelServiceLevelObjective, LabelObjectiveName, LabelObjectiveId}, ) ObjectiveTarget = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Name: "slok_slo_objective_target", Help: "Target value for the SLO objective", }, []string{LabelNamespace, LabelServiceLevelObjective, LabelObjectiveName, LabelObjectiveId}, ) ObjectiveActual = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Name: "slok_slo_objective_actual", Help: "Actual value for the SLO objective", }, []string{LabelNamespace, LabelServiceLevelObjective, LabelObjectiveName, LabelObjectiveId}, ) )
Functions ¶
func CreateAggregatedPrometheusRule ¶
func CreateAggregatedPrometheusRule(sloCompositionName, sloCompositionNamespace string, spec observabilityv1alpha1.SLOCompositionSpec, slos []observabilityv1alpha1.ServiceLevelObjective) (monitoringv1.PrometheusRule, error)
func CreatePrometheusRule ¶
func CreatePrometheusRule(sloName, sloNamespace string, objective observabilityv1alpha1.Objective) (monitoringv1.PrometheusRule, error)
Types ¶
type CacheEntry ¶
type CacheEntry struct {
// contains filtered or unexported fields
}
type CachedClient ¶
type CachedClient struct {
// contains filtered or unexported fields
}
func NewCachedClient ¶
func NewCachedClient(client PrometheusClient, ttl time.Duration) *CachedClient
func (*CachedClient) CheckConnection ¶
func (c *CachedClient) CheckConnection(ctx context.Context) error
func (*CachedClient) GetURL ¶
func (c *CachedClient) GetURL() string
func (*CachedClient) QuerySLINotNormalized ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CheckConnection ¶
CheckConnection verifies Prometheus is reachable
type PrometheusClient ¶
type PrometheusClient interface {
QuerySLI(ctx context.Context, query string) (float64, error)
CheckConnection(ctx context.Context) error
QuerySLINotNormalized(ctx context.Context, query string) (float64, error)
GetURL() string
}
PrometheusClient defines the interface for Prometheus operations
Click to show internal directories.
Click to hide internal directories.