argoproj / argoproj/argo-workflows

inconsistent metric `argo_workflows_count`

Open
#13,296 12 comments 1 reaction 1 assignee Claimed by @Joibel View on GitHub
area/telemetry/metrics
Dominant language
Go
Stars
17k
Forks
3.7k
Avg merge
1d 20h
Merged PRs (30d)
138

Description

### Pre-requisites

- [X] I have double-checked my configuration
- [X] I have tested with the `:latest` image tag (i.e. `quay.io/argoproj/workflow-controller:latest`) and can confirm the issue still exists on `:latest`. If not, I have explained why, **in detail**, in my description below.
- [X] I have searched existing issues and could not find a match for this bug
- [ ] I'd like to contribute the fix myself (see [contributing guide](https://github.com/argoproj/argo-workflows/blob/main/docs/CONTRIBUTING.md))

### What happened/what did you expect to happen?

The metric `argo_workflows_count`, provided by the `/metrics` endpoint of the workflow controller is not consistent with the current state of my Argo Workflows instance, what the user interface shows and what can be extracted using `kubectl`:

```
# HELP argo_workflows_count Number of Workflows currently accessible by the controller by status (refreshed every 15s)
# TYPE argo_workflows_count gauge
argo_workflows_count{status="Error"} 1
argo_workflows_count{status="Failed"} 47
argo_workflows_count{status="Pending"} 0
argo_workflows_count{status="Running"} 6
argo_workflows_count{status="Succeeded"} 1059
```

![image](https://github.com/argoproj/argo-workflows/assets/107991124/678fa8ab-3c91-4885-bfee-f9f25eb0de09)

The output of `kubectl get workflows -A` is consistent with the ui. The metric `argo_workflows_count` however shows something completely different. I would expect that the metrics and the values in the user interface are identical (aside from a 15 sec delay). Technically speaking: that the values come from the same origin.

relevant part of my config:

```yaml
metricsConfig:
enabled: true
path: /metrics
port: 9090
persistence:
archive: false
connectionPool:
maxIdleConns: 100
maxOpenConns: 0
connMaxLifetime: 0s
postgresql:
host: database.argo
port: 5432
database: argo
[...]
artifactRepository:
s3:
[...]
workflowDefaults:
spec:
ttlStrategy:
[...]
```

### Version

3.5.8

### Paste a small workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflows that uses private images.

```YAML
not workflow-related, affects the workflow controller metric `argo_workflows_count`
```

### Logs from the workflow controller

```text
I couldn't find any specific logs, which would explain why the metric `argo_workflows_count` doesn't line up with everything else.
```

### Logs from in your workflow's wait container

```text
not workflow-related, affects the workflow controller metric `argo_workflows_count`
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.