Skip to content

WIP: Otel trace workflow #41

WIP: Otel trace workflow

WIP: Otel trace workflow #41

# To run locally
# act -W .github/workflows/test-trace-steps.yaml --container-architecture linux/amd64 -b ci/logs:/logs
name: Test Workflow
on:
pull_request:
branches:
- main
paths:
- .github/workflows/test-trace-steps.yaml
workflow_dispatch:
jobs:
test:
if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests')"
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Install Python dependencies
run: |
pip install --no-cache-dir opentelemetry-sdk opentelemetry-exporter-otlp opentelemetry-instrumentation
- name: Download OpenTelemetry Collector Contrib
run: |
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.103.0/otelcol-contrib_0.103.0_linux_amd64.tar.gz
tar -xvf otelcol-contrib_0.103.0_linux_amd64.tar.gz
- name: Write rosa cluster ca.crt to file
env:
ROSA_ROOT_CERT: ${{ secrets.ROSA_ROOT_CERT }}
run: |
echo "${ROSA_ROOT_CERT}" | base64 --decode > /tmp/ca.crt
- name: Configure OpenTelemetry Collector
run: |
echo '
extensions:
basicauth/client:
client_auth:
username: "${{ secrets.OTEL_USERNAME }}"
password: "${{ secrets.OTEL_PASSWORD }}"
receivers:
otlp:
protocols:
grpc:
http:
exporters:
otlphttp:
endpoint: https://otc.apps.platform-sts.pcbk.p1.openshiftapps.com
auth:
authenticator: basicauth/client
tls:
insecure: false
ca_file: /tmp/ca.crt
debug:
verbosity: detailed
service:
extensions: [basicauth/client]
pipelines:
traces:
receivers: [otlp]
exporters: [debug, otlphttp]
' > otel-collector-config.yaml
- name: Run OpenTelemetry Collector
run: |
./otelcol-contrib --config otel-collector-config.yaml &
- name: Start build trace
run: |
export WORKFLOW_NAME="test-workflow"
export STEP_NAME="build"
export TRACE_ACTION="start"
python ci/trace-steps.py
- name: Build
run: |
echo "Simulating build step..."
sleep 2
- name: End build trace
run: |
export WORKFLOW_NAME="test-workflow"
export STEP_NAME="build"
export TRACE_ACTION="end"
python ci/trace-steps.py
- name: Start test trace
run: |
export WORKFLOW_NAME="test-workflow"
export STEP_NAME="test"
export TRACE_ACTION="start"
python ci/trace-steps.py
- name: Test
run: |
echo "Simulating test step..."
sleep 2
- name: End test trace
run: |
export WORKFLOW_NAME="test-workflow"
export STEP_NAME="test"
export TRACE_ACTION="end"
python ci/trace-steps.py