peimanja / artifactory_exporter

JFrog Artifactory Prometheus Exporter written in Go
Apache License 2.0
140 stars 37 forks source link

Metrics on background tasks #129

Open julioz opened 6 months ago

julioz commented 6 months ago

Feature Description

Artifactory exposes an API to list the scheduled, running, stopped and cancelled background tasks. It would be helpful to get extra observability on these by exposing metrics as part of this exporter.

I can imagine that for very heavy-usage the list can get long, so I propose we include new metrics as optional.

Sample output for the API is:

{
    "tasks": [
        {
            "id": "artifactory.UpdateIndicesJob#d7321feb-6fd9-4e27-8f0e-954137be855b",
            "type": "org.artifactory.addon.gems.index.GemsVirtualIndexHandler$UpdateIndicesJob",
            "state": "scheduled",
            "description": "Gems Virtual Repositories Index Calculator",
            "nodeId": "artifactory-primary"
        },
        {
            "id": "artifactory.VirtualCacheCleanupJob#82bb1514-ea34-4a71-940d-78a61887981e",
            "type": "org.artifactory.repo.cleanup.VirtualCacheCleanupJob",
            "state": "scheduled",
            "description": "",
            "nodeId": "artifactory-primary"
        },
        {
            "id": "artifactory.BinaryStoreGarbageCollectorJob#039664ac-990d-4a32-85e1-decd0b508142",
            "type": "org.artifactory.storage.binstore.service.BinaryStoreGarbageCollectorJob",
            "state": "running",
            "started": "2015-05-15T15:39:37.566+02:00",
            "description": "Binaries Garbage Collector",
            "nodeId": "artifactory-primary"
        }
    ]
}

In order to keep Prometheus cardinality as low as possible while still providing value, I suggest we skip the description and id fields when registering metrics, and provide aggregates on type and state. Not every entry in the list contains nodeId or started, so for the ones that do, it would be interesting to have separate timeseries for tracking.

Of course, I leave it up to you to define what best fits the model of metrics that already exist in this repository.

Use Case(s)

peimanja commented 5 months ago

Makes sense to me. I'll see if I get a chance to look at implementing this. PRs are always welcomed

github-actions[bot] commented 4 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.