Skip to content

Commit

Permalink
Remove duplicate content from Collector config page (#4504)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiffany76 committed May 21, 2024
1 parent dc9b52c commit 744d6ab
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 100 deletions.
93 changes: 4 additions & 89 deletions content/en/docs/collector/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -602,95 +602,10 @@ service:

### Telemetry

The `telemetry` is where the telemetry for the Collector itself can be
configured. Collector's own telemetry can be useful when troubleshooting
Collector issues. It consists of two subsections: `logs` and `metrics`.

The `logs` subsection lets you configure how the logs can be generated by the
Collector. By default, the Collector writes its logs to `stderr` with a log
level of `INFO`. You can also add static key-value pairs to all log entries with
the `initial_fields` to enrich the logging context. The [`logs` configuration
options](https://github.com/open-telemetry/opentelemetry-collector/blob/v{{%
param vers %}}/service/telemetry/config.go) are:

- `level`: sets the minimum enabled logging level, default `INFO`.
- `development`: puts the logger in development mode, default `false`.
- `encoding`: sets the logger's encoding, default `console`. Example values are
`json`, `console`.
- `disable_caller`: stops annotating logs with the calling function's file name
and line number. By default `false`, all logs are annotated.
- `disable_stacktrace`: disables automatic stacktrace capturing, default
`false`. By default, stacktraces are captured for `WARN` level and above logs
in development and `ERROR` level and above in production.
- `sampling`: sets a sampling policy.
- `output_paths`: a list of URLs or file paths to write logging output to,
default `["stderr"]`.
- `error_output_paths`: a list of URLs or file paths to write logger errors to,
default `["stderr"]`.
- `initial_fields`: a collection of fields to add to the root logger. By
default, there is no initial field.

The `metrics` subsection lets you configure how the metrics can be generated and
exposed by the Collector. By default, the Collector generates basic metrics
about itself and expose them for scraping at <http://127.0.0.1:8888/metrics>.
You can expose the endpoint to a specific or even all network interfaces when
needed. The [`metrics` configuration
options](https://github.com/open-telemetry/opentelemetry-collector/blob/v{{%
param vers %}}/service/telemetry/config.go) are:

- `level`: the level of telemetry metrics, default `basic`. The possible values
are:
- `none`: no telemetry is collected.
- `basic`: essential service telemetry.
- `normal`: the default level, adds standard indicators on top of basic.
- `detailed`: the most verbose level, includes dimensions and views.
- `address`: the `[address]:port` formatted URL that metrics exposition should
be bound to. Default `127.0.0.1:8888`.

The following example shows the Collector telemetry configuration:

```yaml
service:
telemetry:
logs:
level: DEBUG
initial_fields:
service: my-instance
metrics:
level: detailed
address: 0.0.0.0:8888
```

Note that it's possible to scrape the metrics by using a
[Prometheus receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/prometheusreceiver)
within the Collector configuration so that we can consume the Collector's
metrics at the backend. For example:

```yaml
receivers:
prometheus:
trim_metric_suffixes: true
use_start_time_metric: true
start_time_metric_regex: .*
config:
scrape_configs:
- job_name: 'otel-collector'
scrape_interval: 5s
static_configs:
- targets: ['127.0.0.1:8888']

exporters:
otlp:
endpoint: my.company.com:4317
tls:
insecure: true

service:
pipelines:
metrics:
receivers: [prometheus]
exporters: [otlp]
```
The `telemetry` config section is where you can set up observability for the
Collector itself. It consists of two subsections: `logs` and `metrics`. To learn
how to configure these signals, see
[Activate internal telemetry in the Collector](/docs/collector/internal-telemetry#activate-internal-telemetry-in-the-collector).

## Other Information

Expand Down
33 changes: 22 additions & 11 deletions content/en/docs/collector/internal-telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ service:
level: detailed
```

The Collector can also be configured to scrape its own metrics and send them
through configured pipelines. For example:
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:

```yaml
receivers:
Expand Down Expand Up @@ -95,15 +96,25 @@ critical analysis.

### Configure internal logs

You can find log output in `stderr`. The verbosity level for logs defaults to
`INFO`, but you can adjust it in the config `service::telemetry::logs`:

```yaml
service:
telemetry:
logs:
level: 'debug'
```
Log output is found in `stderr`. You can configure logs in the config
`service::telemetry::logs`. The [configuration
options](https://github.com/open-telemetry/opentelemetry-collector/blob/v{{%
param vers %}}/service/telemetry/config.go) are:

| Field name | Default value | Description |
| ---------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `level` | `INFO` | Sets the minimum enabled logging level. Other possible values are `DEBUG`, `WARN`, and `ERROR`. |
| `development` | `false` | Puts the logger in development mode. |
| `encoding` | `console` | Sets the logger's encoding. The other possible value is `json`. |
| `disable_caller` | `false` | Stops annotating logs with the calling function's file name and line number. By default, all logs are annotated. |
| `disable_stacktrace` | `false` | Disables automatic stacktrace capturing. Stacktraces are captured for logs at `WARN` level and above in development and at `ERROR` level and above in production. |
| `sampling::enabled` | `true` | Sets a sampling policy. |
| `sampling::tick` | `10s` | The interval in seconds that the logger applies to each sampling. |
| `sampling::initial` | `10` | The number of messages logged at the start of each `sampling::tick`. |
| `sampling::thereafter` | `100` | Sets the sampling policy for subsequent messages after `sampling::initial` messages are logged. When `sampling::thereafter` is set to `N`, every `Nth` message is logged and all others are dropped. If `N` is zero, the logger drops all messages after `sampling::initial` messages are logged. |
| `output_paths` | `["stderr"]` | A list of URLs or file paths to write logging output to. |
| `error_output_paths` | `["stderr"]` | A list of URLs or file paths to write logger errors to. |
| `initial_fields` | | A collection of static key-value pairs added to all log entries to enrich logging context. By default, there is no initial field. |

You can also see logs for the Collector on a Linux systemd system using
`journalctl`:
Expand Down

0 comments on commit 744d6ab

Please sign in to comment.