# HG changeset patch # User smith@nwoca.org # Date 1506455388 -3600 # Node ID 5c36bfba70140bf1622d99e70631d73a9a1fd389 # Parent ac52b5761b21a05dae6854ed74f423a68ace5828 DEP-12: script to dump application metrics and thread dumps to stdout diff -r ac52b5761b21 -r 5c36bfba7014 scripts/metrics.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/metrics.sh Tue Sep 26 20:49:48 2017 +0100 @@ -0,0 +1,14 @@ +#!/bin/bash +# Dump application metrics and thread stacks to console. +# + +source "${SSDT_SCRIPTS:-$(dirname "${BASH_SOURCE[0]}")}/.functions.sh" + +container=$(composeGetContainer ${1?"Must specify the app service to connect to"} ) + +project=$(composeGetProject ${1} ) +ip=$(docker inspect -f "{{with .NetworkSettings.Networks}}{{.${project}_default.IPAddress}}{{end}}" $container) + +echo "connecting to ${container} in ${project} at ${ip}:8080" +docker run --network ${project}_default --rm docker.ssdt.io/ssdt-utils curl -s http://${ip}:8080/metrics/admin/metrics?pretty=true +docker run --network ${project}_default --rm docker.ssdt.io/ssdt-utils curl -s http://${ip}:8080/metrics/admin/threads