-
Notifications
You must be signed in to change notification settings - Fork 70
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
[service_discovery] enabling service discovery via named pipe. #113
Conversation
[service_discovery] fixing configuration. [service_discovery] store SD configs in its own cache. [service_discovery] use named pipes to receive service discovery configs. [service_discovery] parsing pipe input into config. [service_discovery] move relevant options to AppConfig. [service_discovery] fixing up service discovery config traversal. [service_discovery] only remove config from list if not a service discovery received config. [logging] prettify logging statement.
521f51f
to
67bb963
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added some minor comments, also 2 things to consider:
- this should probably come with a test or two
/tmp
is a risky choice, sometimes the agent doesn't have access to it. I guess we can keep it and if failures are reported switch to/opt/datadog-agent/run
with a fallback to/tmp
if it doesn't exit.
@@ -19,6 +29,9 @@ | |||
import org.apache.log4j.Appender; | |||
import org.apache.log4j.Level; | |||
import org.apache.log4j.Logger; | |||
import org.apache.commons.lang3.CharEncoding; | |||
import org.apache.commons.io.FileUtils; | |||
import org.apache.commons.io.filefilter.WildcardFileFilter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty sure some of these aren't used anywhere, you should open the project in eclipse and let it clean them up for you
int len = sd_pipe.available(); | ||
byte[] buffer = new byte[len]; | ||
sd_pipe.read(buffer); | ||
reinit.set(process_service_discovery(buffer)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should either use setReinit
or remove it
Tests failed on a certificate issue on maven's repos, re-triggered them. Once they pass, SHIPIT. |
aa99991
to
b849b59
Compare
…n older java 1.6. [jmxfetch][service_discovery] fixing regex to be more Java6 friendly.
b849b59
to
6b6301f
Compare
No changes to the logic. Just added a couple simple tests. We're green, so merging! |
What does this PR do?
Enables service discovery for JMXfetch.
Once a service discovery config is detected by the agent it will be pushed as YAML via a named pipe:
dd-service_discovery
that lives in /tmp by default.If multiple changes are detected, these will be submitted to JMXfetch in a single write operation to avoid race conditions. The pipe should take care of locking from the reading and writing ends, so we can guarantee all configs will be read on the JMXfetch in a single iteration and thus help avoid having multiple versions of the same config in the pipe at any given time. We will then do the chopping up of the various configurations read with a simple String.split(SD_CONFIGURATION_SEPARATOR) operaion.
Motivation
Enabling Service Discovery for JMXfetch integrations.
Testing Guidelines
An overview on testing
is available in our contribution guidelines.
Additional Notes
Related PR: DataDog/dd-agent#3010