Skip to main content

Prometheus Metrics Intro


Prometheus Metrics Intro

Get started with Zilla by deploying our Docker image. Before proceeding, you should have Dockeropen in new window installed.

Prometheus Metrics

Running this Zilla sample will collect basic metrics for an http service.

zilla.yaml
name: Metrics-example
telemetry:

  # Desired metrics to track
  metrics:
    - http.request.size
    - http.response.size
    - stream.opens.sent
    - stream.closes.sent

  # Prometheus endpoint definition
  exporters:
    prometheus_metric_exporter:
      type: prometheus
      options:
        endpoints:
          - scheme: http
            path: /metrics
            port: 7190

# Sample HTTP Echo service
bindings:
  north_tcp_server:
    type: tcp
    kind: server
    options:
      host: 0.0.0.0
      port: 7114
    telemetry:
      metrics:
        - stream.*
    exit: north_http_server
  north_http_server:
    type: http
    kind: server
    routes:
      - when:
          - headers:
              :scheme: http
              :authority: localhost:7114
        exit: north_echo_server
    telemetry:
      metrics:
        - http.*
  north_echo_server:
    type: echo
    kind: server






 
 
 
 









 









 
 
 










 
 
 




Run Zilla with telemetry

Run the Zilla docker image as a daemon with the zilla.yaml file volume mounted.

docker run -d --pull=always -v ./zilla.yaml:/etc/zilla/zilla.yaml \
--name zilla-sample -p 7114:7114 -p 7190:7190 \
ghcr.io/aklivity/zilla:latest \
start -v;

Send an HTTP POST

curl -d "Hello, world" -H "Content-Type: text/plain" -X "POST" http://localhost:7114/;
Hello, world

View Metrics

Go to http://localhost:7190/metrticsopen in new window to see the collected data or run the below curl command.

curl http://localhost:7190/metrics;
# TYPE stream_opens_sent_total counter
stream_opens_sent_total{namespace="Metrics-example",binding="tcp_server"} 2

# HELP stream_closes_sent_total Number of closed sent streams
stream_closes_sent_total{namespace="Metrics-example",binding="tcp_server"} 2

# HELP http_request_size_bytes HTTP request content length
...
http_request_size_bytes_sum{namespace="Metrics-example",binding="http_server"} 30

# HELP http_response_size_bytes HTTP response content length
...
http_response_size_bytes_sum{namespace="Metrics-example",binding="http_server"} 30

Remove the running container

docker rm -f zilla-sample;

Going Deeper

Try out the other Zilla examplesopen in new window.