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

[sc] Don't send sc. WARNING if too many metrics #73

Merged
merged 1 commit into from
Sep 15, 2015

Conversation

elafarge
Copy link
Contributor

We were sending a service check warning for integrations with too many
metrics which is not the behaviour we'd like to have. Even though there
are too many metrics, the can_connect service check should be green.

@elafarge elafarge force-pushed the etienne/no-sc-warning branch from 529d6a5 to 8b9de2d Compare August 28, 2015 05:05
@elafarge elafarge assigned yannmh and olivielpeau and unassigned yannmh Aug 28, 2015
@olivielpeau
Copy link
Member

Tell me if I'm missing something, but I think all we need to do is to remove this line: https://github.com/DataDog/jmxfetch/blob/master/src/main/java/org/datadog/jmxfetch/App.java#L199

What do you think? 😃

@elafarge
Copy link
Contributor Author

Indeed, that would have been faster but...

  1. I don't like to have more lines removed than lines added in my Github statistics
  2. Actually if we do that, we won't get the warning on the datadog-agent info page OR we still wan't to have that one. This they are bound to the same variable at this point in the code I'm afraid it's not possible to just remove that line whilst keeping the WARNING on the info page. Correct me if I'm wrong :)

Oh and thanks a lot for your review btw. :)

@remh
Copy link

remh commented Aug 28, 2015

@elafarge

"When debugging, novices insert corrective code; experts remove defective code."
Richard Pattis

:) sometimes removing code is better.

But yeah i agree, we still want the warning to be displayed in the info page (and sent as other agent check warnings in the infra overview if possible).

@elafarge elafarge force-pushed the etienne/no-sc-warning branch from 8b9de2d to 1e4e269 Compare September 8, 2015 04:23
@elafarge
Copy link
Contributor Author

elafarge commented Sep 8, 2015

@yannmh @remh I decoupled the service checks and status. I didn't add a second service check for the alert on the number of metrics but that's something I could do if it appears to be relevant :)


reportStatus(appConfig, reporter, instance, metrics.size(), instanceMessage, instanceStatus);
this.reportStatus(appConfig, reporter, instance, metrics.size(), instanceMessage, instanceStatus);
this.sendServiceCheck(reporter, instance, instanceMessage, scStatus);
}
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 simplify (factorize) this block with something like :

while (it.hasNext()) {
    String instanceStatus = Status.STATUS_OK;
    String serviceCheckStatus = Status.STATUS_OK;
    String message = null;

    try {
        // Instantiate instanceStatus, serviceCheckStatus, message
        doSomething();
    } catch (Exception) {
        // Modify instanceStatus, serviceCheckStatus, message
        handleException();
    }

    // Factorize instance status and service check report
    this.reportStatus(appConfig, reporter, instance, metrics.size(), instanceMessage, instanceStatus);
    this.sendServiceCheck(reporter, instance, instanceMessage, scStatus);
}

?

@yannmh
Copy link
Member

yannmh commented Sep 11, 2015

Thanks for tackling the issue @elafarge.

While I think decoupling service checks and instance status is the right thing to do, I am a bit worried about the resulting code duplication. I added some suggestion to refactorize some code paths 🎨, please let me know what you think

We were sending a service check warning for integrations with too many
metrics which is not the behaviour we'd like to have. Even though there
are too many metrics, the `can_connect` service check should be green.

This was a good oppurtunity for a slight refactoring of `App.java` where
service checks and statuses in the `datadog-agent info` page have been
made completely independant.
@elafarge elafarge force-pushed the etienne/no-sc-warning branch from 1e4e269 to 57f067f Compare September 11, 2015 15:25
@elafarge
Copy link
Contributor Author

Thank you so much for you enlightening suggestions @yannmh . I took them into account and updated the PR. Let me know what you think about it ;-)

@yannmh
Copy link
Member

yannmh commented Sep 15, 2015

Thanks @elafarge !

yannmh added a commit that referenced this pull request Sep 15, 2015
[sc] Don't send sc. WARNING if too many metrics
@yannmh yannmh merged commit 2d5a2a2 into master Sep 15, 2015
@yannmh yannmh deleted the etienne/no-sc-warning branch September 15, 2015 21:35
yannmh added a commit to DataDog/dd-agent that referenced this pull request Sep 15, 2015
Do not send service check warnings on metric limit violation. See
[#73](DataDog/jmxfetch#73).

Update CHANGELOG to reflect changes.
yannmh added a commit to DataDog/dd-agent that referenced this pull request Sep 15, 2015
Do not send service check warnings on metric limit violation. See
[#73](DataDog/jmxfetch#73).

Update CHANGELOG to reflect changes.
urosgruber pushed a commit to urosgruber/dd-agent that referenced this pull request Dec 23, 2015
Do not send service check warnings on metric limit violation. See
[DataDog#73](DataDog/jmxfetch#73).

Update CHANGELOG to reflect changes.
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.

4 participants