Skip to content

Commit 41005e6

Browse files
authored
Support Speedscope format to profiling pipeline (#1405)
* Update ci_consumption_workflow.yml * add read_all to all pipelines * Update perf-testing-setup.yml * Update perf-testing-setup.yml * Update perf-testing-setup.yml * Update perf-testing-setup.yml * Update perf-testing-setup.yml * Update perf-testing-setup.yml * Update perf-testing-setup.yml * Update perf-testing-setup.yml * Update perf-testing-setup.yml * Update perf-testing-setup.yml * Update perf-testing-setup.yml
1 parent c1143e9 commit 41005e6

10 files changed

+30
-10
lines changed

.github/workflows/ci_consumption_workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11" ]
21-
21+
permissions: read-all
2222
steps:
2323
- name: Checkout code.
2424
uses: actions/checkout@v2

.github/workflows/ci_docker_con_workflow.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
python-version: [ 3.7, 3.8, 3.9, "3.10" ]
20+
permissions: read-all
2021
env:
2122
CONSUMPTION_DOCKER_TEST: "true"
2223

.github/workflows/ci_docker_custom_workflow.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
runs-on: ubuntu-latest
3535
strategy:
3636
fail-fast: false
37+
permissions: read-all
3738
env:
3839
DEDICATED_DOCKER_TEST: ${{ github.event.inputs.DEDICATED_DOCKER_TEST }}
3940
CONSUMPTION_DOCKER_TEST: ${{ github.event.inputs.CONSUMPTION_DOCKER_TEST }}

.github/workflows/ci_docker_ded_workflow.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
python-version: [ 3.7, 3.8, 3.9, "3.10" ]
20+
permissions: read-all
2021
env:
2122
DEDICATED_DOCKER_TEST: "true"
2223

.github/workflows/ci_e2e_workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11" ]
25-
25+
permissions: read-all
2626
steps:
2727
- name: Checkout code.
2828
uses: actions/checkout@v2

.github/workflows/ci_ut_workflow.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11" ]
24+
permissions: read-all
2425
steps:
2526
- uses: actions/checkout@v2
2627
- name: Set up Python ${{ matrix.python-version }}

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ jobs:
3535
language: [ 'python' ]
3636
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
3737
# Learn more about CodeQL language support at https://git.io/codeql-language-support
38-
38+
permissions: read-all
39+
3940
steps:
4041
- name: Checkout repository
4142
uses: actions/checkout@v3

.github/workflows/linter.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
name: Lint Code Base
2727
# Set the agent to run on
2828
runs-on: ubuntu-latest
29+
permissions: read-all
2930

3031
##################
3132
# Load all steps #

.github/workflows/ogf_workflow.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
STORAGE_ACCOUNT_NAME: "ogf${{ matrix.sku }}${{ matrix.region }}${{ github.run_number }}"
6363
FUNCTION_APP_PLAN_NAME: "ogf-epplan-${{ matrix.sku }}-${{ matrix.region }}-${{ github.run_number }}"
6464
runs-on: ubuntu-latest
65+
permissions: read-all
6566
timeout-minutes: 30
6667
strategy:
6768
# V. IMPORTANT: Copy this strategy section to the dependent

.github/workflows/perf-testing-setup.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ on:
1111
description: 'List of perf tests to run'
1212
required: false
1313
default: SyncHelloWorld
14+
report_format:
15+
description: 'Format of profiling report'
16+
type: choice
17+
required: true
18+
options:
19+
- speedscope
20+
- flamegraph
1421
issue_comment:
1522
types: [created]
1623
env:
@@ -21,8 +28,9 @@ env:
2128

2229
jobs:
2330
build:
24-
if: ${{ github.event_name == 'workflow_dispatch' || github.event.issue.pull_request && contains(github.event.comment.body, '/profile') }}
31+
if: ${{ github.event_name == 'workflow_dispatch' || github.event.issue.pull_request != null && contains(github.event.comment.body, '/profile') }}
2532
runs-on: ubuntu-latest
33+
permissions: read-all
2634
strategy:
2735
fail-fast: false
2836
matrix:
@@ -74,9 +82,16 @@ jobs:
7482
docker exec $container_id sh -c "pip install py-spy"
7583
docker exec $container_id sh -c "mkdir /home/profiling_reports"
7684
profiling_sampling_rate=${{ github.event.inputs.profiling_sampling_rate }}
77-
# report_name="${GITHUB_REF#refs/heads/}_${{ github.run_id }}.svg"
78-
report_name="${{ github.run_id }}.svg"
79-
docker exec -d $container_id sh -c "RUST_BACKTRACE=1 py-spy record -p $worker_pid -o /home/profiling_reports/$report_name -f flamegraph --idle --nonblocking --rate $profiling_sampling_rate > /home/site/wwwroot/py-spy.log 2>&1 &"
85+
report_format=${{ github.event.inputs.report_format }}
86+
if [ "$report_format" == "flamegraph" ]; then
87+
report_name="${{ github.run_id }}.svg"
88+
elif [ "$report_format" == "speedscope" ]; then
89+
report_name="${{ github.run_id }}.speedscope.json"
90+
else
91+
echo "Unsupported report format: $report_format"
92+
exit 1
93+
fi
94+
docker exec -d $container_id sh -c "RUST_BACKTRACE=1 py-spy record -p $worker_pid -o /home/profiling_reports/$report_name -f $report_format --idle --nonblocking --rate $profiling_sampling_rate > /home/site/wwwroot/py-spy.log 2>&1 &"
8095
sleep 2 # Give it a moment to start
8196
py_spy_id=$(docker exec $container_id sh -c "ps aux | grep '[p]y-spy record'" | awk '{print $2}')
8297
@@ -94,11 +109,9 @@ jobs:
94109
docker exec $container_id cat /home/site/wwwroot/py-spy.log
95110
docker exec $container_id sh -c "kill -2 $py_spy_id"
96111
sleep 2
97-
98112
mkdir profiling_reports
99113
chmod 777 profiling_reports
100114
docker cp $container_id:/home/profiling_reports/$report_name profiling_reports
101-
102115
- name: Upload SVG to Azure Blob Storage
103116
uses: bacongobbler/[email protected]
104117
with:
@@ -111,7 +124,7 @@ jobs:
111124
run: |
112125
blob_url="https://${{ env.PYTHON_FUNCTION_PROFILING_STORAGE_ACCT }}.blob.core.windows.net/profiling/${{ env.report_name }}"
113126
echo "You can view the Blob at: $blob_url"
114-
127+
115128
- name: Upload profiling result to artifact
116129
uses: actions/upload-artifact@v2
117130
with:

0 commit comments

Comments
 (0)