ArgoCD Module API Explanation
The ArgoCD module retrieves continuous delivery sync and health statuses for applications managed by the ArgoCD controller.
API Execution Logic
The module locates the service entry matching the identifier argocd. The API URL is resolved from either the apiUrl or the default url property defined in the configuration.
Request Execution
A fetch request is dispatched to /api/v1/applications under the target URL. The request requires bearer token authentication, which is loaded from the ARGOCD_TOKEN environment variable and passed via the Authorization header. A timeout of 5 seconds is enforced.
Data Parsing
Upon receiving the applications payload, the module parses the list of applications from the items array. The following metrics are calculated:
- Primary Metric: The total length of the
itemsarray, representing the total number of managed GitOps applications. - Secondary Metric: The number of applications where the sync status matches
Synced(evaluated viaapp.status.sync.status).
Caching Strategy
The parsed data is cached in memory for 60 seconds (TTL) with a maximum stale window of 300 seconds to minimize load on the ArgoCD API server.