-
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
Use Lombok Builder for AppConfig, Formalize jvm_direct Connection #225
Use Lombok Builder for AppConfig, Formalize jvm_direct Connection #225
Conversation
3c2aa4f
to
b259fdb
Compare
Expose new options for configuring JMXFetch with standard datadog-agent config files with `jvm_direct: true` set as an instance attribute (this will be ignored by the datadog-agent). For Example: * `dd.agent.conf.d=/opt/datadog-agent/etc/conf.d` * `dd.jmxfetch.configs=activemq.d/conf.yaml,jmx.d/conf.yaml` will load jmx configs in those two files that have `jvm_direct: true` in their `instance` setup. Environment variables can also be used: `DD_AGENT_CONF_D` and `DD_JMXFETCH_CONFIGS` Depends on a new release including DataDog/jmxfetch#225
* If set to true, other instances will be ignored. | ||
*/ | ||
@Builder.Default | ||
private boolean allowDirectInstances = false; |
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.
The "allow" in the name doesn't convey that If set to true, other instances will be ignored.
.
Maybe something like targetDirectInstances
?
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.
Yeah, I was having a hard time coming up with a better name... I like that better though. Thanks for the suggestion.
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.
Done.
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.
This mostly looks awesome to me, just a couple of comments/questions.
@@ -41,9 +42,30 @@ public static void setup(Level level, String logLocation) { | |||
} | |||
|
|||
/** Laconic logging for reduced verbosity. */ | |||
public static void laconic(Logger logger, Level level, String message, int max) { | |||
public static void laconic(org.slf4j.Logger logger, Level level, String message, int max) { |
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.
Yes! Glad you did this! 🍰
@@ -1,7 +1,7 @@ | |||
init_config: | |||
|
|||
instances: | |||
- process_name_regex: .*surefire.* | |||
- jvm_direct: true |
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.
Aren't process_name_regex
and jvm_direct
slightly different? One will attach to a running JVM, while the other is launched as a -javaagent
with the application? Would different test cases be needed?
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.
They are slightly different, but from this test perspective, they're mostly the same. There are plenty of other tests that verify the process_name_regex
behavior, so I felt it was ok to change this one rather than add additional complexity in the tests.
(If we moved them all to jvm_direct
we might be able to run the tests from within an IDE, rather than just via maven.)
private final static Logger LOGGER = Logger.getLogger("Test Task Processor"); | ||
|
||
class TestSimpleTask extends InstanceTask<Boolean> { | ||
class TestSimpleTask extends InstanceTask<Boolean> { |
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.
nit: this doesn't look properly aligned?
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.
turns out there was a sneaky tab in there... 🤷♂
More consistent file config with existing format.
Also fix Instance.toString()
2bcfb19
to
633e6a2
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.
Looks good, thank you @tylerbenson! 🚀
Based on #223, so focus on last two commits for review.
Will be used in
dd-java-agent
. A future release can completely remove themetricConfigFiles
setting (but notmetricConfigResources
).