Skip to content

Conversation

yitingw3
Copy link
Owner

Added non-successful http response error handling
Move chart generation into package chart
Server runs on localhost:3001

@yitingw3 yitingw3 requested a review from davidbuzinski June 21, 2023 18:31
Copy link
Collaborator

@davidbuzinski davidbuzinski left a comment

Choose a reason for hiding this comment

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

I am wondering if this app should be focused aroun collecting the data and getting it into the database formatted how we want. There is some existing dashboard that I don't know too much about, but Andy might have more info on it. Maybe we can add on to that for presenting the metrics. I'll send you a little info on it.

@@ -85,11 +89,15 @@ func getWorkflowRunsData() {
}

req.Header.Set("Accept", "application/vnd.github.v3+json")
req.Header.Add("Authorization", "token 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")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm still getting a no data unless I comment out this line and the other token line. Maybe we can use a .env file and the godotenv package to load a token, and only add this header if there is one set.

It will keep you from checking in your tokens in the future as well. The .env file can be added to .gitignore

//fmt.Println("=================================")
//fmt.Println("Job Name: ", job.Name)
fmt.Println("=================================")
fmt.Println("Job Name: ", job.Name)
//fmt.Println("Job StartTime: ", job.StartTime)
// Calculate job runtime
runTime := getRuntime(job.StartTime, job.CompletedTime)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If I run unauthenticated I get this error

$ go run main.go 
Connected to MongoDB successfully!
jobs collection dropped...
6
=================================
Job Name:  build-v2-beta (windows-2022)
2023/06/22 09:02:32 parsing time "" as "2006-01-02T15:04:05Z07:00": cannot parse "" as "2006"
exit status 1

It's a strange error so it's hard to pinpoint exactly where it's coming from, but I think it's if I try to parse time when the field is empty

Comment on lines -298 to -300
//failRateV1 := getFailureRate("v1")
//failRateV2Beta := getFailureRate("v2-beta")
//items := make([]opts.BarData, 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the same app getting the job data on a schedule and serving a webapp with charts? I am wondering if these responsibilities should be separate in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants