This Go project fetches GitLab token metrics and exports them for Prometheus.
- Metric Collection: Gathers GitLab token info, including creation and expiration dates.
- Prometheus Integration: Exposes metrics compatible with Prometheus.
- Environment Config: Configured via environment variables.
- Go installed
- Prometheus for scraping metrics
-
Clone the repository:
git clone https://github.com/yourusername/gitlab-token-metrics-exporter.git
-
Change into the project directory:
cd gitlab-token-metrics-exporter
-
Build and run
go build && ./gitlab-token-metrics-exporter
Metrics available at http://localhost:9960/metrics.
- job_name: 'gitlab-token-metrics'
static_configs:
- targets: ['localhost:9960']
Request Duration: Duration of GitLab API requests.
API Errors: Total errors when making GitLab API requests.
Creation Date: Creation date of GitLab token in seconds since epoch.
Expiry Date: Expiry date of GitLab token in seconds since epoch.