Skip to content

Commit

Permalink
Add otlp_file exporter (#154)
Browse files Browse the repository at this point in the history
* Add otlp_file exporter
Adding the in-development otlp_file exporter from https://github.com/open-telemetry/opentelemetry-specification/blob/v1.40.0/specification/protocol/file-exporter.md

* apply review feedback
document and add examples for file:// and stdout methods of defining output_stream
expand kitchen-sink examples

* Formatting in type_descriptions.yaml

---------

Co-authored-by: Jack Berg <[email protected]>
  • Loading branch information
brettmc and jack-berg authored Jan 15, 2025
1 parent 5901c77 commit 30fb26e
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 0 deletions.
72 changes: 72 additions & 0 deletions examples/kitchen-sink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,26 @@ logger_provider:
# Only applicable when .endpoint is provided without http or https scheme. Implementations may choose to ignore .insecure.
# If omitted or null, false is used.
insecure: false
- # Configure a batch log record processor.
batch:
# Configure exporter.
exporter:
# Configure exporter to be OTLP with file transport.
otlp_file:
# Configure output stream.
# Values include stdout, or scheme+destination. For example: file:///path/to/file.jsonl.
# If omitted or null, stdout is used.
output_stream: file:///var/log/logs.jsonl
- # Configure a batch log record processor.
batch:
# Configure exporter.
exporter:
# Configure exporter to be OTLP with file transport.
otlp_file:
# Configure output stream.
# Values include stdout, or scheme+destination. For example: file:///path/to/file.jsonl.
# If omitted or null, stdout is used.
output_stream: stdout
- # Configure a simple log record processor.
simple:
# Configure exporter.
Expand Down Expand Up @@ -297,6 +317,38 @@ meter_provider:
# Values include: explicit_bucket_histogram, base2_exponential_bucket_histogram. For behavior of values, see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md.
# If omitted or null, explicit_bucket_histogram is used.
default_histogram_aggregation: base2_exponential_bucket_histogram
- # Configure a periodic metric reader.
periodic:
# Configure exporter.
exporter:
# Configure exporter to be OTLP with file transport.
otlp_file:
# Configure output stream.
# Values include stdout, or scheme+destination. For example: file:///path/to/file.jsonl.
# If omitted or null, stdout is used.
output_stream: file:///var/log/metrics.jsonl
# Configure temporality preference. Values include: cumulative, delta, low_memory. For behavior of values, see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md.
# If omitted or null, cumulative is used.
temporality_preference: delta
# Configure default histogram aggregation. Values include: explicit_bucket_histogram, base2_exponential_bucket_histogram. For behavior of values, see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md.
# If omitted or null, explicit_bucket_histogram is used.
default_histogram_aggregation: base2_exponential_bucket_histogram
- # Configure a periodic metric reader.
periodic:
# Configure exporter.
exporter:
# Configure exporter to be OTLP with file transport.
otlp_file:
# Configure output stream.
# Values include stdout, or scheme+destination. For example: file:///path/to/file.jsonl.
# If omitted or null, stdout is used.
output_stream: stdout
# Configure temporality preference. Values include: cumulative, delta, low_memory. For behavior of values, see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md.
# If omitted or null, cumulative is used.
temporality_preference: delta
# Configure default histogram aggregation. Values include: explicit_bucket_histogram, base2_exponential_bucket_histogram. For behavior of values, see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md.
# If omitted or null, explicit_bucket_histogram is used.
default_histogram_aggregation: base2_exponential_bucket_histogram
- # Configure a periodic metric reader.
periodic:
# Configure exporter.
Expand Down Expand Up @@ -488,6 +540,26 @@ tracer_provider:
# Only applicable when .endpoint is provided without http or https scheme. Implementations may choose to ignore .insecure.
# If omitted or null, false is used.
insecure: false
- # Configure a batch span processor.
batch:
# Configure exporter.
exporter:
# Configure exporter to be OTLP with file transport.
otlp_file:
# Configure output stream.
# Values include stdout, or scheme+destination. For example: file:///path/to/file.jsonl.
# If omitted or null, stdout is used.
output_stream: file:///var/log/traces.jsonl
- # Configure a batch span processor.
batch:
# Configure exporter.
exporter:
# Configure exporter to be OTLP with file transport.
otlp_file:
# Configure output stream.
# Values include stdout, or scheme+destination. For example: file:///path/to/file.jsonl.
# If omitted or null, stdout is used.
output_stream: stdout
- # Configure a batch span processor.
batch:
# Configure exporter.
Expand Down
9 changes: 9 additions & 0 deletions schema/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@
}
}
},
"OtlpFileExporter": {
"type": ["object", "null"],
"additionalProperties": false,
"properties": {
"output_stream": {
"type": ["string", "null"]
}
}
},
"ConsoleExporter": {
"type": ["object", "null"],
"additionalProperties": false
Expand Down
3 changes: 3 additions & 0 deletions schema/logger_provider.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
"otlp_grpc": {
"$ref": "common.json#/$defs/OtlpGrpcExporter"
},
"otlp_file": {
"$ref": "common.json#/$defs/OtlpFileExporter"
},
"console": {
"$ref": "common.json#/$defs/ConsoleExporter"
}
Expand Down
18 changes: 18 additions & 0 deletions schema/meter_provider.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@
"otlp_grpc": {
"$ref": "#/$defs/OtlpGrpcMetricExporter"
},
"otlp_file": {
"$ref": "#/$defs/OtlpFileMetricExporter"
},
"console": {
"$ref": "common.json#/$defs/ConsoleExporter"
}
Expand Down Expand Up @@ -279,6 +282,21 @@
}
}
},
"OtlpFileMetricExporter": {
"type": ["object", "null"],
"additionalProperties": false,
"properties": {
"output_stream": {
"type": ["string", "null"]
},
"temporality_preference": {
"$ref": "#/$defs/ExporterTemporalityPreference"
},
"default_histogram_aggregation": {
"$ref": "#/$defs/ExporterDefaultHistogramAggregation"
}
}
},
"View": {
"type": "object",
"additionalProperties": false,
Expand Down
3 changes: 3 additions & 0 deletions schema/tracer_provider.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@
"otlp_grpc": {
"$ref": "common.json#/$defs/OtlpGrpcExporter"
},
"otlp_file": {
"$ref": "common.json#/$defs/OtlpFileExporter"
},
"console": {
"$ref": "common.json#/$defs/ConsoleExporter"
},
Expand Down
15 changes: 15 additions & 0 deletions schema/type_descriptions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
property_descriptions:
otlp_http: Configure exporter to be OTLP with HTTP transport.
otlp_grpc: Configure exporter to be OTLP with gRPC transport.
otlp_file: Configure exporter to be OTLP with file transport.
console: Configure exporter to be console.
path_patterns:
- .logger_provider.processors[].*.exporter
Expand Down Expand Up @@ -250,6 +251,7 @@
property_descriptions:
otlp_http: Configure exporter to be OTLP with HTTP transport.
otlp_grpc: Configure exporter to be OTLP with gRPC transport.
otlp_file: Configure exporter to be OTLP with file transport.
zipkin: Configure exporter to be zipkin.
console: Configure exporter to be console.
path_patterns:
Expand Down Expand Up @@ -409,6 +411,7 @@
prometheus: Configure exporter to be prometheus.
otlp_http: Configure exporter to be OTLP with HTTP transport.
otlp_grpc: Configure exporter to be OTLP with gRPC transport.
otlp_file: Configure exporter to be OTLP with file transport.
console: Configure exporter to be console.
path_patterns:
- .meter_provider.readers[].*.exporter
Expand Down Expand Up @@ -664,6 +667,18 @@
- .tracer_provider.processors[].*.exporter.otlp_grpc
- .logger_provider.processors[].*.exporter.otlp_grpc
- .meter_provider.readers[].periodic.exporter.otlp_grpc
- type: OtlpFileExporter
property_descriptions:
output_stream: >
Configure output stream.
Values include stdout, or scheme+destination. For example: file:///path/to/file.jsonl.
If omitted or null, stdout is used.
path_patterns:
- .tracer_provider.processors[].*.exporter.otlp_file
- .logger_provider.processors[].*.exporter.otlp_file
- .meter_provider.readers[].periodic.exporter.otlp_file
# END common

# START Instrumentation
Expand Down

0 comments on commit 30fb26e

Please sign in to comment.