mirror of
https://github.com/hanzoai/otel-collector.git
synced 2026-11-03 02:20:04 +00:00
luxfi/zap v1.2.7 exports Network(addr): a path is unix, anything else is host:port tcp. The receiver had its own parser and the exporter a mirror of the same rule, so three copies decided one thing. Both call Network now. The receiver's own parser also accepted a unix:// URL, which the rule does not define; the test asserting it asserted an invention. Abstract sockets (@name) and ../ paths, which the rule does define, are covered instead. Stale-socket clearing follows the rule too: a socket left by a dead process is removed, one something is listening on is refused. Start unlinked whatever was there, so a second receiver silently took an address the first was serving. luxfi/zap v1.2.6 -> v1.2.7.
34 lines
938 B
Go
34 lines
938 B
Go
package zapreceiver
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/luxfi/zap"
|
|
)
|
|
|
|
// Config configures the ZAP-native OTLP receiver.
|
|
type Config struct {
|
|
// Endpoint is what the ZAP listener binds. The wire is ZAP frames
|
|
// (zap-proto/http), not OTLP-HTTP/gRPC.
|
|
//
|
|
// A host:port binds TCP; a path binds a Unix socket, which is how a
|
|
// process on the same host reaches the agent without a port. Default
|
|
// "0.0.0.0:4319".
|
|
Endpoint string `mapstructure:"endpoint"`
|
|
}
|
|
|
|
// Network returns the net.Listen network and address for Endpoint, from
|
|
// luxfi/zap's rule — the one the dialer uses too, so a node cannot bind one
|
|
// transport and be dialled on another.
|
|
func (c *Config) Network() (network, address string) {
|
|
return zap.Network(c.Endpoint), c.Endpoint
|
|
}
|
|
|
|
// Validate implements component.ConfigValidator.
|
|
func (c *Config) Validate() error {
|
|
if c.Endpoint == "" {
|
|
return errors.New("zapreceiver: endpoint must be set")
|
|
}
|
|
return nil
|
|
}
|