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

Export http_host tag with PHP-FPM metrics #3074

Closed
wants to merge 2 commits into from

Conversation

toksvaeth
Copy link

What does this PR do?

This PR builds upon #2779.

It exports the newly added http_host option as a tag for both the PHP-FPM
service check and the metric data.

Motivation

The author's use case in the original PR was for a single site behind a load
balancer that may be exposed by only a distinct host URL that wasn't
localhost.

My current use case differs slightly. I have a host with multiple vhosts, each
with its own FPM pool defined. The FPM status page for each vhost listens on
http://localhost/php-fpm-status. The newly added http_host option allows me
to define multiple instances that each talk to a different vhost/pool by way of
the host header whilst hitting the same ping_url.

The current integration allows you to group checks based on ping_url. In my
circumstance, this is value identical for every pool. This means that if just
one of the pool checks fails, the check hits its critical threshold without any
indication to the operator as to which pool or instance failed. Allowing the
option to group by the http_host tag allows the operator to identify the
source of the problem easily.

The first commit exposes this tag via the service check.

The second commit exposes this tag with the metric data also. I have made this
amendment for consistency such that an operator can query on this tag for
relevant metrics in future.

Testing Guidelines

I have tested this as a custom service check however have not executed your
test harness.

Additional Notes

I am unsure as to the conditional statements and am willing to amend if
necessary.

I felt it better omit the tag rather than supply one with a null value. I am
unsure what preferred practice is.

I am also aware that the pool tag is already exported with the metrics.
Whilst an operator can potentially discern the right pool exhibiting a problem
by way of the pool tag, I felt it wise to include the extra tag for the
following reasons:

  • The pool tag is not always populated. This tag is gathered from the
    response that the FPM extended status page returns. If the request to the
    status page fails (an error condition I am facing now), the tag is exported
    with no value.
  • Adding the extra http_host tag allows for easier metric queries later that
    are consistent between the service check data and metric data.

Additionally, I am unsure if the Datadog UI will require any amendments because
of this change. The PHP-FPM integration page appears to lock down the
'grouping' clauses to host and ping_url with no option for adjustment.

The current PHP-FPM integration provides no mechanism in which to group
by anything beyond `host` and `ping_url` for the `php_fpm.can_ping`
service check.

Allow clients to also group by the `http_host` in circumstances where
the `ping_url` is identical (e.g. localhost) on the same host (server).
The current PHP-FPM mechanism provides no mechanism to associate a
metric with the `http_host` that was specified to enact the check.

This can be useful in circumstances when a single server has multiple
FPM pools.  Notably this data can be discerned from the extant
`pool` tag, however it is quite possible that the pool name and the host
header can be entirely different.
@sjenriquez
Copy link
Contributor

Hey @toksvaeth! Thanks for the PR, this change looks useful. Regarding the question you had about the conditional statement for submitting the http_host tag, your logic looks good. Once the tags are sent, you'll be able to use them in monitors and dashboards.

We're currently transitioning our checks to a new SDK-based model for the agent and have imposed a freeze on the dd-agent repo. I see there is a small merge conflict, so I took the liberty of creating #3165 with these changes. I will close this PR and merge #3165 so the change will be included when this check is moved to the new SDK repo.

Fyi, the SDK consists of two repositories integrations-core and integrations-extras, where all of our checks will reside.

Thanks again for your contribution!

@sjenriquez sjenriquez closed this Feb 1, 2017
@truthbk truthbk modified the milestone: 5.12.0 Feb 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants