Skip to content
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

Merged
merged 4 commits into from
May 21, 2019

Conversation

tylerbenson
Copy link
Contributor

Based on #223, so focus on last two commits for review.

Will be used in dd-java-agent. A future release can completely remove the metricConfigFiles setting (but not metricConfigResources).

@tylerbenson tylerbenson requested a review from truthbk May 16, 2019 21:42
@tylerbenson tylerbenson force-pushed the tyler/appconfig-builder branch from 3c2aa4f to b259fdb Compare May 16, 2019 22:23
tylerbenson added a commit to DataDog/dd-trace-java that referenced this pull request May 16, 2019
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;
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Member

@truthbk truthbk left a 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.

src/main/java/org/datadog/jmxfetch/App.java Outdated Show resolved Hide resolved
@@ -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) {
Copy link
Member

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
Copy link
Member

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?

Copy link
Contributor Author

@tylerbenson tylerbenson May 21, 2019

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> {
Copy link
Member

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?

Copy link
Contributor Author

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... 🤷‍♂

@tylerbenson tylerbenson force-pushed the tyler/appconfig-builder branch from 2bcfb19 to 633e6a2 Compare May 21, 2019 16:42
Copy link
Member

@truthbk truthbk left a 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! 🚀

@tylerbenson tylerbenson merged commit 2405b26 into DataDog:master May 21, 2019
@tylerbenson tylerbenson deleted the tyler/appconfig-builder branch May 21, 2019 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants