Skip to content

Commit

Permalink
update gh actions workflow traces to metrics
Browse files Browse the repository at this point in the history
Signed-off-by: sallyom <[email protected]>
  • Loading branch information
sallyom committed Jul 7, 2024
1 parent 67e8135 commit 0455b4a
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 256 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/chatbot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

- name: Install opentelemetry dependencies
run: |
pip install --no-cache-dir opentelemetry-sdk opentelemetry-exporter-otlp opentelemetry-instrumentation
pip install --no-cache-dir opentelemetry-sdk opentelemetry-exporter-otlp
- name: Download OpenTelemetry Collector Contrib
run: |
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
verbosity: detailed
service:
pipelines:
traces:
metrics:
receivers: [otlp]
exporters: [debug, otlphttp]
' > otel-collector-config.yaml
Expand All @@ -93,12 +93,12 @@ jobs:
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Start job trace
- name: Start Metric
run: |
export WORKFLOW_NAME="chatbot"
export JOB_NAME="chatbot-build-and-push"
export TRACE_ACTION="start"
python ci/trace-steps.py
export METRIC_ACTION="start"
python ci/metrics-generate.py
- name: Build Image
id: build_image
Expand Down Expand Up @@ -140,10 +140,10 @@ jobs:
tags: ${{ steps.build_image.outputs.tags }}
registry: ${{ env.REGISTRY }}

- name: End job trace
- name: End Metric
run: |
export WORKFLOW_NAME="chatbot"
export JOB_NAME="chatbot-build-and-push"
export TRACE_ACTION="end"
python ci/trace-steps.py
export METRIC_ACTION="end"
python ci/metrics-generate.py
94 changes: 0 additions & 94 deletions .github/workflows/test-trace-steps.yaml

This file was deleted.

135 changes: 28 additions & 107 deletions .github/workflows/testing_framework.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,50 +53,56 @@ jobs:
with:
python-version: '3.11'

- name: Install Python dependencies for otel trace generation
- name: Install opentelemetry 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 secrets to files
run: |
echo "${{ secrets.ROSA_OTEL_CACERT }}" > /tmp/ca.crt
echo "${{ secrets.ROSA_OTEL_SERVER_CRT }}" > /tmp/server.crt
echo "${{ secrets.ROSA_OTEL_SERVER_KEY }}" > /tmp/server.key
- name: Configure OpenTelemetry Collector
run: |
echo '
receivers:
otlp:
protocols:
grpc:
endpoint: "0.0.0.0:4317"
http:
endpoint: "0.0.0.0:4318"
exporters:
otlphttp:
endpoint: https://apps.platform-sts.pcbk.p1.openshiftapps.com
endpoint: "${{ secrets.ROSA_OTEL_ENDPOINT }}"
tls:
insecure: false
cert_pem: ${{ secrets.CLIENT_CERT_ROSA_OTEL }}
key_pem: ${{ secrets.CLIENT_KEY_ROSA_OTEL }}
ca_pem: ${{ secrets.SERVER_CERT_ROSA_OTEL }}
logging:
cert_file: /tmp/server.crt
key_file: /tmp/server.key
ca_file: /tmp/ca.crt
debug:
verbosity: detailed
service:
pipelines:
traces:
metrics:
receivers: [otlp]
exporters: [logging,otlphttp]
exporters: [debug, otlphttp]
' > otel-collector-config.yaml
- name: Run OpenTelemetry Collector
run: |
curl --proto '=https' --tlsv1.2 -fOL https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.102.1/otelcol_0.102.1_linux_amd64.tar.gz
tar -xvf otelcol_0.102.1_linux_amd64.tar.gz
chmod +x otelcol
./otelcol --config otel-collector-config.yaml &
./otelcol-contrib --config otel-collector-config.yaml > otel-collector.log 2>&1 &
- name: Start integration-tests trace
- name: Start integration-tests job metric
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="integration-tests"
export WORKFLOW_NAME="testing-framework"
export JOB_NAME="integration-tests"
export TRACE_ACTION="start"
python ci/trace-steps.py
python ci/metrics-generate.py
- name: Checkout terraform module
id: checkout-module
Expand All @@ -116,13 +122,6 @@ jobs:
run: terraform init
working-directory: terraform-test-environment-module

- name: Start bootstrap trace
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="bootstrap"
export TRACE_ACTION="start"
python ci/trace-steps.py
- name: Bootstrap
id: up
run: terraform apply -auto-approve -lock=false
Expand All @@ -131,13 +130,6 @@ jobs:
TF_VAR_aws_instance_type: ${{ matrix.aws_image_type }}
TF_VAR_aws_ami_architecture: ${{ matrix.aws_ami_architecture }}

- name: End bootstrap trace
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="bootstrap"
export TRACE_ACTION="end"
python ci/trace-steps.py
- name: Terraform Output
id: terraform-output
run: |
Expand All @@ -150,13 +142,6 @@ jobs:
run: ansible-galaxy install -r ./provision/requirements.yml
working-directory: ./main/recipes/natural_language_processing/chatbot

- name: Start ansible provision trace
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="ansible-provision"
export TRACE_ACTION="start"
python ci/trace-steps.py
- name: Provision
run: |
ansible-playbook ./main/recipes/natural_language_processing/chatbot/provision/playbook.yml \
Expand All @@ -165,37 +150,16 @@ jobs:
env:
ANSIBLE_HOST_KEY_CHECKING: false

- name: End ansible provision trace
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="ansible-provision"
export TRACE_ACTION="end"
python ci/trace-steps.py
- name: Install Dependencies
working-directory: ./main/recipes/natural_language_processing/chatbot
run: make install

- name: Start integration test trace
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="run-integration-tests"
export TRACE_ACTION="start"
python ci/trace-steps.py
- name: Run Integration Tests
working-directory: ./main/recipes/natural_language_processing/chatbot
run: make integration-tests
env:
URL: ${{ steps.terraform-output.outputs.url }}

- name: End integration test trace
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="run-integration-tests"
export TRACE_ACTION="end"
python ci/trace-steps.py
- name: Destroy Test Environment
id: down
if: always()
Expand All @@ -217,12 +181,12 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

- name: Stop testing_framework trace
- name: End integration-tests job metric
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="integration-tests"
export WORKFLOW_NAME="testing-framework"
export JOB_NAME="integration-tests"
export TRACE_ACTION="end"
python ci/trace-steps.py
python ci/metrics-generate.py
release-images:
runs-on: ubuntu-24.04
Expand Down Expand Up @@ -272,53 +236,10 @@ jobs:
with:
python-version: '3.11'

- name: Install Python dependencies for otel trace generation
run: |
pip install --no-cache-dir opentelemetry-sdk opentelemetry-exporter-otlp opentelemetry-instrumentation
- name: Configure OpenTelemetry Collector
run: |
echo '
receivers:
otlp:
protocols:
grpc:
endpoint: "0.0.0.0:4317"
exporters:
logging:
loglevel: debug
service:
pipelines:
traces:
receivers: [otlp]
exporters: [logging]
' > otel-collector-config.yaml
- name: Run OpenTelemetry Collector
run: |
curl --proto '=https' --tlsv1.2 -fOL https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.102.1/otelcol_0.102.1_linux_amd64.tar.gz
tar -xvf otelcol_0.102.1_linux_amd64.tar.gz
chmod +x otelcol
./otelcol --config otel-collector-config.yaml &
- name: Start chatbot make bootc trace
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="test-make-targets"
export TRACE_ACTION="start"
python ci/trace-steps.py
- name: chatbot
working-directory: ./recipes/natural_language_processing/chatbot
run: make bootc

- name: End chatbot make bootc trace
run: |
export WORKFLOW_NAME="testing_framework"
export STEP_NAME="test-make-targets"
export TRACE_ACTION="end"
python ci/trace-steps.py
- name: Publish Job Results to Slack
id: slack
if: always()
Expand Down
Loading

0 comments on commit 0455b4a

Please sign in to comment.