DataDog / uwsgi-dogstatsd

uwsgi dogstatsd plugin
http://www.datadog.com
Other
28 stars 29 forks source link

Unable to load uWSGI plugin when datadog agent is run in separate container #12

Closed rdempsey closed 7 years ago

rdempsey commented 7 years ago

I'm having an issue running the plugin. My setup is the following:

Docker Container 1

Docker Container 2

I have application metrics from Container 1 successfully being sent to dogstatsd in Container 2, and metrics appear in DD.

The plugin appears to install correctly during the Docker build process and I see the following lines confirming it:

Step 13/15 : RUN uwsgi --build-plugin https://github.com/Datadog/uwsgi-dogstatsd
 ---> Running in 7695a0bad109
[uWSGI] getting INI configuration from /app/uwsgi.ini
open("./dogstatsd_plugin.so"): No such file or directory [core/utils.c line 3686]
!!! UNABLE to load uWSGI plugin: ./dogstatsd_plugin.so: cannot open shared object file: No such file or directory !!!
Cloning into 'uwsgi-dogstatsd'...
*** uWSGI building and linking plugin from https://github.com/Datadog/uwsgi-dogstatsd ***
[gcc -pthread] dogstatsd_plugin.so
build time: 0 seconds
*** dogstatsd plugin built and available in dogstatsd_plugin.so ***

When I add the following lines to my uwsgi.ini file:

enable-metrics = true
plugin = dogstatsd
stats-push = dogstatsd:172.17.0.2:8125,mapi

and then rebuild the container and attempt to start it, I receive the following error:

!!! UNABLE to load uWSGI plugin: ./dogstatsd_plugin.so: cannot open shared object file: No such file or directory !!!

[uWSGI] getting INI configuration from /etc/uwsgi/uwsgi.ini

unable to find "dogstatsd" stats_pusher

2017-08-16 13:44:27,629 INFO exited: uwsgi (exit status 1; not expected)

2017-08-16 13:44:30,638 INFO spawned: 'uwsgi' with pid 16

[uWSGI] getting INI configuration from /app/uwsgi.ini

open("./dogstatsd_plugin.so"): No such file or directory [core/utils.c line 3686]

!!! UNABLE to load uWSGI plugin: ./dogstatsd_plugin.so: cannot open shared object file: No such file or directory !!!

[uWSGI] getting INI configuration from /etc/uwsgi/uwsgi.ini

unable to find "dogstatsd" stats_pusher

Am I required to have dogstatsd installed on the same container in which I'm running my uwsgi application in order to use this plugin?

Thank you for your help!

rdempsey commented 7 years ago

Figured this one out - apparently the compiled plugin file was sitting in my /app directory and needed to be copied to the root directory to work.

davidmontoyago commented 3 years ago

The dogstatsd_plugin.so must be placed at the directory where the app starts. In my case it was the Dockerfile's WORKDIR.