|
| 1 | +--- |
| 2 | +canonical: https://grafana.com/docs/alloy/latest/reference/components/otelcol.exporter.debug/ |
| 3 | +description: Learn about otelcol.exporter.debug |
| 4 | +title: otelcol.exporter.debug |
| 5 | +--- |
| 6 | + |
| 7 | +<span class="badge docs-labels__stage docs-labels__item">Experimental</span> |
| 8 | + |
| 9 | +# otelcol.exporter.debug |
| 10 | + |
| 11 | +`otelcol.exporter.debug` accepts telemetry data from other `otelcol` components and writes them to the console (stderr). |
| 12 | +You can control the verbosity of the logs. |
| 13 | + |
| 14 | +{{< admonition type="note" >}} |
| 15 | +`otelcol.exporter.debug` is a wrapper over the upstream OpenTelemetry Collector `debug` exporter. |
| 16 | +If necessary, bug reports or feature requests are redirected to the upstream repository. |
| 17 | +{{< /admonition >}} |
| 18 | + |
| 19 | +Multiple `otelcol.exporter.debug` components can be specified by giving them different labels. |
| 20 | + |
| 21 | +## Usage |
| 22 | + |
| 23 | +```river |
| 24 | +otelcol.exporter.debug "LABEL" { } |
| 25 | +``` |
| 26 | + |
| 27 | +## Arguments |
| 28 | + |
| 29 | +`otelcol.exporter.debug` supports the following arguments: |
| 30 | + |
| 31 | +Name | Type | Description | Default | Required |
| 32 | +---- | ---- | ----------- | ------- | -------- |
| 33 | +`verbosity` | `string` | Verbosity of the generated logs. | `"normal"` | no |
| 34 | +`sampling_initial` | `int` | Number of messages initially logged each second. | `2` | no |
| 35 | +`sampling_thereafter` | `int` | Sampling rate after the initial messages are logged. | `500` | no |
| 36 | + |
| 37 | +The `verbosity` argument must be one of: |
| 38 | +* `"basic"`: A single-line summary of received data is logged to stderr, with a total count of telemetry records for every batch of received logs, metrics or traces. |
| 39 | +* `"normal"`: Currently, this produces the same output as `"basic"` verbosity. |
| 40 | +* `"detailed"`: All details of every telemetry record are logged to stderr, typically writing multiple lines for every telemetry record. |
| 41 | + |
| 42 | +Example of `"basic"` and `"normal"` output: |
| 43 | +``` |
| 44 | +ts=2024-06-13T11:24:13.782957Z level=info msg=TracesExporter component_path=/ component_id=otelcol.exporter.debug.default "resource spans": 1, spans: 2 |
| 45 | +``` |
| 46 | + |
| 47 | +Example of `"detailed"` output: |
| 48 | +``` |
| 49 | +ts=2024-06-13T11:24:13.782957Z level=info msg=TracesExporter component_path=/ component_id=otelcol.exporter.debug.default "resource spans"=1 spans=2 |
| 50 | +ts=2024-06-13T11:24:13.783101Z level=info msg="ResourceSpans #0 |
| 51 | +Resource SchemaURL: https://opentelemetry.io/schemas/1.4.0 |
| 52 | +Resource attributes: |
| 53 | + -> service.name: Str(telemetrygen) |
| 54 | +ScopeSpans #0 |
| 55 | +ScopeSpans SchemaURL: |
| 56 | +InstrumentationScope telemetrygen |
| 57 | +Span #0 |
| 58 | + Trace ID : 3bde5d3ee82303571bba6e1136781fe4 |
| 59 | + Parent ID : 5e9dcf9bac4acc1f |
| 60 | + ID : 2cf3ef2899aba35c |
| 61 | + Name : okey-dokey |
| 62 | + Kind : Server |
| 63 | + Start time : 2023-11-11 04:49:03.509369393 +0000 UTC |
| 64 | + End time : 2023-11-11 04:49:03.50949377 +0000 UTC |
| 65 | + Status code : Unset |
| 66 | + Status message : |
| 67 | +Attributes: |
| 68 | + -> net.peer.ip: Str(1.2.3.4) |
| 69 | + -> peer.service: Str(telemetrygen-client) |
| 70 | +Span #1 |
| 71 | + Trace ID : 3bde5d3ee82303571bba6e1136781fe4 |
| 72 | + Parent ID : |
| 73 | + ID : 5e9dcf9bac4acc1f |
| 74 | + Name : lets-go |
| 75 | + Kind : Client |
| 76 | + Start time : 2023-11-11 04:49:03.50935117 +0000 UTC |
| 77 | + End time : 2023-11-11 04:49:03.50949377 +0000 UTC |
| 78 | + Status code : Unset |
| 79 | + Status message : |
| 80 | +Attributes: |
| 81 | + -> net.peer.ip: Str(1.2.3.4) |
| 82 | + -> peer.service: Str(telemetrygen-server) |
| 83 | + {"kind": "exporter", "data_type": "traces", "name": "debug"}" |
| 84 | +``` |
| 85 | + |
| 86 | +Note that the above `"detailed"` example was edited to replace all instances of `\n` with a new line. |
| 87 | + |
| 88 | +## Blocks |
| 89 | + |
| 90 | +The following blocks are supported inside the definition of |
| 91 | +`otelcol.exporter.debug`: |
| 92 | + |
| 93 | +Hierarchy | Block | Description | Required |
| 94 | +--------------|-------------------|----------------------------------------------------------------------------|--------- |
| 95 | +debug_metrics | [debug_metrics][] | Configures the metrics that this component generates to monitor its state. | no |
| 96 | + |
| 97 | +The `>` symbol indicates deeper levels of nesting. For example, `client > tls` |
| 98 | +refers to a `tls` block defined inside a `client` block. |
| 99 | + |
| 100 | +[debug_metrics]: #debug_metrics-block |
| 101 | + |
| 102 | +### debug_metrics block |
| 103 | + |
| 104 | +{{< docs/shared lookup="reference/components/otelcol-debug-metrics-block.md" source="alloy" version="<ALLOY_VERSION>" >}} |
| 105 | + |
| 106 | +## Exported fields |
| 107 | + |
| 108 | +The following fields are exported and can be referenced by other components: |
| 109 | + |
| 110 | +Name | Type | Description |
| 111 | +---- | ---- | ----------- |
| 112 | +`input` | `otelcol.Consumer` | A value that other components can use to send telemetry data to. |
| 113 | + |
| 114 | +`input` accepts `otelcol.Consumer` data for any telemetry signal (metrics, |
| 115 | +logs, or traces). |
| 116 | + |
| 117 | +## Component health |
| 118 | + |
| 119 | +`otelcol.exporter.debug` is only reported as unhealthy if given an invalid |
| 120 | +configuration. |
| 121 | + |
| 122 | +## Debug information |
| 123 | + |
| 124 | +`otelcol.exporter.debug` does not expose any component-specific debug |
| 125 | +information. |
| 126 | + |
| 127 | +## Example |
| 128 | + |
| 129 | +This example scrapes Prometheus UNIX metrics and writes them to the console: |
| 130 | + |
| 131 | +```river |
| 132 | +prometheus.exporter.unix "default" { } |
| 133 | +
|
| 134 | +prometheus.scrape "default" { |
| 135 | + targets = prometheus.exporter.unix.default.targets |
| 136 | + forward_to = [otelcol.receiver.prometheus.default.receiver] |
| 137 | +} |
| 138 | +
|
| 139 | +otelcol.receiver.prometheus "default" { |
| 140 | + output { |
| 141 | + metrics = [otelcol.exporter.debug.default.input] |
| 142 | + } |
| 143 | +} |
| 144 | +
|
| 145 | +otelcol.exporter.debug "default" { |
| 146 | + verbosity = "detailed" |
| 147 | + sampling_initial = 1 |
| 148 | + sampling_thereafter = 1 |
| 149 | +} |
| 150 | +``` |
| 151 | +<!-- START GENERATED COMPATIBLE COMPONENTS --> |
| 152 | + |
| 153 | +## Compatible components |
| 154 | + |
| 155 | +`otelcol.exporter.debug` has exports that can be consumed by the following components: |
| 156 | + |
| 157 | +- Components that consume [OpenTelemetry `otelcol.Consumer`](../../compatibility/#opentelemetry-otelcolconsumer-consumers) |
| 158 | + |
| 159 | +{{< admonition type="note" >}} |
| 160 | +Connecting some components may not be sensible or components may require further configuration to make the connection work correctly. |
| 161 | +Refer to the linked documentation for more details. |
| 162 | +{{< /admonition >}} |
| 163 | + |
| 164 | +<!-- END GENERATED COMPATIBLE COMPONENTS --> |
0 commit comments