mirror of
https://github.com/hanzoai/otel-collector.git
synced 2026-11-03 02:20:04 +00:00
The wire was fixed; the TRANSPORT was still one size. Every hop dialled plain
TCP, including the node-agent -> collector hop, which carries every pod's log
bodies from 18 nodes across the cluster network. That is precisely the traffic
that should not be readable in transit.
Now the address SHAPE picks the transport, which is luxfi/zap's own rule
(Network(addr): a path is unix, anything else is host:port) used by listener and
dialer alike, so a node can never bind one transport and be dialled on another:
same process -> no exporter; call the consumer directly
same machine -> Endpoint is a socket path -> UDS, no network stack, no port
remote host -> host:port + transport: quic -> QUIC, whose TLS 1.3 negotiates
X25519MLKEM768 (X-Wing) by default on Go 1.26, so the session
key is quantum-secure with no per-caller crypto config
UDS costs nothing to adopt: pass a path as the endpoint and both ends agree.
QUIC is a DEPLOY GATE, not a config value, and the test found that rather than my
assuming it: the factory is registered (anonymous quic import), but Start refuses
without NodeConfig.TLS server certificates because QUIC has no plaintext mode. So
a remote hop needs a KMS-provisioned cert. TestQUICTransportIsLinkedAndNeedsTLS
asserts BOTH halves so nobody reads 'transport: quic' and concludes the hop is
encrypted; asking for quic on a socket path is refused at validation rather than
silently ignored.
Also corrected defaultEndpoint: it named otel-collector.hanzo.svc:4319, a service
and port that serve neither logs nor this wire. Now cloud.hanzo.svc:4318.
Co-authored-by: Hanzo Dev <[email protected]>
81 lines
2.7 KiB
Go
81 lines
2.7 KiB
Go
package zapexporter
|
|
|
|
import (
|
|
"context"
|
|
|
|
"go.opentelemetry.io/collector/component"
|
|
"go.opentelemetry.io/collector/config/configoptional"
|
|
"go.opentelemetry.io/collector/config/configretry"
|
|
"go.opentelemetry.io/collector/exporter"
|
|
"go.opentelemetry.io/collector/exporter/exporterhelper"
|
|
|
|
// Registers the QUIC transport factory at init so Config.Transport "quic" is
|
|
// actually available; without it luxfi/zap returns ErrTransportUnavailable.
|
|
// QUIC is the REMOTE hop: its TLS 1.3 negotiates X25519MLKEM768 (X-Wing) by
|
|
// default on Go 1.26, so cross-machine telemetry is quantum-secure.
|
|
_ "github.com/luxfi/zap/quic"
|
|
)
|
|
|
|
var typeStr = component.MustNewType("zap")
|
|
|
|
const (
|
|
defaultEndpoint = "cloud.hanzo.svc:4318"
|
|
stability = component.StabilityLevelBeta
|
|
)
|
|
|
|
// NewFactory returns the ZAP-native OTLP exporter factory.
|
|
func NewFactory() exporter.Factory {
|
|
return exporter.NewFactory(
|
|
typeStr,
|
|
createDefaultConfig,
|
|
exporter.WithTraces(createTraces, stability),
|
|
exporter.WithLogs(createLogs, stability),
|
|
exporter.WithMetrics(createMetrics, stability),
|
|
)
|
|
}
|
|
|
|
func createDefaultConfig() component.Config {
|
|
return &Config{
|
|
Endpoint: defaultEndpoint,
|
|
TimeoutConfig: exporterhelper.NewDefaultTimeoutConfig(),
|
|
QueueBatchConfig: configoptional.Some(exporterhelper.NewDefaultQueueConfig()),
|
|
BackOffConfig: configretry.NewDefaultBackOffConfig(),
|
|
}
|
|
}
|
|
|
|
func createTraces(ctx context.Context, set exporter.Settings, cfg component.Config) (exporter.Traces, error) {
|
|
c := cfg.(*Config)
|
|
e := newExporter(set, c)
|
|
return exporterhelper.NewTraces(ctx, set, cfg, e.pushTraces,
|
|
exporterhelper.WithStart(e.Start),
|
|
exporterhelper.WithShutdown(e.Shutdown),
|
|
exporterhelper.WithTimeout(c.TimeoutConfig),
|
|
exporterhelper.WithQueue(c.QueueBatchConfig),
|
|
exporterhelper.WithRetry(c.BackOffConfig),
|
|
)
|
|
}
|
|
|
|
func createLogs(ctx context.Context, set exporter.Settings, cfg component.Config) (exporter.Logs, error) {
|
|
c := cfg.(*Config)
|
|
e := newExporter(set, c)
|
|
return exporterhelper.NewLogs(ctx, set, cfg, e.pushLogs,
|
|
exporterhelper.WithStart(e.Start),
|
|
exporterhelper.WithShutdown(e.Shutdown),
|
|
exporterhelper.WithTimeout(c.TimeoutConfig),
|
|
exporterhelper.WithQueue(c.QueueBatchConfig),
|
|
exporterhelper.WithRetry(c.BackOffConfig),
|
|
)
|
|
}
|
|
|
|
func createMetrics(ctx context.Context, set exporter.Settings, cfg component.Config) (exporter.Metrics, error) {
|
|
c := cfg.(*Config)
|
|
e := newExporter(set, c)
|
|
return exporterhelper.NewMetrics(ctx, set, cfg, e.pushMetrics,
|
|
exporterhelper.WithStart(e.Start),
|
|
exporterhelper.WithShutdown(e.Shutdown),
|
|
exporterhelper.WithTimeout(c.TimeoutConfig),
|
|
exporterhelper.WithQueue(c.QueueBatchConfig),
|
|
exporterhelper.WithRetry(c.BackOffConfig),
|
|
)
|
|
}
|