WIP: Otel trace workflow #37
This file contains 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
# 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: Configure OpenTelemetry Collector | |
env: | |
OTEL_USERNAME: ${{ secrets.OTEL_USERNAME }} | |
OTEL_PASSWORD: ${{ secrets.OTEL_PASSWORD }} | |
ROSA_ROOT_CERT: ${{ secrets.ROSA_ROOT_CERT }} | |
run: | | |
echo ' | |
extensions: | |
basicauth/client: | |
client_auth: | |
username: "${OTEL_USERNAME}" | |
password: "${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_pem: "${ROSA_ROOT_CERT}" | |
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 |