|
| 1 | +name: Build, Test, and Publish ADOT OTLP UDP Exporter |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "udp-*" |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + version: |
| 10 | + description: 'Version number for deployment e.g. 0.1.0' |
| 11 | + required: true |
| 12 | + type: string |
| 13 | + |
| 14 | +jobs: |
| 15 | + build-test-publish: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v3 |
| 19 | + |
| 20 | + - name: Set up Python |
| 21 | + uses: actions/setup-python@v4 |
| 22 | + with: |
| 23 | + python-version: '3.10' |
| 24 | + |
| 25 | + - name: Install dependencies |
| 26 | + run: | |
| 27 | + python -m pip install --upgrade pip |
| 28 | + pip install hatch pytest |
| 29 | +
|
| 30 | + - name: Build package |
| 31 | + working-directory: exporters/aws-otel-otlp-udp-exporter |
| 32 | + run: hatch build |
| 33 | + |
| 34 | + - name: Setup X-Ray daemon |
| 35 | + run: | |
| 36 | + # Download X-Ray daemon |
| 37 | + wget https://s3.us-east-2.amazonaws.com/aws-xray-assets.us-east-2/xray-daemon/aws-xray-daemon-linux-3.x.zip |
| 38 | + unzip -o aws-xray-daemon-linux-3.x.zip |
| 39 | + |
| 40 | + # Create config file |
| 41 | + echo '{ |
| 42 | + "Version": 2, |
| 43 | + "TotalBufferSizeMB": 10, |
| 44 | + "Logging": { |
| 45 | + "LogLevel": "debug" |
| 46 | + }, |
| 47 | + }' > xray-daemon-config.json |
| 48 | +
|
| 49 | + # Make sure xray is executable |
| 50 | + chmod +x ./xray |
| 51 | + |
| 52 | + # Create logs directory |
| 53 | + mkdir -p daemon-logs |
| 54 | + |
| 55 | + # Start X-Ray daemon |
| 56 | + ./xray -o -n us-west-2 -c xray-daemon-config.json > daemon-logs/xray-daemon.log 2>&1 & |
| 57 | + XRAY_PID=$! |
| 58 | + echo "X-Ray daemon started with PID $XRAY_PID" |
| 59 | + |
| 60 | + # Wait for daemon to be ready |
| 61 | + echo "Waiting for X-Ray daemon to start..." |
| 62 | + sleep 5 |
| 63 | + |
| 64 | + # Check if process is still running |
| 65 | + if ps -p $XRAY_PID > /dev/null; then |
| 66 | + echo "✅ X-Ray daemon process is running" |
| 67 | + else |
| 68 | + echo "❌ X-Ray daemon process is not running" |
| 69 | + echo "Log contents:" |
| 70 | + cat daemon-logs/xray-daemon.log |
| 71 | + exit 1 |
| 72 | + fi |
| 73 | + |
| 74 | + # Try to connect to the daemon |
| 75 | + if nc -zv 127.0.0.1 2000 2>&1; then |
| 76 | + echo "✅ Successfully connected to X-Ray daemon on port 2000" |
| 77 | + else |
| 78 | + echo "❌ Cannot connect to X-Ray daemon on port 2000" |
| 79 | + echo "Log contents:" |
| 80 | + cat daemon-logs/xray-daemon.log |
| 81 | + exit 1 |
| 82 | + fi |
| 83 | + |
| 84 | + # Extra verification with curl (might not work depending on daemon setup) |
| 85 | + if curl -s http://localhost:2000/GetDaemonVersion; then |
| 86 | + echo "✅ X-Ray daemon API responded" |
| 87 | + else |
| 88 | + echo "ℹ️ X-Ray daemon doesn't support API or not ready yet" |
| 89 | + # Don't exit with error as this might not be reliable |
| 90 | + fi |
| 91 | + |
| 92 | + echo "X-Ray daemon setup completed" |
| 93 | +
|
| 94 | + - name: Setup validation app |
| 95 | + run: | |
| 96 | + pip install ./exporters/aws-otel-otlp-udp-exporter/dist/*.whl |
| 97 | +
|
| 98 | + - name: Run validation test |
| 99 | + working-directory: exporters/aws-otel-otlp-udp-exporter/validation-app |
| 100 | + run: python app.py |
| 101 | + |
| 102 | + - name: Verify X-Ray daemon received traces |
| 103 | + run: | |
| 104 | + echo "X-Ray daemon logs:" |
| 105 | + cat daemon-logs/xray-daemon.log |
| 106 | +
|
| 107 | + # Check if the daemon received and processed some data |
| 108 | + if grep -q "sending.*batch" daemon-logs/xray-daemon.log; then |
| 109 | + echo "✅ X-Ray daemon processed trace data (AWS upload errors are expected)" |
| 110 | + exit 0 |
| 111 | + elif grep -q "processor:.*segment" daemon-logs/xray-daemon.log; then |
| 112 | + echo "✅ X-Ray daemon processed segment data (AWS upload errors are expected)" |
| 113 | + exit 0 |
| 114 | + else |
| 115 | + echo "❌ No evidence of traces being received by X-Ray daemon" |
| 116 | + exit 1 |
| 117 | + fi |
0 commit comments