Skip to content

Commit

Permalink
Merge pull request prometheus#5653 from prometheus/beorn7/client_golang
Browse files Browse the repository at this point in the history
Add objectives to Summaries
  • Loading branch information
beorn7 authored Jun 12, 2019
2 parents a000cec + dd81912 commit a0e8d0d
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 14 deletions.
7 changes: 4 additions & 3 deletions discovery/consul/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ var (
})
rpcDuration = prometheus.NewSummaryVec(
prometheus.SummaryOpts{
Namespace: namespace,
Name: "sd_consul_rpc_duration_seconds",
Help: "The duration of a Consul RPC call in seconds.",
Namespace: namespace,
Name: "sd_consul_rpc_duration_seconds",
Help: "The duration of a Consul RPC call in seconds.",
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
},
[]string{"endpoint", "call"},
)
Expand Down
5 changes: 3 additions & 2 deletions discovery/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ func NewTimestampCollector() *TimestampCollector {
var (
fileSDScanDuration = prometheus.NewSummary(
prometheus.SummaryOpts{
Name: "prometheus_sd_file_scan_duration_seconds",
Help: "The duration of the File-SD scan in seconds.",
Name: "prometheus_sd_file_scan_duration_seconds",
Help: "The duration of the File-SD scan in seconds.",
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
})
fileSDReadErrorsCount = prometheus.NewCounter(
prometheus.CounterOpts{
Expand Down
5 changes: 3 additions & 2 deletions discovery/refresh/refresh.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ var (
)
duration = prometheus.NewSummaryVec(
prometheus.SummaryOpts{
Name: "prometheus_sd_refresh_duration_seconds",
Help: "The duration of a refresh in seconds for the given SD mechanism.",
Name: "prometheus_sd_refresh_duration_seconds",
Help: "The duration of a refresh in seconds for the given SD mechanism.",
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
},
[]string{"mechanism"},
)
Expand Down
9 changes: 5 additions & 4 deletions notifier/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,11 @@ type alertMetrics struct {
func newAlertMetrics(r prometheus.Registerer, queueCap int, queueLen, alertmanagersDiscovered func() float64) *alertMetrics {
m := &alertMetrics{
latency: prometheus.NewSummaryVec(prometheus.SummaryOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "latency_seconds",
Help: "Latency quantiles for sending alert notifications.",
Namespace: namespace,
Subsystem: subsystem,
Name: "latency_seconds",
Help: "Latency quantiles for sending alert notifications.",
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
},
[]string{alertmanagerLabel},
),
Expand Down
4 changes: 4 additions & 0 deletions promql/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,27 +243,31 @@ func NewEngine(opts EngineOpts) *Engine {
Name: "query_duration_seconds",
Help: "Query timings",
ConstLabels: prometheus.Labels{"slice": "queue_time"},
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
}),
queryPrepareTime: prometheus.NewSummary(prometheus.SummaryOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "query_duration_seconds",
Help: "Query timings",
ConstLabels: prometheus.Labels{"slice": "prepare_time"},
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
}),
queryInnerEval: prometheus.NewSummary(prometheus.SummaryOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "query_duration_seconds",
Help: "Query timings",
ConstLabels: prometheus.Labels{"slice": "inner_eval"},
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
}),
queryResultSort: prometheus.NewSummary(prometheus.SummaryOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "query_duration_seconds",
Help: "Query timings",
ConstLabels: prometheus.Labels{"slice": "result_sort"},
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
}),
}
metrics.maxConcurrentQueries.Set(float64(opts.MaxConcurrent))
Expand Down
7 changes: 4 additions & 3 deletions rules/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ func NewGroupMetrics(reg prometheus.Registerer) *Metrics {
m := &Metrics{
evalDuration: prometheus.NewSummary(
prometheus.SummaryOpts{
Namespace: namespace,
Name: "rule_evaluation_duration_seconds",
Help: "The duration for a rule to execute.",
Namespace: namespace,
Name: "rule_evaluation_duration_seconds",
Help: "The duration for a rule to execute.",
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
}),
evalFailures: prometheus.NewCounter(
prometheus.CounterOpts{
Expand Down

0 comments on commit a0e8d0d

Please sign in to comment.