mvisonneau / gitlab-ci-pipelines-exporter

Prometheus / OpenMetrics exporter for GitLab CI pipelines insights
Apache License 2.0
1.26k stars 239 forks source link

Tags are scraped even when set to disabled #632

Open sharkymcdongles opened 1 year ago

sharkymcdongles commented 1 year ago
  config:
      gitlab:
        url: http://gitlab-webservice-default.gitlab.svc.cluster.local:8181
        enable_health_check: true
        enable_tls_verify: false
        maximum_requests_per_second: 7
      pull:
        environments_from_projects:
          on_init: false
          scheduled: false
      project_defaults:
        output_sparse_status_metrics: true
        pull:
          environments:
            enabled: false
        refs:
          branches:
            enabled: true
            regexp: "^(master|development|release)$"
            most_recent: 10
            max_age_seconds: 0
            exclude_deleted: true
          merge_requests:
            enabled: false
          tags:
            enabled: false
        pipeline:
          jobs:
            enabled: false
          from_child_pipelines:
            enabled: false
          runner_description:
            enabled: true
          variables:
            enabled: false

Is something wrong with my config or is the tags enabled false not working properly?

arnaudlemaignen commented 1 year ago

I had the same issue and even if I was requesting a subset of tags using regex, I was still getting the whole list. In the end I found out that it was the redis DB that was not cleaned killing the "gitlab-ci-pipelines-exporter-redis-master-0" pod and restart the exporter fixed the issue.

tan-wei-xin-alez commented 1 year ago

same problem running example/quickstart/docker-compose.yml with the following gitlab-ci-pipelines-exporter.yml

---
log:
  level: debug

gitlab:
  url: https://gitlab.com
  token: <gitlab_personal_access_token>

# https://github.com/mvisonneau/gitlab-ci-pipelines-exporter/blob/main/docs/configuration_syntax.md
project_defaults:
  pull:
    refs:
      enabled: true
      regexp: "^(?:main|develop)$"
    tags:
      enabled: false
    merge_requests:
      enabled: true

projects:
  - name: <project_name>

still scrapes ref-kind=tag as seen below

...
time="2023-08-14T15:49:16Z" level=debug msg="could not find any pipeline for the ref" project-name=<project_name> ref=<ref_name> ref-kind=tag
time="2023-08-14T15:49:17Z" level=debug msg="could not find any pipeline for the ref" project-name=<project_name> ref=<ref_name> ref-kind=tag
time="2023-08-14T15:49:18Z" level=debug msg="could not find any pipeline for the ref" project-name=<project_name> ref=<ref_name> ref-kind=tag
...
tewfik-ghariani commented 1 year ago

@tan-wei-xin-alez I believe the tags property should be in the refs subtree

tan-wei-xin-alez commented 1 year ago

oh that's embarrassing σ(^_^;) I was also missing the branches key (p_-)

seems to work now with the following config

---
log:
  level: debug

gitlab:
  url: https://gitlab.com
  token: <gitlab_personal_access_token>

# https://github.com/mvisonneau/gitlab-ci-pipelines-exporter/blob/main/docs/configuration_syntax.md
project_defaults:
  pull:
    refs:
      branches:
        enabled: true
        regexp: "^(?:main|develop)$"
      tags:
        enabled: false
      merge_requests:
        enabled: true

projects:
  - name: <project_name>