prometheus-rancher-exporter icon indicating copy to clipboard operation
prometheus-rancher-exporter copied to clipboard

Rename labels to be more consistent

Open marcbachmann opened this issue 7 years ago • 3 comments

Currently the rancher_stack_health_status and rancher_service_* metrics both have a name. In some cases it's a stack name and sometimes a service name.

It would be nice to have a more consistent naming of labels. I advise to rename the labels to stack_name and service_name. What do you think about that?

Here's how my metric relabel config looks like:

    metric_relabel_configs:
      - action: 'replace'
        source_labels: ['__name__', 'name']
        regex: 'rancher_stack_health_status;(.+)'
        target_label: 'stack_name'

      - action: 'replace'
        source_labels: ['__name__', 'name']
        regex: '(rancher_service_health_status|rancher_service_scale|rancher_service_state);(.+)'
        replacement: '$2'
        target_label: 'service_name'

      - action: 'replace'
        source_labels: ['__name__', 'exported_stack_name']
        regex: '(rancher_service_health_status|rancher_service_scale|rancher_service_state);(.+)'
        replacement: '$2'
        target_label: 'stack_name'

      - action: 'replace'
        source_labels: ['__name__']
        regex: 'rancher_service_[a-z_]*'
        replacement: ''
        target_label: 'exported_stack_name'

      - action: 'replace'
        source_labels: ['__name__']
        regex: '(rancher_stack_health_status|rancher_service_health_status|rancher_service_scale|rancher_service_state)'
        replacement: ''
        target_label: 'name'

marcbachmann avatar Sep 01 '17 12:09 marcbachmann

Agree @marcbachmann something I only really appreciated once the exporter was published.

The problem we would have is that metric names have quite an impact when changed, this exporters had over 1m pulls on docker hub surprisingly so i'd be hesitant to introduce such a breaking change.

Rucknar avatar Sep 02 '17 11:09 Rucknar

Yeah, that would be a breaking change. What about making it configurable and log a deprecation message?

marcbachmann avatar Sep 03 '17 21:09 marcbachmann

Fair point. Should get time to look at this next week, open to PR's of course.

Rucknar avatar Sep 06 '17 10:09 Rucknar