Skip to content

Commit

Permalink
Add temporary additional logging
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Jul 6, 2022
1 parent ad61f07 commit 01058ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion archives/archives.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion archives/archives_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit 01058ca

Please sign in to comment.