Skip to content

Commit

Permalink
Add ability to wait for the trace agent startup before application st…
Browse files Browse the repository at this point in the history
…art (#158)
  • Loading branch information
NouemanKHAL authored Mar 20, 2023
1 parent 63178c9 commit 0648856
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/run-datadog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,22 @@ main() {
exec 9>&-
fi
fi

# wait for the trace agent startup
if [ "${WAIT_DD_TRACE_AGENT}" = "true" ]; then
timeout=120
while ! nc -z localhost 8126 && [ $timeout -ge 0 ]; do
echo "Waiting for the trace agent to start on 8126..."
sleep 1
timeout=$((timeout - 1))
done
if [ $timeout -ge 0 ]; then
echo "Trace agent is listening for traces"
else
echo "Timed out waiting for the trace agent"
fi
fi
}
main "$@"


0 comments on commit 0648856

Please sign in to comment.