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

Report known mysql database configuration errors as warnings #11221

Merged

Conversation

alexandre-normand
Copy link
Contributor

@alexandre-normand alexandre-normand commented Jan 27, 2022

What does this PR do?

This sends warnings in well-known database configuration errors to improve customers' visibility into issues due to missing or wrong database configuration required by the integration to work properly. Those warnings will appear in the agent status like this:

mysql (8.0.2)
    -------------
      Instance ID: mysql:d790abe8c7b4512b [WARNING]
      Configuration Source: file:/etc/datadog-agent/conf.d/mysql.d/conf.yaml
      Total Runs: 22
      Metric Samples: Last Run: 135, Total: 2,495
      Events: Last Run: 0, Total: 0
      Database Monitoring Query Metrics: Last Run: 2, Total: 32
      Database Monitoring Query Samples: Last Run: 6, Total: 65
      Service Checks: Last Run: 3, Total: 66
      Average Execution Time : 138ms
      Last Execution Date : 2022-01-27 01:54:29 UTC (1643248469000)
      Last Successful Execution Date : 2022-01-27 01:54:29 UTC (1643248469000)
      metadata:
        flavor: MySQL
        version.build: log
        version.major: 5
        version.minor: 7
        version.patch: 37
        version.raw: 5.7.37+log
        version.scheme: semver

      Warning: Unable to collect explain plans because the procedure 'datadog.explain_statement' is either undefined or not granted access to. See https://docs.datadoghq.com/database_monitoring/setup_mysql/troubleshooting#explain-plan-fq-procedure for more details: (1370, "execute command denied to user 'datadog'@'%' for routine 'datadog.explain_statement'")
host=mysqldb

As well as show up in the infrastructure views.

The database configuration errors covered here are:

  • performance_schema not enabled
  • Missing datadog.explain_statement procedure or missing grant to run it
  • Missing schema-specific version of the explain_statement or missing grant to run it

Motivation

Provide better ways for customers to identify database configuration errors and resolve them.

Additional Notes

The links included in the warnings don't currently exist but will be created as part of work planned ahead of the 7.35.0 release. We should make sure here that the links do make sense here even if the content doesn't already exist as we're aiming for stable permanent links.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have changelog/ and integration/ labels attached

@alexandre-normand alexandre-normand force-pushed the alex.normand/mysql-send-db-config-errors-as-warnings branch from a4dca0a to 15d2afa Compare January 27, 2022 01:55
@alexandre-normand alexandre-normand marked this pull request as ready for review January 27, 2022 01:55
@alexandre-normand alexandre-normand requested review from a team as code owners January 27, 2022 01:55
@alexandre-normand alexandre-normand changed the title Add warning reporting on mysql database configuration errors Report known mysql database configuration errors as warnings Jan 27, 2022
mysql/datadog_checks/mysql/mysql.py Outdated Show resolved Hide resolved
mysql/datadog_checks/mysql/statement_samples.py Outdated Show resolved Hide resolved
@alexandre-normand alexandre-normand force-pushed the alex.normand/mysql-send-db-config-errors-as-warnings branch from aa70dad to 554847d Compare January 28, 2022 21:21
@alexandre-normand alexandre-normand force-pushed the alex.normand/mysql-send-db-config-errors-as-warnings branch from c3dd89b to 7406698 Compare January 28, 2022 21:45
djova
djova previously approved these changes Jan 28, 2022
@alexandre-normand alexandre-normand merged commit c562b0d into master Jan 29, 2022
@alexandre-normand alexandre-normand deleted the alex.normand/mysql-send-db-config-errors-as-warnings branch January 29, 2022 00:15
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.

2 participants