Documentation
¶
Overview ¶
Package oteljsonl provides file exporters for the OpenTelemetry Go SDK that persist trace, log, and metric telemetry as JSONL.
The package is compatible with:
- go.opentelemetry.io/otel/sdk/trace
- go.opentelemetry.io/otel/sdk/log
- go.opentelemetry.io/otel/sdk/metric
Exporters can share a single buffered file sink, support append mode, optionally gzip-compress payloads, and optionally encrypt payloads while keeping the outer storage format as JSONL.
Encryption supports:
- symmetric AES-256-GCM keys
- recipient-based hybrid encryption using X25519 + HKDF-SHA256 to wrap a random AES-256-GCM data key
The recipient-based mode lets exporters encrypt using only public keys, while decryption requires the matching private key.
Index ¶
- func DecodeLine(line []byte, cfg DecryptConfig) ([]byte, error)
- func GenerateX25519KeyPair() (publicKey []byte, privateKey []byte, err error)
- type Compression
- type Config
- type ConfigOption
- func WithAAD(aad []byte) ConfigOption
- func WithAppend(enabled bool) ConfigOption
- func WithAsymmetricRecipients(aad []byte, recipients ...RecipientPublicKey) ConfigOption
- func WithBufferSize(size int) ConfigOption
- func WithCompression(compression Compression) ConfigOption
- func WithCompressionLevel(level int) ConfigOption
- func WithCreateDirs(enabled bool) ConfigOption
- func WithDirMode(mode os.FileMode) ConfigOption
- func WithFileMode(mode os.FileMode) ConfigOption
- func WithFlushThresholdBytes(size int) ConfigOption
- func WithPath(path string) ConfigOption
- func WithRecipient(keyID string, publicKey []byte) ConfigOption
- func WithSymmetricEncryption(key []byte, aad []byte) ConfigOption
- func WithSyncOnFlush(enabled bool) ConfigOption
- type DecryptConfig
- type EncryptionConfig
- type Exporters
- type LogExporter
- type MetricExporter
- func (e *MetricExporter) Aggregation(kind sdkmetric.InstrumentKind) sdkmetric.Aggregation
- func (e *MetricExporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) error
- func (e *MetricExporter) ForceFlush(ctx context.Context) error
- func (e *MetricExporter) Shutdown(ctx context.Context) error
- func (e *MetricExporter) Temporality(kind sdkmetric.InstrumentKind) metricdata.Temporality
- type MetricExporterOption
- type RecipientPrivateKey
- type RecipientPublicKey
- type TraceExporter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeLine ¶
func DecodeLine(line []byte, cfg DecryptConfig) ([]byte, error)
func GenerateX25519KeyPair ¶
Types ¶
type Compression ¶
type Compression string
const ( CompressionNone Compression = "" CompressionGzip Compression = "gzip" )
type Config ¶
type Config struct {
Path string
Append bool
CreateDirs bool
DirMode os.FileMode
FileMode os.FileMode
BufferSize int
FlushThresholdBytes int
SyncOnFlush bool
Compression Compression
CompressionLevel int
Encryption EncryptionConfig
}
func NewConfig ¶
func NewConfig(opts ...ConfigOption) (Config, error)
type ConfigOption ¶
func WithAAD ¶
func WithAAD(aad []byte) ConfigOption
func WithAppend ¶
func WithAppend(enabled bool) ConfigOption
func WithAsymmetricRecipients ¶
func WithAsymmetricRecipients(aad []byte, recipients ...RecipientPublicKey) ConfigOption
func WithBufferSize ¶
func WithBufferSize(size int) ConfigOption
func WithCompression ¶
func WithCompression(compression Compression) ConfigOption
func WithCompressionLevel ¶
func WithCompressionLevel(level int) ConfigOption
func WithCreateDirs ¶
func WithCreateDirs(enabled bool) ConfigOption
func WithDirMode ¶
func WithDirMode(mode os.FileMode) ConfigOption
func WithFileMode ¶
func WithFileMode(mode os.FileMode) ConfigOption
func WithFlushThresholdBytes ¶
func WithFlushThresholdBytes(size int) ConfigOption
func WithPath ¶
func WithPath(path string) ConfigOption
func WithRecipient ¶
func WithRecipient(keyID string, publicKey []byte) ConfigOption
func WithSymmetricEncryption ¶
func WithSymmetricEncryption(key []byte, aad []byte) ConfigOption
func WithSyncOnFlush ¶
func WithSyncOnFlush(enabled bool) ConfigOption
type DecryptConfig ¶
type DecryptConfig struct {
Key []byte
AAD []byte
RecipientKeys []RecipientPrivateKey
}
type EncryptionConfig ¶
type EncryptionConfig struct {
Key []byte
AAD []byte
Recipients []RecipientPublicKey
}
type Exporters ¶
type Exporters struct {
Trace *TraceExporter
Log *LogExporter
Metric *MetricExporter
}
func NewExporters ¶
type LogExporter ¶
type LogExporter struct {
// contains filtered or unexported fields
}
func NewLogExporter ¶
func NewLogExporter(cfg Config) (*LogExporter, error)
func (*LogExporter) ForceFlush ¶
func (e *LogExporter) ForceFlush(ctx context.Context) error
type MetricExporter ¶
type MetricExporter struct {
// contains filtered or unexported fields
}
func NewMetricExporter ¶
func NewMetricExporter(cfg Config, opts ...MetricExporterOption) (*MetricExporter, error)
func (*MetricExporter) Aggregation ¶
func (e *MetricExporter) Aggregation(kind sdkmetric.InstrumentKind) sdkmetric.Aggregation
func (*MetricExporter) Export ¶
func (e *MetricExporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) error
func (*MetricExporter) ForceFlush ¶
func (e *MetricExporter) ForceFlush(ctx context.Context) error
func (*MetricExporter) Temporality ¶
func (e *MetricExporter) Temporality(kind sdkmetric.InstrumentKind) metricdata.Temporality
type MetricExporterOption ¶
type MetricExporterOption func(*MetricExporter)
func WithMetricAggregationSelector ¶
func WithMetricAggregationSelector(selector sdkmetric.AggregationSelector) MetricExporterOption
func WithMetricTemporalitySelector ¶
func WithMetricTemporalitySelector(selector sdkmetric.TemporalitySelector) MetricExporterOption
type RecipientPrivateKey ¶
type RecipientPublicKey ¶
type TraceExporter ¶
type TraceExporter struct {
// contains filtered or unexported fields
}
func NewTraceExporter ¶
func NewTraceExporter(cfg Config) (*TraceExporter, error)
func (*TraceExporter) ExportSpans ¶
func (e *TraceExporter) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error
Click to show internal directories.
Click to hide internal directories.