mirror of
https://github.com/prometheus-operator/prometheus-operator.git
synced 2025-04-21 11:48:53 +00:00
pkgs/apis/monitoring: support --max-samples
flag in QuerySpec
This commit is contained in:
parent
650359b3e6
commit
9b61c8fc2d
5 changed files with 16 additions and 1 deletions
Documentation
example/prometheus-operator-crd
jsonnet/prometheus-operator
pkg
|
@ -334,6 +334,7 @@ QuerySpec defines the query command line flags when starting Prometheus.
|
|||
| ----- | ----------- | ------ | -------- |
|
||||
| lookbackDelta | The delta difference allowed for retrieving metrics during expression evaluations. | *string | false |
|
||||
| maxConcurrency | Number of concurrent queries that can be run at once. | *int32 | false |
|
||||
| maxSamples | Maximum number of samples a single query can load into memory. Note that queries will fail if they would load more samples than this into memory, so this also limits the number of samples a query can return. | *int32 | false |
|
||||
| timeout | Maximum time a query may take before being aborted. | *string | false |
|
||||
|
||||
[Back to TOC](#table-of-contents)
|
||||
|
|
|
@ -1898,6 +1898,10 @@ spec:
|
|||
description: Number of concurrent queries that can be run at once.
|
||||
format: int32
|
||||
type: integer
|
||||
maxSamples:
|
||||
description: Maximum number of samples a single query can load into memory. Note that queries will fail if they would load more samples than this into memory, so this also limits the number of samples a query can return.
|
||||
format: int32
|
||||
type: integer
|
||||
timeout:
|
||||
description: Maximum time a query may take before being aborted.
|
||||
type: string
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -298,6 +298,8 @@ type QuerySpec struct {
|
|||
LookbackDelta *string `json:"lookbackDelta,omitempty"`
|
||||
// Number of concurrent queries that can be run at once.
|
||||
MaxConcurrency *int32 `json:"maxConcurrency,omitempty"`
|
||||
// Maximum number of samples a single query can load into memory. Note that queries will fail if they would load more samples than this into memory, so this also limits the number of samples a query can return.
|
||||
MaxSamples *int32 `json:"maxSamples,omitempty"`
|
||||
// Maximum time a query may take before being aborted.
|
||||
Timeout *string `json:"timeout,omitempty"`
|
||||
}
|
||||
|
|
|
@ -361,6 +361,14 @@ func makeStatefulSetSpec(p monitoringv1.Prometheus, c *Config, ruleConfigMapName
|
|||
promArgs = append(promArgs, "-rules.alert.resend-delay="+p.Spec.Rules.Alert.ResendDelay)
|
||||
}
|
||||
}
|
||||
|
||||
if version.Minor >= 5 {
|
||||
if p.Spec.Query != nil && p.Spec.Query.MaxSamples != nil {
|
||||
promArgs = append(promArgs,
|
||||
fmt.Sprintf("-query.max-samples=%d", *p.Spec.Query.MaxSamples),
|
||||
)
|
||||
}
|
||||
}
|
||||
default:
|
||||
return nil, errors.Errorf("unsupported Prometheus major version %s", version)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue