Export http_host tag with PHP-FPM metrics #3074
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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-FPMservice 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 meto 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 mycircumstance, 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 thesource 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 thefollowing reasons:
pool
tag is not always populated. This tag is gathered from theresponse 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.
http_host
tag allows for easier metric queries later thatare 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
andping_url
with no option for adjustment.