prometheus/discovery
Matt Bostock ab4d64959f Marathon SD: Set port index label
The changes [1][] to Marathon service discovery to support multiple
ports mean that Prometheus now attempts to scrape all ports belonging to
a Marathon service.

You can use port definition or port mapping labels to filter out which
ports to scrape but that requires service owners to update their
Marathon configuration.

To allow for a smoother migration path, add a
`__meta_marathon_port_index` label, whose value is set to the port's
sequential index integer. For example, PORT0 has the value `0`, PORT1
has the value `1`, and so on.

This allows you to support scraping both the first available port (the
previous behaviour) in addition to ports with a `metrics` label.

For example, here's the relabel configuration we might use with
this patch:

    - action: keep
      source_labels: ['__meta_marathon_port_definition_label_metrics', '__meta_marathon_port_mapping_label_metrics', '__meta_marathon_port_index']
      # Keep if port mapping or definition has a 'metrics' label with any
      # non-empty value, or if no 'metrics' port label exists but this is the
      # service's first available port
      regex: ([^;]+;;[^;]+|;[^;]+;[^;]+|;;0)

This assumes that the Marathon API returns the ports in sorted order
(matching PORT0, PORT1, etc), which it appears that it does.

[1]: https://github.com/prometheus/prometheus/pull/2506
2017-06-23 09:52:52 +01:00
..
azure Use log.Logger interface for all discovery services 2017-06-01 11:25:55 -05:00
consul Hide consul token on UI. (#2797) 2017-06-01 22:14:23 +01:00
dns Use log.Logger interface for all discovery services 2017-06-01 11:25:55 -05:00
ec2 Use log.Logger interface for all discovery services 2017-06-01 11:25:55 -05:00
file Use log.Logger interface for all discovery services 2017-06-01 11:25:55 -05:00
gce Use log.Logger interface for all discovery services 2017-06-01 11:25:55 -05:00
kubernetes Replace regex with Secret type and remarshal config to hide secrets (#2775) 2017-05-29 12:46:23 +01:00
marathon Marathon SD: Set port index label 2017-06-23 09:52:52 +01:00
openstack Openstack Service Discovery (#2701) 2017-06-01 23:49:02 +02:00
triton Add triton zone brand metadata 2017-04-06 21:35:42 +00:00
zookeeper Use log.Logger interface for all discovery services 2017-06-01 11:25:55 -05:00
discovery.go Openstack Service Discovery (#2701) 2017-06-01 23:49:02 +02:00
discovery_test.go Use log.Logger interface for all discovery services 2017-06-01 11:25:55 -05:00