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

Metrics on background tasks #129

Open
julioz opened this issue Jan 22, 2024 · 2 comments
Open

Metrics on background tasks #129

julioz opened this issue Jan 22, 2024 · 2 comments
Labels
enhancement New feature or request keep-open Make stale action ignore the Issue/PR

Comments

@julioz
Copy link
Contributor

julioz commented Jan 22, 2024

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)

  • While doing an import/export of data, it is useful to check whether the task is still ongoing.
  • Monitoring of a scheduled/running backup job
  • Observations on ArtifactCleanupJobs that could correlate to server performance degradation
  • etc
@peimanja
Copy link
Owner

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

@peimanja peimanja added the enhancement New feature or request label Feb 20, 2024
Copy link

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.

@github-actions github-actions bot added the Stale label Mar 22, 2024
@peimanja peimanja added keep-open Make stale action ignore the Issue/PR and removed Stale labels Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request keep-open Make stale action ignore the Issue/PR
Projects
None yet
Development

No branches or pull requests

2 participants