Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option DD_WAIT_TRACE_AGENT to wait for the trace agent startup before application start #158

Merged
merged 5 commits into from
Mar 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 "$@"