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

[mysqlreceiver]: rename mysql.commands metric to mysql.prepared_statements (by default) #16609

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .chloggen/drosiek-mysql-feature-gate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: mysqlreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: rename mysql.commands metric to mysql.prepared_statements

# One or more tracking issues related to the change
issues: [14138]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: Disable the `receiver.mysqlreceiver.renameCommands` feature gate to temporarily revert this change.
9 changes: 4 additions & 5 deletions receiver/mysqlreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const (
func init() {
featuregate.GetRegistry().MustRegisterID(
RenameCommands,
featuregate.StageAlpha,
featuregate.StageBeta,
featuregate.WithRegisterDescription("When enabled, the mysql.commands will be deprecated and additionally emitted as optional mysql.prepared_statements metric"),
)
}
Expand All @@ -68,13 +68,12 @@ func newMySQLScraper(
}

if !ms.renameCommands {
settings.Logger.Warn(fmt.Sprintf("[WARNING] Metric `mysql.commands` will be deprecated and duplicated as `mysql.prepared_statements` in %s. Metric `mysql.commands` will be removed and `mysql.prepared_statements` will be a default metric in %s. Enable a feature gate `%s` to apply and test the upcoming changes earlier", deprecationVersion, renameVersion, RenameCommands))
settings.Logger.Warn(fmt.Sprintf("[WARNING] Metric `mysql.commands` is deprecated and duplicated as `mysql.prepared_statements`. Metric `mysql.commands` will be removed and `mysql.prepared_statements` will be a default metric in %s. Disable a feature gate `%s` to keep previous behavior", renameVersion, RenameCommands))
ms.config.Metrics.MysqlPreparedStatements.Enabled = false
} else {
ms.mb.DeprecateMetrics()

if ms.config.Metrics.MysqlCommands.Enabled {
settings.Logger.Warn(fmt.Sprintf("[WARNING] Metric `mysql.commands` will be deprecated in %s and removed in %s. Please use `mysql.prepared_statements` instead", deprecationVersion, renameVersion))
ms.mb.DeprecateMetrics()
settings.Logger.Warn(fmt.Sprintf("[WARNING] Metric `mysql.commands` is deprecated and will be removed in %s. Please use `mysql.prepared_statements` instead", renameVersion))
}

if !ms.config.Metrics.MysqlPreparedStatements.Enabled {
Expand Down