changeset 206:5c36bfba7014

DEP-12: script to dump application metrics and thread dumps to stdout
author smith@nwoca.org
date Tue, 26 Sep 2017 20:49:48 +0100
parents ac52b5761b21
children b808abd5bcab df5822269cdb
files scripts/metrics.sh
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /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