Skip to content

feat: database_observability: add health_check collector to validate configuration#5115

Merged
matthewnolf merged 5 commits intomainfrom
mn/telemetry-status
Jan 7, 2026
Merged

feat: database_observability: add health_check collector to validate configuration#5115
matthewnolf merged 5 commits intomainfrom
mn/telemetry-status

Conversation

@matthewnolf
Copy link
Contributor

@matthewnolf matthewnolf commented Dec 16, 2025

PR Description

Adds a new collector within the database_observability.mysql component for reporting diagnostic data of the target database. This data enables us to visualise configuration issues.

Many of the healthChecks have been removed since we can access the required data from other collectors/signals. Remaining are just a few which we can not otherwise query.

Which issue(s) this PR fixes

Notes to the Reviewer

PR Checklist

  • Documentation added
  • Tests updated
  • Config converters updated

BEGIN_COMMIT_OVERRIDE
feat(database_observability): Add health_check collector to validate configuration (#5115)
END_COMMIT_OVERRIDE

@github-actions
Copy link
Contributor

github-actions bot commented Dec 16, 2025

💻 Deploy preview deleted (feat: database_observability: add health_check collector to validate configuration).

// checkMySQLVersion validates that the database the MySQL version >= 8.0.
func checkMySQLVersion(ctx context.Context, db *sql.DB) healthCheckResult {
r := healthCheckResult{name: "MySQLVersionSupported"}
const q = `SELECT VERSION()`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we re-use the value from component.go (which already runs this query)?

// checkSetupConsumerCPUTimeEnabled validates events_statements_cpu consumer is enabled.
func checkSetupConsumerCPUTimeEnabled(ctx context.Context, db *sql.DB) healthCheckResult {
r := healthCheckResult{name: "SetupConsumerCPUTimeEnabled"}
const q = `SELECT enabled FROM performance_schema.setup_consumers WHERE NAME = 'events_statements_cpu'`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth having a single check for setup_consumers maybe?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe we could just use database_observability_setup_consumers_enabled?


// checkDBConnectionValid validates the database connection with a short timeout.
func checkDBConnectionValid(ctx context.Context, db *sql.DB) healthCheckResult {
r := healthCheckResult{name: "DBConnectionValid"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if mysql_up can do the job here?

Comment on lines +267 to +270
SELECT
@@performance_schema_max_sql_text_length,
@@performance_schema_max_digest_length,
@@max_digest_length`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use perhaps these?

mysql_global_variables_performance_schema_max_digest_length
mysql_global_variables_performance_schema_max_sql_text_length
mysql_global_variables_max_digest_length

@matthewnolf
Copy link
Contributor Author

@cristiangreco I like the approach of using data already available instead of repeating it here. I have removed the healthChecks where the data was available in other metrics

@matthewnolf matthewnolf marked this pull request as ready for review January 6, 2026 17:38
@matthewnolf matthewnolf requested review from a team and clayton-cornell as code owners January 6, 2026 17:38
@matthewnolf matthewnolf merged commit 6d96740 into main Jan 7, 2026
49 checks passed
@matthewnolf matthewnolf deleted the mn/telemetry-status branch January 7, 2026 10:16
@grafana-alloybot grafana-alloybot bot mentioned this pull request Jan 7, 2026
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants