|
| 1 | +name: Build, Test, and Publish ADOT OTLP UDP Exporter |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + build-test-publish: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - uses: actions/checkout@v3 |
| 11 | + |
| 12 | + - name: Set up Python |
| 13 | + uses: actions/setup-python@v4 |
| 14 | + with: |
| 15 | + python-version: '3.10' |
| 16 | + |
| 17 | + - name: Install dependencies |
| 18 | + run: | |
| 19 | + python -m pip install --upgrade pip |
| 20 | + pip install hatch pytest |
| 21 | +
|
| 22 | + - name: Build package |
| 23 | + working-directory: exporters/aws-otel-otlp-udp-exporter |
| 24 | + run: hatch build |
| 25 | + |
| 26 | + - name: Setup validation app |
| 27 | + run: | |
| 28 | + mkdir -p validation_app |
| 29 | + cd validation_app |
| 30 | + pip install ../exporters/aws-otel-otlp-udp-exporter/dist.*whl |
| 31 | +
|
| 32 | + - name: Create test script |
| 33 | + working-directory: validation_app |
| 34 | + run: | |
| 35 | + cat > test_exporter.py << 'EOF' |
| 36 | + from opentelemetry import trace |
| 37 | + from opentelemetry.sdk.trace import TracerProvider |
| 38 | + from amazon.opentelemetry.exporter.otlp.udp import OTLPSpanExporter |
| 39 | + |
| 40 | + # Set up tracer |
| 41 | + tracer_provider = TracerProvider() |
| 42 | + trace.set_tracer_provider(tracer_provider) |
| 43 | + |
| 44 | + # Set up UDP exporter |
| 45 | + exporter = OTLPSpanExporter() |
| 46 | + |
| 47 | + # Create a span for testing |
| 48 | + tracer = trace.get_tracer(__name__) |
| 49 | + with tracer.start_as_current_span("test_span") as span: |
| 50 | + span.set_attribute("test.attribute", "test_value") |
| 51 | + print("Span created and exported via UDP") |
| 52 | + |
| 53 | + print("Validation successful!") |
| 54 | + EOF |
| 55 | +
|
| 56 | + - name: Run validation test |
| 57 | + working-directory: validation_app |
| 58 | + run: python test_exporter.py |
0 commit comments