-
Notifications
You must be signed in to change notification settings - Fork 433
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(hatchery): add routine status #3381
Conversation
Signed-off-by: Yvonnick Esnault <[email protected]>
Signed-off-by: Yvonnick Esnault <[email protected]>
CDS Report build-engine-cli-tools#6249.0 ✘
|
Signed-off-by: Yvonnick Esnault <[email protected]>
engine/api/workflow_queue.go
Outdated
|
||
tx, errBegin := api.mustDB().Begin() | ||
if errBegin != nil { | ||
return sdk.WrapError(errBegin, "postSpawnInfosWorkflowJobHandler> Cannot start transaction") | ||
} | ||
defer tx.Rollback() | ||
|
||
_, next = observability.Span(ctx, "workflow.AddSpawnInfosNodeJobRun") | ||
if err := workflow.AddSpawnInfosNodeJobRun(tx, id, s); err != nil { | ||
return sdk.WrapError(err, "postSpawnInfosWorkflowJobHandler> Cannot save spawn info on node job run %d for %s name %s", id, getAgent(r), r.Header.Get(cdsclient.RequestedNameHeader)) | ||
} | ||
|
||
if err := tx.Commit(); err != nil { | ||
return sdk.WrapError(err, "postSpawnInfosWorkflowJobHandler> Cannot commit tx") |
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.
next()
sdk/hatchery/starter.go
Outdated
return jobs, results | ||
} | ||
|
||
func workerStarter(h Interface, jobs <-chan workerStarterRequest, results chan<- workerStarterResult) { | ||
func (st starter) run(h Interface, jobs <-chan workerStarterRequest, results chan<- workerStarterResult) { |
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 should be a pointer to starter
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's workerStarter, no need starter now
sdk/hatchery/starter.go
Outdated
@@ -48,6 +48,12 @@ func PanicDump(h Interface) func(s string) (io.WriteCloser, error) { | |||
} | |||
} | |||
|
|||
var starters map[int]starter |
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.
where is it used ? I miss a handler, a status or some metrics using those statuses
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.
unused now, metrics are on /metrics
Signed-off-by: Yvonnick Esnault <[email protected]>
Signed-off-by: Yvonnick Esnault <[email protected]>
do not merge yet, missing tag "workerNum" on "starters_*" metrics
|
Signed-off-by: Yvonnick Esnault <[email protected]>
done
|
engine/hatchery/stats.go
Outdated
@@ -42,9 +42,19 @@ func (c *Common) initStats(hatcheryName string) error { | |||
label = fmt.Sprintf("cds/%s/%s/disabled_workers", c.ServiceName(), hatcheryName) | |||
c.stats.DisabledWorkers = stats.Int64(label, "number of disabled workers", stats.UnitDimensionless) | |||
|
|||
label = fmt.Sprintf("cds/%s/%s/starters/spawning", c.ServiceName(), hatcheryName) | |||
c.stats.StartersSpawning = stats.Int64(label, "starters spawning a worker", stats.UnitDimensionless) |
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'm not sure i understand the metric, is it the number of goroutines spawning a worker ?
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.
a starter (= instance of a goroutine) have a label. example: hatchery_starter="9"
so,
starters_spawning{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal",hatchery_starter="9"} 2
starters_waiting{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal",hatchery_starter="9"} 2
say that goroutine n°9 had spawned 2 workers and do nothing now (as waiting = spawning).
We'll discuss about that tomorrow, I'm not 100% sure that it will be really useful to understand the life of goroutine "starter"
Signed-off-by: Yvonnick Esnault <[email protected]>
Signed-off-by: Yvonnick Esnault [email protected]