Skip to content

Commit f2a6106

Browse files
committed
start scripts for datadog
1 parent 869b303 commit f2a6106

5 files changed

Lines changed: 16 additions & 19 deletions

File tree

mpcontribs-api/scripts/start.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ STATS_ARG=""
1212
SERVER_APP="mpcontribs.api:create_app()"
1313
WAIT_FOR="wait-for-it.sh $JUPYTER_GATEWAY_HOST -q -t 50"
1414

15+
set -x
16+
1517
if [[ -n "$DD_TRACE_HOST" ]]; then
16-
wait-for-it.sh $DD_TRACE_HOST -q -s -t 10 && STATS_ARG="--statsd-host $DD_AGENT_HOST:8125"
18+
wait-for-it.sh "$DD_TRACE_HOST" -q -s -t 10 && STATS_ARG="--statsd-host $DD_AGENT_HOST:8125" || echo "WARNING: datadog agent unreachable"
1719
fi
1820

19-
#if [[ -n "$STATS_ARG" ]]; then
20-
# exec $WAIT_FOR -- ddtrace-run gunicorn $STATS_ARG $SERVER_APP
21-
#else
22-
exec $WAIT_FOR -- gunicorn $SERVER_APP
23-
#fi
21+
[[ -n "$STATS_ARG" ]] && CMD="ddtrace-run" || CMD=""
22+
exec $WAIT_FOR -- $CMD gunicorn $STATS_ARG $SERVER_APP

mpcontribs-api/scripts/start_rq.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ echo "$SUPERVISOR_PROCESS_NAME: waiting for $zzz seconds before start..."
66
sleep $zzz
77

88
CMD="flask rq $1"
9+
set -x
910

10-
#if [[ -n "$DD_TRACE_HOST" ]]; then
11-
# wait-for-it.sh $DD_TRACE_HOST -q -s -t 10 && CMD="ddtrace-run $CMD"
12-
#fi
11+
if [[ -n "$DD_TRACE_HOST" ]]; then
12+
wait-for-it.sh "$DD_TRACE_HOST" -q -s -t 10 && CMD="ddtrace-run $CMD" || echo "WARNING: datadog agent unreachable"
13+
fi
1314

14-
exec wait-for-it.sh $JUPYTER_GATEWAY_HOST -q -s -t 50 -- \
15-
wait-for-it.sh $MPCONTRIBS_API_HOST -q -s -t 15 -- $CMD
15+
exec wait-for-it.sh "$JUPYTER_GATEWAY_HOST" -q -s -t 50 -- \
16+
wait-for-it.sh "$MPCONTRIBS_API_HOST" -q -s -t 15 -- $CMD

mpcontribs-api/supervisord/supervisord.conf.jinja

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ environment=
2929
JUPYTER_GATEWAY_URL="{{ jupyter_gateway_url }}",
3030
JUPYTER_GATEWAY_HOST="{{ jupyter_gateway_host }}",
3131
DD_AGENT_HOST="{{ dd_agent_host }}",
32-
DD_GEVENT_PATCH_ALL="true",
3332
DD_TRACE_SAMPLE_RATE="1",
3433
TINI_SUBREAPER="true"
3534

mpcontribs-kernel-gateway/start.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
#!/bin/bash
22

33
set -e
4-
pmgrc=$HOME/.pmgrc.yaml
5-
[[ ! -e $pmgrc ]] && echo "PMG_DUMMY_VAR: dummy" >$pmgrc
4+
PMGRC=$HOME/.pmgrc.yaml
5+
[[ ! -e $PMGRC ]] && echo "PMG_DUMMY_VAR: dummy" >"$PMGRC"
66

77
CMD="jupyter kernelgateway"
88

9-
# NOTE ddtrace-run causes 100% CPU usage
10-
#if [[ -n "$DD_TRACE_HOST" ]]; then
11-
# wait-for-it.sh $DD_TRACE_HOST -q -s -t 10 && CMD="ddtrace-run $CMD"
12-
#fi
9+
if [[ -n "$DD_TRACE_HOST" ]]; then
10+
wait-for-it.sh "$DD_TRACE_HOST" -q -s -t 10 && CMD="ddtrace-run $CMD" || echo "WARNING: datadog agent unreachable"
11+
fi
1312

1413
exec $CMD --KernelGatewayApp.log_format='%(asctime)s,%(msecs)03d %(levelname)s [%(name)s] [%(module)s:%(lineno)d] - %(message)s'

mpcontribs-portal/supervisord/supervisord.conf.jinja

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ environment=
2121
NODE_ENV="{{ node_env }}",
2222
DD_AGENT_HOST="{{ dd_agent_host }}",
2323
DD_LOG_LEVEL="{{ log_level }}",
24-
DD_GEVENT_PATCH_ALL="true",
2524
DD_TRACE_SAMPLE_RATE="1",
2625
REDIS_ADDRESS="%(ENV_REDIS_ADDRESS)s",
2726
TINI_SUBREAPER="true",

0 commit comments

Comments
 (0)