Skip to content

Commit

Permalink
Tweak metrics namespace and fix metric names and dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Dec 16, 2024
1 parent 8fbc047 commit 7e1ca31
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 46 deletions.
76 changes: 31 additions & 45 deletions archives/archives.go
Original file line number Diff line number Diff line change
Expand Up @@ -967,82 +967,68 @@ func ArchiveActiveOrgs(rt *runtime.Runtime) error {
timeTaken := dates.Now().Sub(start)
slog.Info("archiving of active orgs complete", "time_taken", timeTaken, "num_orgs", len(orgs))

dims := []types.Dimension{
{Name: aws.String("App"), Value: aws.String("archiver")},
}
msgsDim := types.Dimension{Name: aws.String("ArchiveType"), Value: aws.String("msgs")}
runsDim := types.Dimension{Name: aws.String("ArchiveType"), Value: aws.String("runs")}

metrics := []types.MetricDatum{
{MetricName: aws.String("ArchivingElapsed"), Value: aws.Float64(timeTaken.Seconds()), Unit: types.StandardUnitSeconds},
{
MetricName: aws.String("ArchiveElapsed"),
Dimensions: dims,
Value: aws.Float64(timeTaken.Seconds()),
Unit: types.StandardUnitSeconds,
},
{
MetricName: aws.String("OrgsArchived"),
Dimensions: dims,
Value: aws.Float64(float64(len(orgs))),
Unit: types.StandardUnitCount,
},
{
MetricName: aws.String("MsgsRecordsArchived"),
Dimensions: dims,
MetricName: aws.String("RecordsArchived"),
Dimensions: []types.Dimension{msgsDim},
Value: aws.Float64(float64(totalMsgsRecordsArchived)),
Unit: types.StandardUnitCount,
},
{
MetricName: aws.String("MsgsArchivedsCreated"),
Dimensions: dims,
Value: aws.Float64(float64(totalMsgsArchivesCreated)),
MetricName: aws.String("RecordsArchived"),
Dimensions: []types.Dimension{runsDim},
Value: aws.Float64(float64(totalRunsRecordsArchived)),
Unit: types.StandardUnitCount,
},

{
MetricName: aws.String("MsgsArchivedsFailed"),
Dimensions: dims,
Value: aws.Float64(float64(totalMsgsArchivesFailed)),
MetricName: aws.String("ArchivesCreated"),
Dimensions: []types.Dimension{msgsDim},
Value: aws.Float64(float64(totalMsgsArchivesCreated)),
Unit: types.StandardUnitCount,
},

{
MetricName: aws.String("MsgsRollupsCreated"),
Dimensions: dims,
Value: aws.Float64(float64(totalMsgsRollupsCreated)),
MetricName: aws.String("ArchivesCreated"),
Dimensions: []types.Dimension{runsDim},
Value: aws.Float64(float64(totalRunsArchivesCreated)),
Unit: types.StandardUnitCount,
},
{
MetricName: aws.String("MsgsRollupsFailed"),
Dimensions: dims,
Value: aws.Float64(float64(totalMsgsRollupsFailed)),
MetricName: aws.String("ArchivesFailed"),
Dimensions: []types.Dimension{msgsDim},
Value: aws.Float64(float64(totalMsgsArchivesFailed)),
Unit: types.StandardUnitCount,
},
{
MetricName: aws.String("RunsRecordsArchived"),
Dimensions: dims,
Value: aws.Float64(float64(totalRunsRecordsArchived)),
MetricName: aws.String("ArchivesFailed"),
Dimensions: []types.Dimension{runsDim},
Value: aws.Float64(float64(totalRunsArchivesFailed)),
Unit: types.StandardUnitCount,
},
{
MetricName: aws.String("RunsArchivedsCreated"),
Dimensions: dims,
Value: aws.Float64(float64(totalRunsArchivesCreated)),
MetricName: aws.String("RollupsCreated"),
Dimensions: []types.Dimension{msgsDim},
Value: aws.Float64(float64(totalMsgsRollupsCreated)),
Unit: types.StandardUnitCount,
},
{
MetricName: aws.String("RunsArchivedsFailed"),
Dimensions: dims,
Value: aws.Float64(float64(totalRunsArchivesFailed)),
MetricName: aws.String("RollupsCreated"),
Dimensions: []types.Dimension{runsDim},
Value: aws.Float64(float64(totalRunsRollupsCreated)),
Unit: types.StandardUnitCount,
},
{
MetricName: aws.String("RunsRollupsCreated"),
Dimensions: dims,
Value: aws.Float64(float64(totalRunsRollupsCreated)),
MetricName: aws.String("RollupsFailed"),
Dimensions: []types.Dimension{msgsDim},
Value: aws.Float64(float64(totalMsgsRollupsFailed)),
Unit: types.StandardUnitCount,
},
{
MetricName: aws.String("RunsRollupsFailed"),
Dimensions: dims,
MetricName: aws.String("RollupsFailed"),
Dimensions: []types.Dimension{runsDim},
Value: aws.Float64(float64(totalRunsRollupsFailed)),
Unit: types.StandardUnitCount,
},
Expand Down
2 changes: 1 addition & 1 deletion runtime/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func NewDefaultConfig() *Config {
StartTime: "00:01",
Once: false,

CloudwatchNamespace: "Temba",
CloudwatchNamespace: "Archiver",
DeploymentID: "dev",

LogLevel: "info",
Expand Down

0 comments on commit 7e1ca31

Please sign in to comment.