-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Marathon SD: Set port index label #2865
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Marathon SD: Set port index label #2865
Conversation
+1 Please merge this as soon as possible. I totally agree with this approach. Port index is common used in marathon ecosystem so it is a good idea to port it to prometheus meta data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No objections. Please document the new meta label in the next-release branch of https://github.com/prometheus/docs
Thanks, done in prometheus/docs#773 |
Related PR to add missing docs for the port definition/port mapping labels: prometheus/docs#774 |
Mh, isn't |
I aiming to be descriptive but agree 'index' is probably more easily
understood.
…On Wed, 21 Jun 2017, 12:38 Fabian Reinartz, ***@***.***> wrote:
Mh, isn't _index more common than _ordinal? Or is ordinal a fixed term in
Marathon?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2865 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEJbsBrsTLm_jEVqf9WTP_spjaB_W32qks5sGQCXgaJpZM4N_tbC>
.
|
Will change to |
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]: prometheus#2506
d7f8e22
to
ab4d649
Compare
Thank you! |
This was released in version 1.7.2 via #3159. |
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'ssequential index integer. For example, PORT0 has the value
0
, PORT1has 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:
This assumes that the Marathon API returns the ports in sorted order
(matching PORT0, PORT1, etc), which it appears that it does.