[kubernetes] add prometheus receiver docs (#3114)

This commit is contained in:
Tyler Helmuth 2023-07-31 20:13:26 -06:00 committed by GitHub
parent 8c0c154bef
commit e40a4c7c4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 1 deletions

View File

@ -2,7 +2,7 @@
title: Important Components for Kubernetes title: Important Components for Kubernetes
linkTitle: Components linkTitle: Components
# prettier-ignore # prettier-ignore
cSpell:ignore: containerd crio filelog gotime horizontalpodautoscalers iostream k8sattributes kubelet kubeletstats logtag replicasets replicationcontrollers resourcequotas statefulsets varlibdockercontainers varlogpods cSpell:ignore: alertmanagers containerd crio filelog gotime horizontalpodautoscalers iostream k8sattributes kubelet kubeletstats logtag replicasets replicationcontrollers resourcequotas statefulsets varlibdockercontainers varlogpods
--- ---
The [OpenTelemetry Collector](/docs/collector/) supports many different The [OpenTelemetry Collector](/docs/collector/) supports many different
@ -22,6 +22,8 @@ Components covered in this page:
cluster-level metrics and entity events. cluster-level metrics and entity events.
- [Kubernetes Objects Receiver](#kubernetes-objects-receiver): collects objects, - [Kubernetes Objects Receiver](#kubernetes-objects-receiver): collects objects,
such as events, from the Kubernetes API server. such as events, from the Kubernetes API server.
- [Prometheus Receiver](#prometheus-receiver): receives metrics in
[Prometheus](https://prometheus.io/) format.
For application traces, metrics, or logs, we recommend the For application traces, metrics, or logs, we recommend the
[OTLP receiver](https://github.com/open-telemetry/opentelemetry-collector/tree/main/receiver/otlpreceiver), [OTLP receiver](https://github.com/open-telemetry/opentelemetry-collector/tree/main/receiver/otlpreceiver),
@ -661,3 +663,48 @@ subjects:
name: otel-collector-opentelemetry-collector name: otel-collector-opentelemetry-collector
namespace: default namespace: default
``` ```
## Prometheus Receiver
| Deployment Pattern | Usable |
| -------------------- | ------ |
| DaemonSet (Agent) | Yes |
| Deployment (Gateway) | Yes |
| Sidecar | No |
Prometheus is a common metrics format for both Kubernetes and services running
on Kubernetes. The Prometheus receiver is a minimal drop-in replacement for the
collection of those metrics. It supports the full set of Prometheus
[`scrape_config` options](https://prometheus.io/docs/prometheus/1.8/configuration/configuration/#scrape_config).
There are a few advanced Prometheus features that the receiver does not support.
The receiver returns an error if the configuration YAML/code contains any of the
following:
- `alert_config.alertmanagers`
- `alert_config.relabel_configs`
- `remote_read`
- `remote_write`
- `rule_files`
For specific configuration details, see
[Prometheus Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/prometheusreceiver).
The Prometheus receiver is
[Stateful](https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/standard-warnings.md#statefulness),
which means there are important details to consider when using it:
- The collector cannot auto-scale the scraping process when multiple replicas of
the collector are run.
- When running multiple replicas of the collector with the same config, it will
scrape the targets multiple times.
- Users need to configure each replica with a different scraping configuration
if they want to manually shard the scraping process.
To make configuring the Prometheus receiver easier, the OpenTelemetry Operator
includes an optional component called the
[Target Allocator](../../operator/target-allocator). This component can be used
to tell a collector which Prometheus endpoints it should scrape.
For more information on the design of the receiver, see
[Design](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/prometheusreceiver/DESIGN.md).

View File

@ -4063,6 +4063,10 @@
"StatusCode": 206, "StatusCode": 206,
"LastSeen": "2023-06-29T18:39:10.996228-04:00" "LastSeen": "2023-06-29T18:39:10.996228-04:00"
}, },
"https://prometheus.io/docs/prometheus/1.8/configuration/configuration/#scrape_config": {
"StatusCode": 206,
"LastSeen": "2023-07-31T15:39:51.143898-06:00"
},
"https://prometheus.io/docs/prometheus/latest/configuration/configuration/": { "https://prometheus.io/docs/prometheus/latest/configuration/configuration/": {
"StatusCode": 206, "StatusCode": 206,
"LastSeen": "2023-06-01T15:55:26.349478-04:00" "LastSeen": "2023-06-01T15:55:26.349478-04:00"