1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-21 11:48:53 +00:00

prometheus: Add ability to specify log level

This commit is contained in:
Frederic Branczyk 2017-12-21 13:46:12 +01:00
parent 698aefe37a
commit 02621aad10
No known key found for this signature in database
GPG key ID: 7741A52782A90069
3 changed files with 7 additions and 0 deletions
Documentation
pkg
client/monitoring/v1
prometheus

View file

@ -191,6 +191,7 @@ Specification of the desired behavior of the Prometheus cluster. More info: http
| imagePullSecrets | An optional list of references to secrets in the same namespace to use for pulling prometheus and alertmanager images from registries see http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod | [][v1.LocalObjectReference](https://v1-6.docs.kubernetes.io/docs/api-reference/v1.6/#localobjectreference-v1-core) | false |
| replicas | Number of instances to deploy for a Prometheus deployment. | *int32 | false |
| retention | Time duration Prometheus shall retain data for. | string | false |
| logLevel | Log level for Prometheus be configured in. | string | false |
| scrapeInterval | Interval between consecutive scrapes. | string | false |
| evaluationInterval | Interval between consecutive evaluations. | string | false |
| externalLabels | The labels to add to any time series or alerts when communicating with external systems (federation, remote storage, Alertmanager). | map[string]string | false |

View file

@ -71,6 +71,8 @@ type PrometheusSpec struct {
Replicas *int32 `json:"replicas,omitempty"`
// Time duration Prometheus shall retain data for.
Retention string `json:"retention,omitempty"`
// Log level for Prometheus be configured in.
LogLevel string `json:"logLevel,omitempty"`
// Interval between consecutive scrapes.
ScrapeInterval string `json:"scrapeInterval,omitempty"`
// Interval between consecutive evaluations.

View file

@ -374,6 +374,10 @@ func makeStatefulSetSpec(p monitoringv1.Prometheus, c *Config, ruleConfigMaps []
}
promArgs = append(promArgs, "-web.route-prefix="+webRoutePrefix)
if p.Spec.LogLevel != "" && p.Spec.LogLevel != "info" {
promArgs = append(promArgs, fmt.Sprintf("-log.level=%s", p.Spec.LogLevel))
}
if version.Major == 2 {
for i, a := range promArgs {
promArgs[i] = "-" + a