diff --git a/internal/test/e2e/cloudwatch.go b/internal/test/e2e/cloudwatch.go index 461e8ab2f9723..65155f0faf303 100644 --- a/internal/test/e2e/cloudwatch.go +++ b/internal/test/e2e/cloudwatch.go @@ -61,7 +61,19 @@ func putInstanceTestResultMetrics(r instanceTestsResults) { putMetric(data, "FailedInstanceTests", failedCount) putMetric(data, "SucceededInstanceTests", succeededCount) - // TODO: publish time metrics + data.Dimensions = []*cloudwatch.Dimension{ + { + Name: aws.String("TestName"), + Value: aws.String(r.conf.Regex), + }, + { + Name: aws.String("BranchName"), + Value: aws.String(r.conf.BranchName), + }, + } + data.Unit = aws.String(cloudwatch.StandardUnitSeconds) + putMetric(data, "Duration", int(r.endTime)-int(r.startTime)) + logger.Info("Test instance metrics published") } diff --git a/internal/test/e2e/run.go b/internal/test/e2e/run.go index e5b97abaa5b9c..0f4bb64d53026 100644 --- a/internal/test/e2e/run.go +++ b/internal/test/e2e/run.go @@ -60,6 +60,8 @@ type ( conf instanceRunConf testCommandResult *testCommandResult err error + startTime int64 + endTime int64 } ) @@ -123,13 +125,14 @@ func RunTestsInParallel(conf ParallelRunConf) error { go func() { defer wg.Done() for c := range work { - r := instanceTestsResults{conf: c} + r := instanceTestsResults{conf: c, startTime: time.Now().Unix()} r.conf.InstanceID, r.testCommandResult, err = RunTests(c, invCatalogue) if err != nil { r.err = err } + r.endTime = time.Now().Unix() results <- r } }()