-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unix Domain Socket support (StatsD) #792
Comments
This would be really useful in a Kubernetes environment for adding various deployment details, container, and k8s tags to the metrics. We've experimented with different approaches for the DD reporter for Dropwizard metrics and UDS was the easiest to get up and running. Support here (and so for Spring Boot 2.x) would be great. |
@jonnywray Could you elaborate on why a different transport is related to additional tags? |
For sure. In k8s the application knows nothing about the deployment environment, but of course it's useful for custom metrics coming from an app to have those, e.g. k8s namespace, host name, container details, etc. Using the DD API is out as that means the app needs the values. There are two recommended ways of dealing with it outlined in the DD docs (https://docs.datadoghq.com/agent/kubernetes/dogstatsd/) and we've found the unix domain socket approach much easier to get going. And I think is the recommended approach now. Once this is working the various docker and k8s tags are added automatically to your custom metrics. I tried the other approach, using a k8s hostPort and DogStatsD instance, but could never get it to work. There is a work around using DD API. You can use the k8s downward api to add environment variable to your application deployment and use them as custom tags in a MeterRegistryCustomizer. But, you don't get all available tags this way (e.g. docker image details) and automated tagging would be great. |
Cool, thanks! Sounds like a very useful feature. |
This feature could potentially work around containernetworking/plugins#123 for Datadog agent? |
@PandaXass I believe so, as the connection will be through the socket, not via the port mapped via hostPort. |
Something like this would need to be added: https://github.com/Frankqsy/netty-sample/blob/master/netty-client/src/main/java/org/daisy/stevin/netty/sample/client/uds/UdsClient.java |
looking forward to be implemented, it is very useful for k8s integrate with Datadog! |
@jkschneider Any updates on the progress of this? |
Due to the apparent interest in this new feature, I'm tentatively scheduling this for the 1.5 release. It still has the |
@pboado yes, I suppose it is that simple. Though to be fair, that support was added to reactor-netty long after this issue was originally opened. We would need to upgrade reactor-netty for that to be available, which we had issues doing before and so the upgrade got backed out. We're planning to upgrade for the Micrometer 1.8 release, so I'll target this at the 1.8 release now that it is clear how we can easily support this with minimal maintenance on our side. |
I'm pretty sure the shaded version of reactor-netty packed with micrometer already includes the functionality. |
While the netty class may be available, support for UDS was not added to reactor-netty until 1.0.0. See reactor/reactor-netty#403 |
Fair enough, thanks for looking into this. |
Now that we have the upgrade to Reactor 2020.0 in main, I was trying to implement this using the netty/reactor-netty features. Unfortunate news is that dogstatsd is listening on a datagram type domain socket, and netty only supports stream domain sockets currently. There is netty/netty#6737 open to add datagram support but no release targeted. This means we can't just use the features offered by netty/reactor-netty to get this, as we hoped. It might be easier to implement this ourselves with JEP 380 but that is only available from JDK 16. |
Hello! I maintain a fork of a dropwizard plugin for datadog that was originally done to enable the UDS support within. I say the following with little regard for the impacts, but If you were to split of the datadog implementation to be it's "own thing" and make use of the "official" dogstatsd library you can put the responsibility for the odd implementation there. Not sure if there are other... liberties... to the statsd implementation they have taken, that could also be leveraged by using their library. If you make use of that, they did a cute (?) thing where you specify the port as zero, and the hostname becomes a pathname to the socket. I just noticed you were considering differing implementations, and thought I would throw this out as a potential approach to isolate the datadog-isms and keep your statsd client implementation from having to deal with those kinds of concerns. That said, perhaps UDS is useful elsewhere too. Their implementation makes use of the jnr-unixsocket library. Nice to know future JDKs will have some native support for UDS, as it does get a bit awkward to use from java today/ Anyways, just wanted to reach out and see if I could do anything however small to help. We make some heavy use of UDS support and there is a lot of interest in micrometer too, so there are several sets of eyeballs tracking this item over here, and possibly able to help in some way. |
Looks like the needed support in reactor just dropped in reactor/reactor-netty#1741 |
Utilizes the support in Netty and Reactor Netty for Unix domain socket datagram protocol via the `UdpClient`. The StatsdConfig `host` should be the path to the socket when the `protocol` is configured to `UDS_DATAGRAM`. Resolves gh-792
It's been a long wait, but support for datagram Unix domain socket protocol has just now landed for the StatsdMeterRegistry. It is available for early testing in |
Is there any official docs on how to set this up? |
Only in javadocs, see: Lines 76 to 82 in 4f4cbe2
and Lines 27 to 31 in 4f4cbe2
But most probably you use a framework which might have a property for this, e.g. if you use Spring Boot: https://docs.spring.io/spring-boot/reference/actuator/metrics.html#actuator.metrics.export.statsd Please feel free to create an issue/PR to add a note to our docs about changing the protocol. |
Is the host setting supposed to be unix:///var/run/datadog/dsd.socket or just /var/run/datadog/dsd.socket ? |
This. We should document this. I've opened #5730 for adding documentation |
java-dogstatsd-client is going to support Unix Domain Socket (see DataDog/java-dogstatsd-client#42)
is Micrometer is going to support it too?
https://docs-staging.datadoghq.com/xvello/dsd_uds/developers/dogstatsd/unix_socket/
https://github.com/DataDog/datadog-agent/wiki/Unix-Domain-Sockets-support
https://github.com/DataDog/java-dogstatsd-client#unix-domain-socket-support
The text was updated successfully, but these errors were encountered: