OpenTelemetry Bot d680729c09 [chore] Prepare release 0.90.0 (#29543) | 1 жил өмнө | |
---|---|---|
.. | ||
internal | 1 жил өмнө | |
testdata | 1 жил өмнө | |
Makefile | 3 жил өмнө | |
README.md | 1 жил өмнө | |
buffered_writer.go | 1 жил өмнө | |
buffered_writer_test.go | 1 жил өмнө | |
codec.go | 1 жил өмнө | |
config.go | 1 жил өмнө | |
config_test.go | 1 жил өмнө | |
doc.go | 1 жил өмнө | |
factory.go | 1 жил өмнө | |
factory_test.go | 1 жил өмнө | |
file_exporter.go | 1 жил өмнө | |
file_exporter_test.go | 1 жил өмнө | |
go.mod | 1 жил өмнө | |
go.sum | 1 жил өмнө | |
metadata.yaml | 1 жил өмнө |
Status | |
---|---|
Stability | alpha: traces, metrics, logs |
Distributions | core, contrib, aws, observiq, splunk, sumo |
Issues | |
Code Owners | @atingchen |
Exporter supports the following features:
Support for writing pipeline data to a file.
Support for rotation of telemetry files.
Support for compressing the telemetry data before exporting.
Please note that there is no guarantee that exact field names will remain stable. This intended for primarily for debugging Collector without setting up backends.
The official opentelemetry-collector-contrib container does not have a writable filesystem by default since it's built on the scratch
layer.
As such, you will need to create a writable directory for the path, potentially by mounting writable volumes or creating a custom image.
The following settings are required:
path
[no default]: where to write information.The following settings are optional:
rotation
settings to rotate telemetry files.
format
[default: json]: define the data format of encoded telemetry data. The setting can be overridden with proto
.
compression
[no default]: the compression algorithm used when exporting telemetry data to file. Supported compression algorithms:zstd
flush_interval
[default: 1s]: time.Duration
interval between flushes. See time.ParseDuration for valid formats.
NOTE: a value without unit is in nanoseconds and flush_interval
is ignored and writes are not buffered if rotation
is set.
Telemetry data is exported to a single file by default.
fileexporter
only enables file rotation when the user specifies rotation:
in the config. However, if specified, related default settings would apply.
Telemetry is first written to a file that exactly matches the path
setting.
When the file size exceeds max_megabytes
or age exceeds max_days
, the file will be rotated.
When a file is rotated, it is renamed by putting the current time in a timestamp
in the name immediately before the file's extension (or the end of the filename if there's no extension).
A new telemetry file will be created at the original path
.
For example, if your path
is data.json
and rotation is triggered, this file will be renamed to data-2022-09-14T05-02-14.173.json
, and a new telemetry file created with data.json
Telemetry data is compressed according to the compression
setting.
fileexporter
does not compress data by default.
Currently, fileexporter
support the zstd
compression algorithm, and we will support more compression algorithms in the future.
Telemetry data is encoded according to the format
setting and then written to the file.
When format
is json and compression
is none , telemetry data is written to file in JSON format. Each line in the file is a JSON object.
Otherwise, when using proto
format or any kind of encoding, each encoded object is preceded by 4 bytes (an unsigned 32 bit integer) which represent the number of bytes contained in the encoded object.When we need read the messages back in, we read the size, then read the bytes into a separate buffer, then parse from that buffer.
exporters:
file/no_rotation:
path: ./foo
file/rotation_with_default_settings:
path: ./foo
rotation:
file/rotation_with_custom_settings:
path: ./foo
rotation:
max_megabytes: 10
max_days: 3
max_backups: 3
localtime: true
format: proto
compression: zstd
file/flush_every_5_seconds:
path: ./foo
flush_interval: 5
We will follow the documentation to first install the operator in an existing cluster
and then create an OpenTelemetry Collector (otelcol) instance,
mounting an additional volume under /data
under which the file exporter will write metrics.json
:
kubectl apply -f - <<EOF
apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
name: fileexporter
spec:
config: |
receivers:
otlp:
protocols:
grpc:
http:
processors:
exporters:
debug:
file:
path: /data/metrics.json
service:
pipelines:
metrics:
receivers: [otlp]
processors: []
exporters: [debug,file]
volumes:
- name: file
emptyDir: {}
volumeMounts:
- name: file
mountPath: /data
EOF