Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[collector] Update internal metrics config examples, suggest OTLP for pushing metrics #5212

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 31 additions & 21 deletions content/en/docs/collector/internal-telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,24 @@ By default, the Collector exposes its own telemetry in two ways:

You can configure how internal metrics are generated and exposed by the
Collector. By default, the Collector generates basic metrics about itself and
exposes them for scraping at `http://127.0.0.1:8888/metrics`. You can expose the
endpoint to one specific or all network interfaces when needed. For
containerized environments, you might want to expose this port on a public
interface.
exposes them using the OpenTelemetry Go
[Prometheus exporter](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/prometheus)
for scraping at `http://127.0.0.1:8888/metrics`. You can expose the endpoint to
one specific or all network interfaces when needed. For containerized
environments, you might want to expose this port on a public interface.

Set the address in the config `service::telemetry::metrics`:
Set the Prometheus config under `service::telemetry::metrics`:

```yaml
service:
telemetry:
metrics:
address: 0.0.0.0:8888
readers:
pull:
exporter:
prometheus:
host: '0.0.0.0'
port: 8888
```

You can adjust the verbosity of the Collector metrics output by setting the
Expand All @@ -59,30 +65,34 @@ service:
level: detailed
```

The Collector can also be configured to scrape its own metrics using a
[Prometheus receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/prometheusreceiver)
and send them through configured pipelines. For example:
The Collector can also be configured to push its own metrics to an
[OTLP receiver](https://github.com/open-telemetry/opentelemetry-collector/tree/main/receiver/otlpreceiver)
and send them through configured pipelines. In the following example, the
Collector is configured to push metrics every 10s using OTLP gRPC to
`localhost:14317`:

```yaml
receivers:
prometheus:
config:
scrape_configs:
- job_name: 'otelcol'
scrape_interval: 10s
static_configs:
- targets: ['0.0.0.0:8888']
metric_relabel_configs:
- source_labels: [__name__]
regex: '.*grpc_io.*'
action: drop
otlp/internal_metrics:
protocols:
grpc:
endpoint: localhost:14317
exporters:
debug:
service:
pipelines:
metrics:
receivers: [prometheus]
receivers: [otlp/internal_metrics]
exporters: [debug]
telemetry:
metrics:
readers:
- periodic:
interval: 10000
exporter:
otlp:
protocol: grpc/protobuf
endpoint: localhost:14317
```

{{% alert title="Caution" color="warning" %}}
Expand Down