Telemetry Logs & Metrics Intro
Telemetry Logs & Metrics Intro
Get started with Zilla by deploying our Docker image. Before proceeding, you should have Docker installed.
Standard Out Logs & 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
exporters:
# Enable Standard Out logs
stdout_logs_exporter:
type: stdout
# Prometheus endpoint definition
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 -v ./zilla.yaml:/etc/zilla/zilla.yaml \
--name zilla-sample -p 7114:7114 -p 7190:7190 \
ghcr.io/aklivity/zilla:latest \
start
Send an HTTP POST
curl -d "Hello, world" -H "Content-Type: text/plain" -X "POST" http://localhost:7114/
Hello, world
Viewing Standard Out Logs
docker logs zilla-sample
started
Metrics-example.north_http_server [08/May/2024:18:46:13 +0000] REQUEST_ACCEPTED - http POST localhost:7114 /
Metrics-example.north_http_server [08/May/2024:18:46:14 +0000] REQUEST_ACCEPTED - http POST localhost:7114 /
Viewing Prometheus Metrics
Go to http://localhost:7190/metrtics 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
Going Deeper
Try out the other Zilla examples.
Check out our other guides:
Clean up
Remove the running container
docker rm -f zilla-sample