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

Add OTLP stdout exporter #4183

Merged
merged 22 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 20 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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@ release.

### Traces

- Add in-development support for `otlp/stdout` exporter via `OTEL_TRACES_EXPORTER`.
([#4183](https://github.com/open-telemetry/opentelemetry-specification/pull/4183))

### Metrics

- Add in-development support for `otlp/stdout` exporter via `OTEL_METRICS_EXPORTER`.
([#4183](https://github.com/open-telemetry/opentelemetry-specification/pull/4183))

### Logs

- Add in-development support for `otlp/stdout` exporter via `OTEL_LOGS_EXPORTER`.
([#4183](https://github.com/open-telemetry/opentelemetry-specification/pull/4183))

### Events

### Baggage
Expand Down
19 changes: 19 additions & 0 deletions specification/configuration/sdk-environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ aliases:
- [Zipkin Exporter](#zipkin-exporter)
- [Prometheus Exporter](#prometheus-exporter)
- [Exporter Selection](#exporter-selection)
* [In-development Exporter Selection](#in-development-exporter-selection)
- [Metrics SDK Configuration](#metrics-sdk-configuration)
* [Exemplar](#exemplar)
* [Periodic exporting MetricReader](#periodic-exporting-metricreader)
Expand Down Expand Up @@ -270,6 +271,24 @@ Known values for `OTEL_LOGS_EXPORTER` are:
NOT be supported by new implementations.
- `"none"`: No automatically configured exporter for logs.

### In-development Exporter Selection

**Status**: [Development](../document-status.md)

In addition to the above, the following environment variables are added for in-development exporter selection:

Additional known values for `OTEL_TRACES_EXPORTER` are:

- `"otlp/stdout"`: [OTLP File](../protocol/file-exporter.md) writing to standard output

Additional known values for `OTEL_METRICS_EXPORTER` are:

- `"otlp/stdout"`: [OTLP File](../protocol/file-exporter.md) writing to standard output

Additional known values for `OTEL_LOGS_EXPORTER` are:

- `"otlp/stdout"`: [OTLP File](../protocol/file-exporter.md) writing to standard output

## Metrics SDK Configuration

### Exemplar
Expand Down
33 changes: 33 additions & 0 deletions specification/protocol/file-exporter.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,46 @@ Currently, it only describes the serialization of OpenTelemetry data to the OTLP

## Table of Contents

- [Use Cases](#use-cases)
- [Exporter configuration](#exporter-configuration)
- [Programmatic configuration](#programmatic-configuration)
- [JSON File serialization](#json-file-serialization)
- [File storage requirements](#file-storage-requirements)
- [JSON lines file](#json-lines-file)
- [Streaming appending](#streaming-appending)
- [Telemetry data requirements](#telemetry-data-requirements)
- [Examples](#examples)

## Use Cases

Why do we need a file exporter - why not just use the OTLP exporter?

- *Faas*: In a FaaS environment, the OTLP exporter may not be able to send data to a collector.
- *Consistent log scraping from pods*: In a Kubernetes environment, logs are often scraped from the stdout pod file.
This exporter can be used to write logs to stdout - which makes it easier to integrate with existing log scraping tools.
Existing solutions add metadata, such as the trace ID, to the log line,
which needs manual configuration and is error-prone.
- *Reliability*: Writing to a file is more reliable than sending data over the network.
zeitlinger marked this conversation as resolved.
Show resolved Hide resolved

## Exporter configuration

The metric exporter MUST support the environment variables defined in the
[OTLP Exporter](../metrics/sdk_exporters/otlp.md#additional-environment-variable-configuration)
specification.

If a language provides a mechanism to automatically configure a
span or logs processor to pair with the associated
exporter (e.g., using the [`OTEL_TRACES_EXPORTER` environment
variable](../configuration/sdk-environment-variables.md#exporter-selection)), by
default the OpenTelemetry Protocol File Exporter SHOULD be paired with a batching
processor.

### Programmatic configuration

| Requirement | Name | Description | Default |
|-------------|----------------------------|--------------------------------------------------------------------------------------------------------|---------|
| MUST | output stream (or similar) | Configure output stream. This SHOULD include the possibility to configure the output stream to a file. | stdout |

## JSON File serialization

This document describes the serialization of OpenTelemetry data as JSON objects that can be stored in files.
Expand Down
Loading