From 01058ca6acb2226103001745ae28ea91b387204d Mon Sep 17 00:00:00 2001 From: Rowan Seymour Date: Wed, 6 Jul 2022 11:19:17 +0100 Subject: [PATCH] Add temporary additional logging --- archives/archives.go | 10 +++++++++- archives/archives_test.go | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/archives/archives.go b/archives/archives.go index 4bba8c2..db1b577 100644 --- a/archives/archives.go +++ b/archives/archives.go @@ -800,6 +800,8 @@ func RollupOrgArchives(ctx context.Context, now time.Time, config *Config, db *s continue } + t1 := dates.Since(start) + if config.UploadToS3 { err = UploadArchive(ctx, s3Client, config.S3Bucket, archive) if err != nil { @@ -808,12 +810,16 @@ func RollupOrgArchives(ctx context.Context, now time.Time, config *Config, db *s } } + t2 := dates.Since(start) + err = WriteArchiveToDB(ctx, db, archive) if err != nil { log.WithError(err).Error("error writing record to db") continue } + t3 := dates.Since(start) + if !config.KeepFiles { err := DeleteArchiveFile(archive) if err != nil { @@ -822,7 +828,9 @@ func RollupOrgArchives(ctx context.Context, now time.Time, config *Config, db *s } } - log.WithFields(logrus.Fields{"id": archive.ID, "record_count": archive.RecordCount, "elapsed": dates.Since(start)}).Info("rollup created") + t4 := dates.Since(start) + + log.WithFields(logrus.Fields{"id": archive.ID, "record_count": archive.RecordCount, "elapsed": dates.Since(start)}).WithFields(logrus.Fields{"t1": t1, "t2": t2, "t3": t3, "t4": t4}).Info("rollup created") created = append(created, archive) } diff --git a/archives/archives_test.go b/archives/archives_test.go index f017cef..ec01819 100644 --- a/archives/archives_test.go +++ b/archives/archives_test.go @@ -534,7 +534,7 @@ func TestArchiveActiveOrgs(t *testing.T) { assert.NoError(t, err) assert.Equal(t, map[string][]float64{ - "archiver.archive_elapsed": {848.0}, + "archiver.archive_elapsed": {860.0}, "archiver.orgs_archived": {3}, "archiver.msgs_records_archived": {5}, "archiver.msgs_archives_created": {92},