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

Replace host metadata in dogstasd payload with host tag #66

Merged
merged 2 commits into from Aug 20, 2015

Conversation

olivielpeau
Copy link
Member

Supersedes #65.

The host name that's sent is the host that's defined in the yaml config for each instance, which is preventing the backend from correctly assigning host tags to the service checks.

We fix that by sending a jmx_server tag in the dogstatsd payload instead of a host_name metadata field. The agent's dogstatsd will then add the agent's hostname.

Also added an is_jmx tag to JMXFetch's service checks so that the backend can know which service checks come from JMXFetch.

cc @talwai @conorbranagan

@olivielpeau olivielpeau added this to the 5.5.0 milestone Jul 31, 2015
@talwai
Copy link

talwai commented Aug 2, 2015

cc @remh - what do you think of this approach?

@olivielpeau olivielpeau force-pushed the olivielpeau/replace-hostname-in-sc branch from 67113c0 to 348f70d Compare August 4, 2015 19:08
@olivielpeau olivielpeau force-pushed the olivielpeau/replace-hostname-in-sc branch from 348f70d to d3a2a16 Compare August 4, 2015 19:22
@@ -494,7 +491,7 @@ public void testServiceCheckCounter() throws Exception {
// Let's put a service check in the pipeline (we cannot call doIteration()
// here unfortunately because it would call reportStatus which will flush
// the count to the jmx_status.yaml file and reset the counter.
repo.sendServiceCheck("jmx", Status.STATUS_OK, "This is a test", "jmx_test_instance", null);
repo.sendServiceCheck("jmx", Status.STATUS_OK, "This is a test", null);

// Let's check that the counter has been updated
assertEquals(1, repo.getServiceCheckCount("jmx"));
Copy link
Member

Choose a reason for hiding this comment

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

Can we test the jmx_server:hostname tag ? In the meantime, maybe we can start moving those service checks tests in a different file to improve the readibility.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm actually all of our tests rely on the Attach API and thus don't use a host in the configuration, so we can't cleanly test the jmx_server tag with our current test setup...
We could change our test setup to use JMX Remote instead but that would need some work.

Copy link
Member

Choose a reason for hiding this comment

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

Oh that's right.
Switching to JMX Remote is not worth. A better solution would be to be able to unit test the specific getServiceCheckTags method, and not instantiate the whole app like we are currently doing. This is what we do for instance with TestConfiguration.
Let's see if it can be done easily and decide.

@yannmh
Copy link
Member

yannmh commented Aug 6, 2015

Looks good to me 🍰.

We should discuss the wording jmx_server and the role of the is_jmx tag before merging it.

The host name that's sent is the host that's defined in the yaml config
for each instance, which is preventing the backend from correctly assigning
host tags to the service checks.

We fix that by sending a `jmx_server` tag in the dogstatsd payload
instead of a host_name metadata field. The agent's dogstatsd will then
add the agent's hostname.

Also removed unused variables in `TestApp`.
@olivielpeau olivielpeau force-pushed the olivielpeau/replace-hostname-in-sc branch from d3a2a16 to 9da215d Compare August 7, 2015 18:29
@olivielpeau
Copy link
Member Author

Thanks @yannmh for the review!

I've removed the is_jmx tag, and moved the service check tests to a separate class. See my comment above about the test on the jmx_server tag.
Might be a good idea to change the test setup if we want to test the more conventional JMX Remote instead of the Attach API, don't if/how we could implement that though.

@talwai
Copy link

talwai commented Aug 12, 2015

LGTM @olivielpeau . Can you merge and build a new jar for the dd-agent repo?

@olivielpeau
Copy link
Member Author

I've tested the new jar on staging and it works fine: host tags are available during the setup of new monitors on JMXFetch service checks.
Waiting on feedback from the customer to whom we sent this version of the jar, I'll merge the PR tomorrow at the latest.

@olivielpeau
Copy link
Member Author

No feedback from the customer unfortunately but merging anyway.

@yannmh
Copy link
Member

yannmh commented Aug 20, 2015

👍

olivielpeau added a commit that referenced this pull request Aug 20, 2015
Replace host metadata in dogstasd payload with host tag
@olivielpeau olivielpeau merged commit 974c198 into master Aug 20, 2015
@yannmh yannmh deleted the olivielpeau/replace-hostname-in-sc branch August 25, 2015 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants