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

added an identifier for dms task to metric label #2

Merged
merged 1 commit into from
May 9, 2022
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ Belows are the list of metrics that `aws-dms-task-exporter` exports.
Sample metrics
```
# TYPE dms_task_stats gauge
dms_task_stats{action="delete",region="ap-southeast-1",schema="example_schema",table="inventories"} 40601
dms_task_stats{action="insert",region="ap-southeast-1",schema="example_schema",table="inventories"} 4.145428e+06
dms_task_stats{action="update",region="ap-southeast-1",schema="example_schema",table="inventories"} 1.24051e+06
dms_task_stats{action="delete",region="ap-southeast-1",identifier="inventory-change-task",schema="example_schema",table="inventories"} 40601
dms_task_stats{action="insert",region="ap-southeast-1",identifier="inventory-change-task",schema="example_schema",table="inventories"} 4.145428e+06
dms_task_stats{action="update",region="ap-southeast-1",identifier="inventory-change-task",schema="example_schema",table="inventories"} 1.24051e+06
```

Name | Description | Labels
-----|-----|-----
dms_task_stats | DMS Task Table Statistics showing counts of Insert, Delete, Update of source tables | action, region, schema, table
dms_task_stats | DMS Task Table Statistics showing counts of Insert, Delete, Update of source tables | action, region, schema, table, identifier
8 changes: 4 additions & 4 deletions aws-dms-task-exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
MetricName = "task_stats"
MetricNamespace = "dms"
MetricHelpMessage = "Gauge for dms tasks statistics"
MetricLabels = []string{"region", "schema", "table", "action"}
MetricLabels = []string{"region", "identifier", "schema", "table", "action"}
)

type collector struct {
Expand Down Expand Up @@ -106,9 +106,9 @@ func (c *collector) fetch(gauge *prometheus.GaugeVec) {
continue
}
for _, stat := range stats {
gauge.WithLabelValues(viper.GetString("AWS_REGION"), *stat.schemaName, *stat.tableName, "insert").Set(float64(*stat.inserts))
gauge.WithLabelValues(viper.GetString("AWS_REGION"), *stat.schemaName, *stat.tableName, "delete").Set(float64(*stat.deletes))
gauge.WithLabelValues(viper.GetString("AWS_REGION"), *stat.schemaName, *stat.tableName, "update").Set(float64(*stat.updates))
gauge.WithLabelValues(viper.GetString("AWS_REGION"), *task.identifier, *stat.schemaName, *stat.tableName, "insert").Set(float64(*stat.inserts))
gauge.WithLabelValues(viper.GetString("AWS_REGION"), *task.identifier, *stat.schemaName, *stat.tableName, "delete").Set(float64(*stat.deletes))
gauge.WithLabelValues(viper.GetString("AWS_REGION"), *task.identifier, *stat.schemaName, *stat.tableName, "update").Set(float64(*stat.updates))
}
}
}
Expand Down