INCIDENT-23437 Always resolve hostname regardless of how dbm or disable_generic_tags are set #16201
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 change makes sure that the check's
resolved_hostname
always represents the database instance. The previous behavior of theresolved_hostname
property was to use the agent hostname as thehost
when dbm was disabled ordisable_generic_tags
was enabled. This caused issues when, with agent 7.48.0, we started sendingdatabase_instance
metadata. With theagent_hostname
being used instance of each instance's host value, agents with multiple databases being monitored would end up creating and clobbering the samedatabase_instance
which, in turn, caused tag interference between database instances monitored by the same agent.Very importantly, that problem surfaced the broken experience when dbm is disabled in regards to the host used on integration metrics: instead of having the postgres metrics tagged by the database instance's host, they were tagged by the agent hostname which would only be correct when the agent is running on the same host as the database.
Here is an example showing this deployment of a GCP cloud sql database instance with dbm disabled (stolen from the sister PR to the postgres integration but this applies to mysql as well):
This, running in kubernetes, was deployed on a pod / host named
postgres-f06e6baf-7cb8dcd888-tmds4
.Looking at the metrics emitted by the integration, we can see that the host tag is
postgres-f06e6baf-7cb8dcd888-tmds4
, the agent host, rather than
10.x.x.x`.Note that this is going to be a breaking change but given the currently broken experience, this is something we want to do in order to improve the experience and to avoid potential future incidents resulting in the confusing implementation of
resolved_hostname
.Motivation
Additional Notes
We considered an alternative of creating a new property (
database_instance_name
) that would be used for everything except the core integration metrics. It would essentially be the same implementation as the resolved_hostname property from this PR but would leaveresolved_hostname
as-is. We decided to go with the better approach of fixing the broken experience at the risk of causing friction for users relying on that broken behavior.It's also worth noting that the experience for aws rds instances was less broken than others because of some custom inference of additional host, hostname and aws tags here. The metric points were still also tagged with the monitoring agent's hostname which was not correct but easier to deal with when filtering on aws rds instance was possible.
Review checklist (to be filled by reviewers)
qa/skip-qa
label if the PR doesn't need to be tested during QA.