From 744d6ab0f41e0b67d00faddee621dcf1e0159e25 Mon Sep 17 00:00:00 2001 From: Tiffany Hrabusa <30397949+tiffany76@users.noreply.github.com> Date: Tue, 21 May 2024 08:57:16 -0400 Subject: [PATCH 1/3] Remove duplicate content from Collector config page (#4504) --- content/en/docs/collector/configuration.md | 93 +------------------ .../en/docs/collector/internal-telemetry.md | 33 ++++--- 2 files changed, 26 insertions(+), 100 deletions(-) diff --git a/content/en/docs/collector/configuration.md b/content/en/docs/collector/configuration.md index 4cf07ed66e9e..f815f86f6a20 100644 --- a/content/en/docs/collector/configuration.md +++ b/content/en/docs/collector/configuration.md @@ -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 . -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 diff --git a/content/en/docs/collector/internal-telemetry.md b/content/en/docs/collector/internal-telemetry.md index f750dcdaa1b6..3dfdad230978 100644 --- a/content/en/docs/collector/internal-telemetry.md +++ b/content/en/docs/collector/internal-telemetry.md @@ -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: @@ -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`: From 44dca8ba44ddb6583708b388ef16d9e86882677f Mon Sep 17 00:00:00 2001 From: Sergey Fedchenko <1924898+seregayoga@users.noreply.github.com> Date: Tue, 21 May 2024 15:24:43 +0200 Subject: [PATCH 2/3] Update getting-started.md (#4507) --- content/en/docs/languages/go/getting-started.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/content/en/docs/languages/go/getting-started.md b/content/en/docs/languages/go/getting-started.md index 3a044b22f6a6..4f7baea20e52 100644 --- a/content/en/docs/languages/go/getting-started.md +++ b/content/en/docs/languages/go/getting-started.md @@ -110,12 +110,16 @@ Install the following packages: go get "go.opentelemetry.io/otel" \ "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" \ "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" \ + "go.opentelemetry.io/otel/exporters/stdout/stdoutlog" \ + "go.opentelemetry.io/otel/sdk/log" \ + "go.opentelemetry.io/otel/log/global" \ "go.opentelemetry.io/otel/propagation" \ "go.opentelemetry.io/otel/sdk/metric" \ "go.opentelemetry.io/otel/sdk/resource" \ "go.opentelemetry.io/otel/sdk/trace" \ "go.opentelemetry.io/otel/semconv/v1.24.0" \ - "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"\ + "go.opentelemetry.io/contrib/bridges/otelslog" ``` This installs OpenTelemetry SDK components and `net/http` instrumentation. From 0ba998bd8548f0204ab953b9ee2f8160d2933565 Mon Sep 17 00:00:00 2001 From: Juliano Costa Date: Wed, 22 May 2024 12:15:01 +0200 Subject: [PATCH 3/3] Remove `future` from logs (#4514) --- content/en/docs/collector/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/docs/collector/_index.md b/content/en/docs/collector/_index.md index 0ccc245e7759..d532807b4d30 100644 --- a/content/en/docs/collector/_index.md +++ b/content/en/docs/collector/_index.md @@ -28,7 +28,7 @@ export their telemetry data. - _Observability_: An exemplar of an observable service. - _Extensibility_: Customizable without touching the core code. - _Unification_: Single codebase, deployable as an agent or collector with - support for traces, metrics, and logs (future). + support for traces, metrics, and logs. ## When to use a collector