mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Merge pull request #2865 from mattbostock/add_marathon_port_ordinal_label
Marathon SD: Set port index label
This commit is contained in:
commit
43075d0215
|
@ -20,6 +20,7 @@ import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -43,6 +44,9 @@ const (
|
||||||
appLabel model.LabelName = metaLabelPrefix + "app"
|
appLabel model.LabelName = metaLabelPrefix + "app"
|
||||||
// imageLabel is the label that is used for the docker image running the service.
|
// imageLabel is the label that is used for the docker image running the service.
|
||||||
imageLabel model.LabelName = metaLabelPrefix + "image"
|
imageLabel model.LabelName = metaLabelPrefix + "image"
|
||||||
|
// portIndexLabel is the integer port index when multiple ports are defined;
|
||||||
|
// e.g. PORT1 would have a value of '1'
|
||||||
|
portIndexLabel model.LabelName = metaLabelPrefix + "port_index"
|
||||||
// taskLabel contains the mesos task name of the app instance.
|
// taskLabel contains the mesos task name of the app instance.
|
||||||
taskLabel model.LabelName = metaLabelPrefix + "task"
|
taskLabel model.LabelName = metaLabelPrefix + "task"
|
||||||
|
|
||||||
|
@ -323,6 +327,7 @@ func targetsForApp(app *App) []model.LabelSet {
|
||||||
target := model.LabelSet{
|
target := model.LabelSet{
|
||||||
model.AddressLabel: model.LabelValue(targetAddress),
|
model.AddressLabel: model.LabelValue(targetAddress),
|
||||||
taskLabel: model.LabelValue(t.ID),
|
taskLabel: model.LabelValue(t.ID),
|
||||||
|
portIndexLabel: model.LabelValue(strconv.Itoa(i)),
|
||||||
}
|
}
|
||||||
if i < len(app.PortDefinitions) {
|
if i < len(app.PortDefinitions) {
|
||||||
for ln, lv := range app.PortDefinitions[i].Labels {
|
for ln, lv := range app.PortDefinitions[i].Labels {
|
||||||
|
|
Loading…
Reference in a new issue