Service Discovery

Service Discovery

Service discovery (SD) is a mechanism by which the vertex can discover monitorable endpoints automatically.

Available Extensions

All service observer extension provide a list of Endpoints, Endpoint looks like below:

# ID uniquely identifies this endpoint
id: "123456789",

# Type of the Endpoint, e.g. service, pod, container, etc
typ: "port",

# Target is an IP address or hostname of the endpoint.
# It can also be a hostname/ip:port pair.
target: "127.0.0.1:8080",

# Details contains additional context about the endpoint such as Pod's metadata.
details: 
  foo: bar
  properties:
    foo: bar

and multiplier will expand and interpolate those endpoints to sub sources.

Configuring Service Discovery

extensions:
  ports:
    type: port_observer
    interval: 3s
  tap:
    type: remote_tap

sources:
  http:
    type: multiplier
    observer: ports
    templates:
      - rule: details.port == 9100 # prometheus_exporter sink
        config:
          type: http_check
          targets:
            - http://${{ target }}
          interval: 1s

sinks:
  prom:
    type: prometheus_exporter
    inputs:
      - http

Troubleshooting

curl or visit the endpoint configured in the remote_tap extension.

curl http://127.0.0.1:11000/observers | jq .

you can get something like

{
  "ports": [
    {
      "id": "tcp:127.0.0.1:33331@3577",
      "type": "port",
      "target": "127.0.0.1:33331",
      "details": {
        "cmdline": "/usr/bin/xxxx",
        "is_ipv6": false,
        "name": "xxxx",
        "pid": 3577,
        "port": 3333,
        "protocol": "tcp"
      }
    }
  ]
}