Skip to content
Open
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
36 changes: 36 additions & 0 deletions eventlog/analysis.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package eventlog

import (
"fmt"
"strconv"
"time"
)

var analysisEventsLogFmt = "%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%d\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We seem to have an extra format specifier here compared to the number of values we are passing below.


type AnalysisLogger struct {
RunID string
RunSerial string
CheckSequence string
Repository string
Shortcode string
CommitSHA string
IsFullRun bool
IsIDERun bool
}

func (a *AnalysisLogger) Log(runType, stage string) {
fmt.Printf(analysisEventsLogFmt,
runType,
a.RunID,
a.RunSerial,
a.CheckSequence,
a.Shortcode,
a.Repository,
a.CommitSHA,
strconv.FormatBool(a.IsFullRun),
strconv.FormatBool(a.IsIDERun),
stage,
time.Now().Unix(),
)
}
30 changes: 0 additions & 30 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import (
"github.com/getsentry/sentry-go"
)

var analysisEventsLogFmt = "%s,%s,%s,%s,%s,%s,%s,%s,%s,%d\n"

// Returns bearer token that is used to authenticate while
// interacting with the k8s REST API
// Utilized by janus and atlas.
Expand Down Expand Up @@ -185,31 +183,3 @@ func TriggerDeploymentRestart(auth bool, podName, patchData, baseURL, tokenPath
}
return nil
}

// AnalysisEventsLog represents the struct that contains the fields
// that need to be logged for tracking analysis pipeline's performance.
type AnalysisEventsLog struct {
RunID string
RunSerial string
CheckSequence string
Repository string
Shortcode string
CommitSHA string
IsFullRun string
}

// logAnalysisEventTimestamp logs the timestamp at various analysis stages.
func (a *AnalysisEventsLog) LogAnalysisEventTimestamp(runType, stage string) {
fmt.Printf(analysisEventsLogFmt,
runType,
a.RunID,
a.RunSerial,
a.CheckSequence,
a.Shortcode,
a.Repository,
a.CommitSHA,
a.IsFullRun,
stage,
time.Now().Unix(),
)
}