feat(database_observability.mysql): Embed prometheus exporter within db-o11y component#5711
Merged
Merged
Conversation
Merged
3 tasks
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… struct Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| *a = PrometheusExporterArguments(exporter_mysql.DefaultArguments) | ||
| } | ||
|
|
||
| func (a *PrometheusExporterArguments) Validate() error { return nil } |
Contributor
There was a problem hiding this comment.
Should we call Validate() on the args here? Or maybe we could call it in the Validate() if this component itself? (line 206)
| SlowLogFilter: exporterCfg.LogSlowFilter, | ||
| }) | ||
| if err := c.registry.Register(exporter); err != nil { | ||
| return fmt.Errorf("failed to register mysqld_exporter collector: %w", err) |
Contributor
There was a problem hiding this comment.
Suggested change
| return fmt.Errorf("failed to register mysqld_exporter collector: %w", err) | |
| return fmt.Errorf("failed to register prometheus_exporter collector: %w", err) |
…d exporter Delegate PrometheusExporterArguments.Validate() to the underlying exporter_mysql.Arguments.Validate() instead of returning nil. Rename error message to reference prometheus_exporter consistently. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cristiangreco
approved these changes
Mar 11, 2026
cursor Bot
pushed a commit
that referenced
this pull request
Mar 16, 2026
…dded block Add documentation for the new prometheus_exporter optional block introduced in PR #5711, which allows embedding mysqld_exporter metrics collection directly within the database_observability.mysql component. - Add prometheus_exporter block and all its sub-blocks to the Blocks table - Add prometheus_exporter section describing usage, attributes, and mutual exclusivity with the targets argument - Add sub-sections for each nested block (heartbeat, info_schema.processlist, info_schema.tables, mysql.user, perf_schema.eventsstatements, perf_schema.file_instances, perf_schema.memory_events) - Add a second example showing the embedded exporter pattern Co-authored-by: Cristian Greco <cristian@regolo.cc>
cursor Bot
pushed a commit
that referenced
this pull request
Mar 16, 2026
…dded block Add documentation for the new prometheus_exporter block introduced in v1.15.0 (PR #5711), which allows embedding a MySQL Prometheus exporter directly within database_observability.mysql without requiring a separate prometheus.exporter.mysql component. - Add prometheus_exporter block and its sub-blocks to the Blocks table - Add prometheus_exporter section with argument and sub-block details - Update the example to use the embedded prometheus_exporter pattern - Note that prometheus_exporter and targets are mutually exclusive Co-authored-by: Cristian Greco <cristian@regolo.cc>
matthewnolf
added a commit
that referenced
this pull request
Mar 25, 2026
…in db-o11y component (#5714) <!-- CONTRIBUTORS GUIDE: https://github.com/grafana/alloy/blob/main/docs/developer/contributing.md If this is your first PR or you have not contributed in a while, we recommend taking the time to review the guide. **NOTE** Your PR title must adhere to Conventional Commit style. For details on this, check out the Contributors Guide linked above. --> ### Brief description of Pull Request <!-- Add a human-readable description of the PR that may be used as the commit body (i.e. "Extended description") when it gets merged. --> ### Pull Request Details This change enables the `prometheus.exporter.postgres` component to be embedded inside the `database_observability.postgres` component so that it encapsulates the functionality. This enables end users to create a single component, instead of multiple and wiring them up. This also will aid our support for clustering mode in a future change. If the `postgres_exporter` config block is provided, we create the exporter and attach it to the prometheus registry already used for `database_observbaility_*` metrics. Example config: ``` database_observability.mysql "database" { data_source_name = "..." forward_to = [loki.relabel.database.receiver] targets = [] postgres_exporter { autodiscovery { database_denylist = ["rdsadmin"] enabled = true } enabled_collectors = ["database", "locks", "replication", "replication_slot", "stat_bgwriter", "stat_database", "stat_user_tables", "statio_user_tables", "wal", "long_running_transactions", "stat_statements"] } } ``` Matches the functionality implemented for MySQL in #5711 <!-- Add a more detailed descripion of the Pull Request here, if needed. --> ### Issue(s) fixed by this Pull Request <!-- Uncomment the following line and fill in an issue number if you want a GitHub issue to be closed automatically when this PR gets merged. --> <!-- Fixes #issue_id --> ### Notes to the Reviewer <!-- Add any relevant notes for the reviewers and testers of this PR. --> ### PR Checklist <!-- Remove items that do not apply. For completed items, change [ ] to [x]. --> - [ ] Documentation added - [ ] Tests updated - [ ] Config converters updated --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Brief description of Pull Request
Pull Request Details
This change enables the
prometheus.exporter.mysqlcomponent to be embedded inside thedatabase_observability.mysqlcomponent so that it encapsulates the functionality. This enables end users to create a single component, instead of multiple and wiring them up.This also will aid our support for clustering mode in a future change.
If the
mysql_exporterconfig block is provided, we create the exporter and attach it to the prometheus registry already used fordatabase_observbaility_*metrics.Example config:
Issue(s) fixed by this Pull Request
Notes to the Reviewer
PR Checklist