Skip to content

Commit

Permalink
improving cyrus metric (#35)
Browse files Browse the repository at this point in the history
* improving cyrus metric

* Version bump
  • Loading branch information
decarboxy authored Jan 10, 2020
1 parent 160a3c9 commit 1bd1daf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.0-1.4.0-cyrus
2.3.0-1.5.0-cyrus
20 changes: 16 additions & 4 deletions workflow/metrics/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var (
descWorkflowCyrusInfo = prometheus.NewDesc(
"argo_workflow_cyrus_info",
"Cyrus specific workflow information.",
append(descWorkflowDefaultLabels, "user", "workflow_type"),
append(descWorkflowDefaultLabels, "user", "project_id", "protocol_name"),
nil,
)
)
Expand Down Expand Up @@ -140,14 +140,26 @@ func (wc *workflowCollector) collectWorkflow(ch chan<- prometheus.Metric, wf wfv
}

var username string
if wf.Labels["user"] == ""{
var projectId string
var protocolName string
if wf.Labels["user"] == "" {
username = "UNKNOWN"
} else {
username = wf.Labels["user"]
}

workflowType := strings.TrimSuffix(wf.ObjectMeta.GenerateName, "-")
if wf.Labels["project-id"] == "" {
projectId = "UNKNOWN"
} else {
projectId = wf.Labels["project-id"]
}

if wf.Labels["protocol-name"] == "" {
protocolName = "UNKNOWN"
} else {
protocolName = wf.Labels["protocol-name"]
}

addGauge(descWorkflowCyrusInfo, 1 /*A dummy value since this metric doesnt really have numeric data*/, username, workflowType)
addGauge(descWorkflowCyrusInfo, 1 /*A dummy value since this metric doesnt really have numeric data*/, username, projectId, protocolName)

}

0 comments on commit 1bd1daf

Please sign in to comment.