-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new cron workflow trigger counter metric
From #12589. A new metric which counts how many times each cron workflow has triggered. A simple enough counter which can be checked against expectations for the cron. Note to reviewers: this is part of a stack of reviews for metrics changes. Please don't merge until the rest of the stack is also ready. Signed-off-by: Alan Clucas <[email protected]>
- Loading branch information
Showing
8 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: CronWorkflow | ||
metadata: | ||
name: test-cron-metric | ||
spec: | ||
schedule: "* * * * *" | ||
concurrencyPolicy: "Allow" | ||
startingDeadlineSeconds: 0 | ||
workflowSpec: | ||
metadata: | ||
labels: | ||
workflows.argoproj.io/test: "true" | ||
podGC: | ||
strategy: OnPodCompletion | ||
entrypoint: whalesay | ||
templates: | ||
- name: whalesay | ||
container: | ||
image: argoproj/argosay:v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package metrics | ||
|
||
import ( | ||
"context" | ||
) | ||
|
||
const ( | ||
nameCronTriggered = `cronworkflows_triggered_total` | ||
) | ||
|
||
func addCronWfTriggerCounter(_ context.Context, m *Metrics) error { | ||
return m.createInstrument(int64Counter, | ||
nameCronTriggered, | ||
"Total number of cron workflows triggered", | ||
"{cronworkflow}", | ||
withAsBuiltIn(), | ||
) | ||
} | ||
|
||
func (m *Metrics) CronWfTrigger(ctx context.Context, name, namespace string) { | ||
m.addInt(ctx, nameCronTriggered, 1, instAttribs{ | ||
{name: labelCronWFName, value: name}, | ||
{name: labelWorkflowNamespace, value: namespace}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters