跳到主要内容

Prometheus metrics 接入

运行prometheus

window用户需要将prometheus.yml中的layotto改成'docker.for.windows.localhost:34903'

cd ${project_path}/demo/prometheus

docker-compose -f prometheus-docker-compose.yaml up -d

运行layotto

可以按照如下方式启动一个layotto的server:

切换目录:

cd ${project_path}/cmd/layotto

构建:

go build -o layotto

运行:

./layotto start -c ../../configs/config_standalone.json

运行 Demo

对应的调用端代码在client.go 中,运行它会调用layotto的SayHello接口:

切换目录:

 cd ${project_path}/demo/flowcontrol/

构建:

 go build -o client

运行:

./client

访问 http://127.0.0.1:9090/graph?g0.expr=grpc_request_total

清理资源

cd ${project_path}/demo/prometheus

docker-compose -f prometheus-docker-compose.yaml down