Skip to content
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

Merged
merged 7 commits into from
Oct 3, 2018
Merged

feat(hatchery): add routine status #3381

merged 7 commits into from
Oct 3, 2018

Conversation

yesnault
Copy link
Member

@yesnault yesnault commented Oct 1, 2018

Signed-off-by: Yvonnick Esnault [email protected]

Signed-off-by: Yvonnick Esnault <[email protected]>
Signed-off-by: Yvonnick Esnault <[email protected]>
@ovh-cds
Copy link
Collaborator

ovh-cds commented Oct 1, 2018

CDS Report build-engine-cli-tools#6249.0 ✘

  • Build minimal
    • cds cli legacy -
    • cdsctl linux ✘
    • Engine Build linux amd64 ✔
    • tools/debpacker ✔
    • tools/os-ansible-inventory ✔
    • Worker linux amd64 / 386 ✔

Signed-off-by: Yvonnick Esnault <[email protected]>
engine/api/workflow_queue.go Show resolved Hide resolved
engine/api/workflow_queue.go Show resolved Hide resolved
engine/api/workflow_queue.go Show resolved Hide resolved

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")
Copy link
Member

Choose a reason for hiding this comment

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

next()

engine/hatchery/marathon/marathon.go Show resolved Hide resolved
engine/hatchery/marathon/marathon.go Show resolved Hide resolved
engine/hatchery/marathon/marathon.go Show resolved Hide resolved
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) {
Copy link
Member

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

Copy link
Member Author

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

@@ -48,6 +48,12 @@ func PanicDump(h Interface) func(s string) (io.WriteCloser, error) {
}
}

var starters map[int]starter
Copy link
Member

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

Copy link
Member Author

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]>
@yesnault
Copy link
Member Author

yesnault commented Oct 1, 2018

do not merge yet, missing tag "workerNum" on "starters_*" metrics

building_workers{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal"} 0
checking_workers{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal"} 0
disabled_workers{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal"} 5
jobs_count{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal"} 10
pending_workers{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal"} 0
registering_workers{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal"} 0
spawned_worker_count{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal"} 3
starters_spawning{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal"} 1
starters_waiting{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal"} 1
waiting_workers{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal"} 1

Signed-off-by: Yvonnick Esnault <[email protected]>
@yesnault
Copy link
Member Author

yesnault commented Oct 1, 2018

done

curl http://localhost:8086/mon/metrics | grep -v '#'|sort
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2689  100  2689    0     0   417k      0 --:--:-- --:--:-- --:--:--  437k
building_workers{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal"} 1
checking_workers{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal"} 0
disabled_workers{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal"} 16
jobs_count{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal"} 41
pending_workers{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal"} 0
registering_workers{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal"} 0
spawned_worker_count{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal"} 17
starters_spawning{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal",hatchery_starter="10"} 1
starters_spawning{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal",hatchery_starter="2"} 2
starters_spawning{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal",hatchery_starter="3"} 2
starters_spawning{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal",hatchery_starter="7"} 4
starters_spawning{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal",hatchery_starter="8"} 6
starters_spawning{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal",hatchery_starter="9"} 2
starters_waiting{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal",hatchery_starter="10"} 1
starters_waiting{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal",hatchery_starter="2"} 2
starters_waiting{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal",hatchery_starter="3"} 2
starters_waiting{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal",hatchery_starter="7"} 4
starters_waiting{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal",hatchery_starter="8"} 6
starters_waiting{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal",hatchery_starter="9"} 2
waiting_workers{hatchery="cds-hatchery-local",hatchery_name="hatcheryLocal"} 0

@@ -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)
Copy link
Member

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 ?

Copy link
Member Author

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]>
@yesnault yesnault merged commit c379464 into master Oct 3, 2018
@fsamin fsamin deleted the ye-add-spawn-info branch November 15, 2018 16:09
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.

5 participants