vectordotdev / vector

A high-performance observability data pipeline.
https://vector.dev
Mozilla Public License 2.0
18.23k stars 1.6k forks source link

Support unix datagram sockets for the `statsd` sink #9952

Open anupamdialpad opened 3 years ago

anupamdialpad commented 3 years ago

Vector Version

vector 0.17.3 (x86_64-unknown-linux-gnu d72c6e7 2021-10-21)

Vector Configuration File

[sinks.datadog_metrics]
  type = "statsd"
  inputs = ["post_process_metric"]
  path = "/var/run/datadog/dsd.socket"
  mode = "unix"
  healthcheck.enabled = true

Output

{
    "error": "Connect error: Protocol wrong type for socket (os error 91)",
    "message": "Unable to connect.",
    "metadata": {
        "kind": "event",
        "level": "ERROR",
        "module_path": "vector::internal_events::unix",
        "target": "vector::internal_events::unix"
    },
    "path": "\"/var/run/datadog/dsd.socket\"",
    "timestamp": "2021-11-08T15:03:02.452638512Z"
}

Expected Behavior

Successfully send metrics over unix socket.

Additional Context

Vector container is running inside a Kubernetes pod. After transforming logs to metric we send it out to Datadog cloud through unix socket

fuchsnj commented 3 years ago

@anupamdialpad Can you confirm which software you are using that is listening on the unix socket? I'm assuming you are referring to the Datadog Agent (https://docs.datadoghq.com/developers/dogstatsd/unix_socket/?tab=host).

The vector statsd sink currently only supports connecting to unix stream sockets (which is what the traditional statsd service uses https://github.com/statsd/statsd)

The datadog agent uses unix datagram sockets, which are not currently supported.

anupamdialpad commented 3 years ago

@fuchsnj Yes you are correct, Datadog Agent is the receiver behind the unix socket. I guess as an alternative I can proxy the request to the unix datagram socket as mentioned in https://docs.datadoghq.com/developers/dogstatsd/unix_socket/?tab=host#socat-proxy.

Would be great if sending metric over unix datagram socket was implemented in Vector natively 🙂

fuchsnj commented 3 years ago

Would be great if sending metric over unix datagram socket was implemented in Vector natively slightly_smiling_face

Agreed. I will keep this issue to add support for unix datagram sockets for the statsd sink.