-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: resource execution metrics #6133
base: main
Are you sure you want to change the base?
Conversation
7963828
to
86e9358
Compare
cmd/testworkflow-init/main.go
Outdated
fmt.Printf("Actions: %v\n", state.Actions) | ||
fmt.Printf("Step: %v\n", state.GetStep(action.Execute.Ref)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debug log
fmt.Printf("Actions: %v\n", state.Actions) | |
fmt.Printf("Step: %v\n", state.GetStep(action.Execute.Ref)) |
cmd/testworkflow-init/main.go
Outdated
Skip: action.Execute.Toolkit, | ||
Workflow: d.InternalConfig.Workflow.Name, | ||
Step: step.Ref, | ||
Execution: d.InternalConfig.Execution.Id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe be worth to consider using Resource.Id
too - it will differ on parallel steps and services
pkg/utilization/core/writers.go
Outdated
if err != nil { | ||
return errors.Wrapf(err, "failed to open file") | ||
} | ||
fmt.Println("Printing file content") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Println("Printing file content") |
if err != nil { | ||
return errors.Wrapf(err, "failed to read file") | ||
} | ||
fmt.Println(string(data)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Println(string(data)) |
pkg/utilization/instrument.go
Outdated
|
||
// Print debug info | ||
fmt.Printf("child process: %d\n", process.Pid) | ||
name, _ := process.Name() | ||
fmt.Printf("child process name: %s\n", name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Print debug info | |
fmt.Printf("child process: %d\n", process.Pid) | |
name, _ := process.Name() | |
fmt.Printf("child process name: %s\n", name) |
|
||
} | ||
|
||
func (r *MetricRecorder) Start(ctx context.Context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likely information about starting/stopping should not be printed (unless debug)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, all debug logs will be removed
pkg/utilization/utilisation.go
Outdated
|
||
// Skip will be set to true for internal operations like git operations, artifact scraping... | ||
if config.Skip { | ||
stdoutUnsafe.Println("skipping metrics recording for internal operations") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it print about skipping?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
cmd/testworkflow-init/main.go
Outdated
commands.Run(*action.Execute, currentContainer) | ||
d := data.GetState() | ||
recorderConfig := utilization.Config{ | ||
Dir: "./.tk/metrics", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It rather should be stored in /.tktw
directory, along with other internal files (for sure not CWD)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
cmd/testworkflow-init/main.go
Outdated
Execution: d.InternalConfig.Execution.Id, | ||
Format: core.FormatInflux, | ||
} | ||
utilization.WithMetricsRecorder(recorderConfig, func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the metrics output being saved as artifact - is it meant to be uploaded only when users request it specifically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated to use internal artifact storage
pkg/utilization/utilisation.go
Outdated
|
||
process, err := getChildProcess() | ||
if err != nil { | ||
stdoutUnsafe.Errorf("failed to get process: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing \n
pkg/utilization/utilisation.go
Outdated
stdoutUnsafe.Errorf("failed to create file writer: %v", err) | ||
stdoutUnsafe.Warn("running the provided function without metrics recorder") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing \n
s
Signed-off-by: Dejan Zele Pejchev <pejcev.dejan@gmail.com>
d504acd
to
0a2463c
Compare
0a2463c
to
37c1c80
Compare
Signed-off-by: Dejan Zele Pejchev <pejcev.dejan@gmail.com>
37c1c80
to
1ada3ec
Compare
Pull request description
Add resource execution metrics
Checklist (choose whats happened)
Breaking changes
Changes
Fixes