Skip to content

Commit 770e579

Browse files
authored
Update UDP release workflow to test via batch-get-traces (#146)
* update udp release workflow to test via bath-get-traces * run udp exporter e2e test on push to main
1 parent 1d7a3ce commit 770e579

File tree

2 files changed

+86
-46
lines changed

2 files changed

+86
-46
lines changed
Lines changed: 14 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release ADOT OTLP UDP Exporter
1+
name: Release ADOT X-Ray UDP Exporter
22
on:
33
workflow_dispatch:
44
inputs:
@@ -9,12 +9,22 @@ on:
99
env:
1010
RUBY_VERSION: "3.2"
1111

12+
permissions:
13+
id-token: write
14+
1215
jobs:
13-
build:
14-
environment: Release
16+
validate-udp-exporter-e2e-test:
17+
name: "Validate X-Ray UDP Exporter E2E Test Succeeds"
18+
uses: ./.github/workflows/udp-exporter-e2e-test.yml
19+
secrets: inherit
20+
permissions:
21+
id-token: write
22+
23+
release-udp-exporter:
1524
runs-on: ubuntu-latest
25+
needs: validate-udp-exporter-e2e-test
1626
steps:
17-
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
27+
- name: Checkout Repo @ SHA - ${{ github.sha }}
1828
uses: actions/checkout@v4
1929

2030
# Install ruby and bundle dependencies and cache!
@@ -33,46 +43,4 @@ jobs:
3343
bundle install
3444
bundle exec rake test
3545
36-
- name: Download and run X-Ray Daemon
37-
run: |
38-
mkdir xray-daemon
39-
cd xray-daemon
40-
wget https://s3.us-west-2.amazonaws.com/aws-xray-assets.us-west-2/xray-daemon/aws-xray-daemon-linux-3.x.zip
41-
unzip aws-xray-daemon-linux-3.x.zip
42-
./xray -o -n us-west-2 -f ./daemon-logs.log --log-level debug &
43-
44-
- name: Setup Sample App
45-
run: |
46-
cd .github/test-sample-apps/integ-test-http-server/ruby-on-rails
47-
bundle install
48-
49-
- name: Run Sample App in Background
50-
run: |
51-
cd .github/test-sample-apps/integ-test-http-server/ruby-on-rails
52-
LISTEN_ADDRESS=127.0.0.1:8080 rails server &
53-
# Wait for test server to initialize
54-
sleep 5
55-
56-
- name: Call Sample App Endpoint
57-
id: call-endpoint
58-
run: |
59-
echo "traceId=$(curl localhost:8080/test)" >> $GITHUB_OUTPUT
60-
61-
- name: Verify X-Ray daemon received traces
62-
run: |
63-
sleep 10
64-
echo "X-Ray daemon logs:"
65-
cat xray-daemon/daemon-logs.log
66-
# Check if the daemon received and processed some data
67-
if grep -q "sending.*batch" xray-daemon/daemon-logs.log; then
68-
echo "✅ X-Ray daemon processed trace data (AWS upload errors are expected)"
69-
exit 0
70-
elif grep -q "processor:.*segment" xray-daemon/daemon-logs.log; then
71-
echo "✅ X-Ray daemon processed segment data (AWS upload errors are expected)"
72-
exit 0
73-
else
74-
echo "❌ No evidence of traces being received by X-Ray daemon"
75-
exit 1
76-
fi
77-
7846
# TODO: Publish OTLP UDP Exporter to RubyGems
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Test ADOT X-Ray UDP Exporter
2+
on:
3+
workflow_call:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
id-token: write
10+
11+
jobs:
12+
udp-exporter-e2e-test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Repo @ SHA - ${{ github.sha }}
16+
uses: actions/checkout@v4
17+
18+
# Install ruby and bundle dependencies and cache!
19+
- name: Install Ruby ${{ env.RUBY_VERSION }} with dependencies
20+
uses: ruby/[email protected]
21+
with:
22+
ruby-version: "${{ env.RUBY_VERSION }}"
23+
working-directory: "exporter/xray-udp"
24+
bundler: "latest"
25+
bundler-cache: true
26+
cache-version: "v1-ruby-xray-udp"
27+
28+
- name: Configure AWS credentials for Testing Tracing
29+
uses: aws-actions/configure-aws-credentials@v4
30+
with:
31+
role-to-assume: ${{ secrets.XRAY_UDP_EXPORTER_TEST_ROLE }}
32+
aws-region: 'us-east-1'
33+
34+
- name: Download and run X-Ray Daemon
35+
run: |
36+
mkdir xray-daemon
37+
cd xray-daemon
38+
wget https://s3.us-east-2.amazonaws.com/aws-xray-assets.us-east-2/xray-daemon/aws-xray-daemon-linux-3.x.zip
39+
unzip aws-xray-daemon-linux-3.x.zip
40+
./xray -o -n us-east-2 -f ./daemon-logs.log --log-level debug &
41+
42+
- name: Setup Sample App
43+
run: |
44+
cd .github/test-sample-apps/integ-test-http-server/ruby-on-rails
45+
bundle install
46+
47+
- name: Run Sample App in Background
48+
run: |
49+
cd .github/test-sample-apps/integ-test-http-server/ruby-on-rails
50+
LISTEN_ADDRESS=127.0.0.1:8080 rails server &
51+
# Wait for test server to initialize
52+
sleep 5
53+
54+
- name: Call Sample App Endpoint
55+
id: call-endpoint
56+
run: |
57+
echo "traceId=$(curl localhost:8080/test)" >> $GITHUB_OUTPUT
58+
59+
- name: Check if traces are successfully sent to AWS X-Ray
60+
run: |
61+
sleep 20
62+
# # Print Daemon Logs for debugging
63+
# cat xray-daemon/daemon-logs.log
64+
65+
traceId=${{ steps.call-endpoint.outputs.traceId }}
66+
numTracesFound=$(aws xray batch-get-traces --trace-ids $traceId --region us-east-2 | jq '.Traces' | jq length)
67+
if [[ numTracesFound -ne "1" ]]; then
68+
echo "TraceId $traceId not found in X-Ray."
69+
exit 1
70+
else
71+
echo "TraceId $traceId found in X-Ray."
72+
fi

0 commit comments

Comments
 (0)