Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#5120](https://github.com/open-telemetry/opentelemetry-python/pull/5120))
- Add WeaverLiveCheck test util
([#5088](https://github.com/open-telemetry/opentelemetry-python/pull/5088))
- ci: wait for tracecontext server readiness instead of a fixed sleep in `scripts/tracecontext-integration-test.sh`
([#5149](https://github.com/open-telemetry/opentelemetry-python/pull/5149))

## Version 1.41.0/0.62b0 (2026-04-09)

Expand Down
32 changes: 26 additions & 6 deletions scripts/tracecontext-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,42 @@ mkdir -p target
rm -rf ./target/trace-context
git clone https://github.com/w3c/trace-context ./target/trace-context
cd ./target/trace-context && git checkout $TRACECONTEXT_GIT_TAG && cd -
# start example opentelemetry service, which propagates trace-context by
# start example opentelemetry service, which propagates trace-context by
# default.
python ./tests/w3c_tracecontext_validation_server.py 1>&2 &
EXAMPLE_SERVER_PID=$!
# give the app server a little time to start up. Not adding some sort
# of delay would cause many of the tracecontext tests to fail being
# unable to connect.
sleep 1
onshutdown()
onshutdown()
{
# send a sigint, to ensure
# it is caught as a KeyboardInterrupt in the
# example service.
kill $EXAMPLE_SERVER_PID
}
trap onshutdown EXIT
# Wait for the example server to accept connections on 127.0.0.1:5000
# before running the W3C tracecontext tests. A fixed `sleep` raced the
# Flask startup on slow CI runners and produced intermittent connection
# errors (see issue #5104).
wait_for_server() {
host=127.0.0.1
port=5000
deadline=$(( $(date +%s) + 30 ))
while [ "$(date +%s)" -lt "$deadline" ]; do
# Bail out early if the server process died.
if ! kill -0 "$EXAMPLE_SERVER_PID" 2>/dev/null; then
echo "tracecontext example server exited before becoming ready" >&2
return 1
fi
# Use python so we don't depend on extra tools (nc, curl, etc.).
if python -c "import socket,sys; s=socket.socket(); s.settimeout(1); sys.exit(0 if s.connect_ex(('$host', $port)) == 0 else 1)" 2>/dev/null; then
return 0
fi
sleep 0.5
done
echo "tracecontext example server did not become ready within 30s" >&2
return 1
}
wait_for_server
cd ./target/trace-context/test

# The disabled test is not compatible with an optional part of the W3C
Expand Down