Skip to content

Commit

Permalink
Added Support for prometheus.remote_write queue_config (#569)
Browse files Browse the repository at this point in the history
Resolves #560
  • Loading branch information
bentonam authored Jun 11, 2024
1 parent 82ee07f commit 01066cd
Show file tree
Hide file tree
Showing 52 changed files with 957 additions and 0 deletions.
9 changes: 9 additions & 0 deletions charts/k8s-monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,15 @@ The Prometheus and Loki services may be hosted on the same cluster, or remotely
| externalServices.prometheus.protocol | string | `"remote_write"` | The type of server protocol for writing metrics. Valid options: "remote_write" will use Prometheus Remote Write, "otlp" will use OTLP, "otlphttp" will use OTLP HTTP |
| externalServices.prometheus.proxyURL | string | `""` | HTTP proxy to proxy requests to Prometheus through. |
| externalServices.prometheus.queryEndpoint | string | `"/api/prom/api/v1/query"` | Prometheus metrics query endpoint. Preset for Grafana Cloud Metrics instances. |
| externalServices.prometheus.queue_config.batch_send_deadline | string | 5s | Maximum time samples will wait in the buffer before sending. |
| externalServices.prometheus.queue_config.capacity | int | 10000 | Number of samples to buffer per shard. |
| externalServices.prometheus.queue_config.max_backoff | string | 5s | Maximum retry delay. |
| externalServices.prometheus.queue_config.max_samples_per_send | int | 2000 | Maximum number of samples per send. |
| externalServices.prometheus.queue_config.max_shards | int | 50 | Maximum number of concurrent shards sending samples to the endpoint. |
| externalServices.prometheus.queue_config.min_backoff | string | 30ms | Initial retry delay. The backoff time gets doubled for each retry. |
| externalServices.prometheus.queue_config.min_shards | int | 1 | Minimum amount of concurrent shards sending samples to the endpoint. |
| externalServices.prometheus.queue_config.retry_on_http_429 | bool | true | Retry when an HTTP 429 status code is received. |
| externalServices.prometheus.queue_config.sample_age_limit | string | 0s | Maximum age of samples to send. |
| externalServices.prometheus.secret.create | bool | `true` | Should this Helm chart create the secret. If false, you must define the name and namespace values. |
| externalServices.prometheus.secret.name | string | `""` | The name of the secret. |
| externalServices.prometheus.secret.namespace | string | `""` | The namespace of the secret. Only used if secret.create = "false" |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ prometheus.remote_write "metrics_service" {
}
{{- end }}
send_native_histograms = {{ .sendNativeHistograms }}

queue_config {
capacity = {{ .queue_config.capacity }}
min_shards = {{ .queue_config.min_shards }}
max_shards = {{ .queue_config.max_shards }}
max_samples_per_send = {{ .queue_config.max_samples_per_send }}
batch_send_deadline = {{ .queue_config.batch_send_deadline | quote }}
min_backoff = {{ .queue_config.min_backoff | quote }}
max_backoff = {{ .queue_config.max_backoff | quote }}
retry_on_http_429 = {{ .queue_config.retry_on_http_429 }}
sample_age_limit = {{ .queue_config.sample_age_limit | quote }}
}
}

wal {
Expand Down
32 changes: 32 additions & 0 deletions charts/k8s-monitoring/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,38 @@
"queryEndpoint": {
"type": "string"
},
"queue_config": {
"type": "object",
"properties": {
"batch_send_deadline": {
"type": "string"
},
"capacity": {
"type": "integer"
},
"max_backoff": {
"type": "string"
},
"max_samples_per_send": {
"type": "integer"
},
"max_shards": {
"type": "integer"
},
"min_backoff": {
"type": "string"
},
"min_shards": {
"type": "integer"
},
"retry_on_http_429": {
"type": "boolean"
},
"sample_age_limit": {
"type": "string"
}
}
},
"secret": {
"type": "object",
"properties": {
Expand Down
40 changes: 40 additions & 0 deletions charts/k8s-monitoring/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,46 @@ externalServices:
# @section -- External Services (Prometheus)
passwordKey: password

# Configure the Prometheus Remote Write Queue
# [docs](https://grafana.com/docs/alloy/latest/reference/components/prometheus.remote_write/#queue_config-block)
queue_config:
# -- Number of samples to buffer per shard.
# @default -- 10000
# @section -- External Services (Prometheus)
capacity: 10000
# -- Minimum amount of concurrent shards sending samples to the endpoint.
# @default -- 1
# @section -- External Services (Prometheus)
min_shards: 1
# -- Maximum number of concurrent shards sending samples to the endpoint.
# @default -- 50
# @section -- External Services (Prometheus)
max_shards: 50
# -- Maximum number of samples per send.
# @default -- 2000
# @section -- External Services (Prometheus)
max_samples_per_send: 2000
# -- Maximum time samples will wait in the buffer before sending.
# @default -- 5s
# @section -- External Services (Prometheus)
batch_send_deadline: 5s
# -- Initial retry delay. The backoff time gets doubled for each retry.
# @default -- 30ms
# @section -- External Services (Prometheus)
min_backoff: 30ms
# -- Maximum retry delay.
# @default -- 5s
# @section -- External Services (Prometheus)
max_backoff: 5s
# -- Retry when an HTTP 429 status code is received.
# @default -- true
# @section -- External Services (Prometheus)
retry_on_http_429: true
# -- Maximum age of samples to send.
# @default -- 0s
# @section -- External Services (Prometheus)
sample_age_limit: 0s

# Credential management
secret:
# -- Should this Helm chart create the secret. If false, you must define the name and namespace values.
Expand Down
12 changes: 12 additions & 0 deletions examples/alloy-autoscaling-and-storage/metrics.alloy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions examples/alloy-autoscaling-and-storage/output.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions examples/control-plane-metrics/metrics.alloy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions examples/control-plane-metrics/output.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions examples/custom-config/metrics.alloy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions examples/custom-config/output.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions examples/custom-metrics-tuning/metrics.alloy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions examples/custom-metrics-tuning/output.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions examples/custom-pricing/metrics.alloy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 01066cd

Please sign in to comment.