Skip to content
Open
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
14 changes: 14 additions & 0 deletions internal/mysqlmetrics/mysqlmetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ const (
currentRoleKey = "current_role"
replicationZonesKey = "replication_zones"
notProtectedByAutoFailoverKey = "not_protected_by_auto_failover"
noAutomatedBackupPolicyKey = "no_automated_backup_policy"
lastBackupOldKey = "last_backup_old"
sourceRole = "source"
replicaRole = "replica"
replicationZonesQuery = "SELECT HOST FROM information_schema.PROCESSLIST AS p WHERE p.COMMAND = 'Binlog Dump'"
Expand Down Expand Up @@ -1139,13 +1141,23 @@ func (m *MySQLMetrics) CollectWlmMetricsOnce(ctx context.Context, dwActivated bo
if err != nil {
log.CtxLogger(ctx).Warnf("Failed to get not protected by auto failover: %v", err)
}
noAutomatedBackupPolicy, err := m.noAutomatedBackupPolicy(ctx)
if err != nil {
log.CtxLogger(ctx).Warnf("Failed to get no automated backup policy: %v", err)
}
lastBackupOld, err := m.lastBackupOld(ctx)
if err != nil {
log.CtxLogger(ctx).Warnf("Failed to get last backup old: %v", err)
}
log.CtxLogger(ctx).Debugw("Finished collecting MySQL metrics once. Next step is to send to WLM (DW).",
bufferPoolKey, bufferPoolSize,
totalRAMKey, totalRAM,
innoDBKey, isInnoDBDefault,
currentRoleKey, currentRole,
replicationZonesKey, strings.Join(replicationZones, ","),
notProtectedByAutoFailoverKey, notProtectedByAutoFailover,
noAutomatedBackupPolicyKey, noAutomatedBackupPolicy,
lastBackupOldKey, lastBackupOld,
)
metrics := workloadmanager.WorkloadMetrics{
WorkloadType: workloadmanager.MYSQL,
Expand All @@ -1156,6 +1168,8 @@ func (m *MySQLMetrics) CollectWlmMetricsOnce(ctx context.Context, dwActivated bo
currentRoleKey: currentRole,
replicationZonesKey: strings.Join(replicationZones, ","),
notProtectedByAutoFailoverKey: strconv.FormatBool(notProtectedByAutoFailover),
noAutomatedBackupPolicyKey: strconv.FormatBool(noAutomatedBackupPolicy),
lastBackupOldKey: strconv.FormatBool(lastBackupOld),
},
}
res, err := workloadmanager.SendDataInsight(ctx, workloadmanager.SendDataInsightParams{
Expand Down
4 changes: 4 additions & 0 deletions internal/mysqlmetrics/mysqlmetrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,8 @@ func TestCollectWlmMetricsOnce(t *testing.T) {
innoDBKey: "true",
replicationZonesKey: "",
notProtectedByAutoFailoverKey: "true",
noAutomatedBackupPolicyKey: "true",
lastBackupOldKey: "true",
},
},
wantErr: false,
Expand Down Expand Up @@ -1457,6 +1459,8 @@ func TestCollectWlmMetricsOnce(t *testing.T) {
innoDBKey: "true",
replicationZonesKey: "",
notProtectedByAutoFailoverKey: "true",
noAutomatedBackupPolicyKey: "true",
lastBackupOldKey: "true",
},
},
wantErr: false,
Expand Down
Loading