-
Notifications
You must be signed in to change notification settings - Fork 22
Set up UDP Release Workflow #333
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
Merged
yiyuan-he
merged 6 commits into
aws-observability:main
from
yiyuan-he:udp-release-workflow
Mar 5, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1b13ee7
set up release udp exporter gh workflow
yiyuan-he ab18595
remove on push dispatch for udp validation workflow
yiyuan-he 94cf9ce
apply black formatting
yiyuan-he bf11d7f
clean up validation app workflow and move lambda env check
yiyuan-he bbb2498
some small updates
yiyuan-he d0ea21d
rename udp release workflow
yiyuan-he File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Release ADOT OTLP UDP Exporter | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version number for deployment e.g. 0.1.0' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
build-test-publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install hatch pytest flask | ||
|
||
- name: Build package | ||
working-directory: exporters/aws-otel-otlp-udp-exporter | ||
run: hatch build | ||
|
||
- name: Download and run X-Ray Daemon | ||
run: | | ||
mkdir xray-daemon | ||
cd xray-daemon | ||
wget https://s3.us-west-2.amazonaws.com/aws-xray-assets.us-west-2/xray-daemon/aws-xray-daemon-linux-3.x.zip | ||
unzip aws-xray-daemon-linux-3.x.zip | ||
./xray -o -n us-west-2 -f ./daemon-logs.log --log-level debug & | ||
|
||
- name: Install UDP Exporter | ||
run: | | ||
pip install ./exporters/aws-otel-otlp-udp-exporter/dist/*.whl | ||
|
||
- name: Ensure Unit Tests are passing | ||
run: | | ||
pytest exporters/aws-otel-otlp-udp-exporter/tests/ | ||
|
||
- name: Run Sample App in Background | ||
working-directory: sample-applications/integ-test-app | ||
run: | | ||
# Start validation app | ||
python udp_exporter_validation_app.py & | ||
# Wait for validation app to initialize | ||
sleep 5 | ||
|
||
- name: Call Sample App Endpoint | ||
run: | | ||
echo "traceId=$(curl localhost:8080/test)" >> $GITHUB_OUTPUT | ||
|
||
- name: Verify X-Ray daemon received traces | ||
run: | | ||
sleep 10 | ||
echo "X-Ray daemon logs:" | ||
cat xray-daemon/daemon-logs.log | ||
|
||
# Check if the daemon received and processed some data | ||
if grep -q "sending.*batch" xray-daemon/daemon-logs.log; then | ||
echo "✅ X-Ray daemon processed trace data (AWS upload errors are expected)" | ||
exit 0 | ||
elif grep -q "processor:.*segment" xray-daemon/daemon-logs.log; then | ||
echo "✅ X-Ray daemon processed segment data (AWS upload errors are expected)" | ||
exit 0 | ||
else | ||
echo "❌ No evidence of traces being received by X-Ray daemon" | ||
exit 1 | ||
fi | ||
|
||
# TODO: Steps to publish to PyPI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
sample-applications/integ-test-app/udp_exporter_validation_app.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from flask import Flask | ||
|
||
from amazon.opentelemetry.exporters.otlp.udp import OTLPUdpSpanExporter | ||
from opentelemetry import trace | ||
from opentelemetry.sdk.trace import TracerProvider | ||
from opentelemetry.sdk.trace.export import BatchSpanProcessor | ||
|
||
app = Flask(__name__) | ||
|
||
# Set up tracer provider | ||
tracer_provider = TracerProvider() | ||
trace.set_tracer_provider(tracer_provider) | ||
|
||
# Set up UDP exporter with batch processor | ||
exporter = OTLPUdpSpanExporter(endpoint="127.0.0.1:2000") | ||
span_processor = BatchSpanProcessor(exporter) | ||
tracer_provider.add_span_processor(span_processor) | ||
|
||
# Get tracer | ||
tracer = trace.get_tracer(__name__) | ||
|
||
|
||
@app.route("/test", methods=["GET"]) | ||
def create_trace(): | ||
# Create a span for testing with various attributes | ||
tracer = trace.get_tracer(__name__) | ||
with tracer.start_as_current_span("test_parent_span") as parent: | ||
parent.set_attribute("service.name", "validation-app") | ||
parent.set_attribute("test.attribute", "test_value") | ||
parent.add_event("test-event", {"event.data": "some data"}) | ||
|
||
# Get the trace ID | ||
trace_id = format(parent.get_span_context().trace_id, "032x") | ||
|
||
# Add a child span | ||
with tracer.start_as_current_span("test_child_span") as child: | ||
child.set_attribute("child.attribute", "child_value") | ||
print("Created spans with attributes and events") | ||
|
||
# Force flush to ensure spans are exported immediately | ||
success = tracer_provider.force_flush() | ||
print(f"Force flush {'succeeded' if success else 'failed'}") | ||
|
||
return trace_id | ||
|
||
|
||
if __name__ == "__main__": | ||
app.run(port=8080) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.