Skip to content

Commit

Permalink
Github action to run vault perf test and publish results to datadog
Browse files Browse the repository at this point in the history
  • Loading branch information
toliaqat committed Jun 23, 2023
1 parent 6bce049 commit f1713f6
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/actions/publish-metric/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish Datadog Metric
description: GitHub Action to publish a metric to DD.

inputs:
datadog-token:
description: 'secret datadog API token'
required: true
metric:
description: 'metric name for datadog'
required: true
metric-value:
description: 'metric value for datadog'
required: true

runs:
using: 'composite'
steps:
- name: Publish Given Metric to Datadog using API.
shell: bash
id: publish_metric
env:
DATADOG_API_KEY: ${{ inputs.datadog-token }}
VALUE: ${{ inputs.metric-value }}
METRIC: ${{ inputs.metric }}
run: |
export NOW="$(date +%s)"
curl -v POST "https://api.us3.datadoghq.com/api/v1/series" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: $DATADOG_API_KEY" \
-d @- << EOF
{
"series": [{
"metric": "ci.${METRIC}",
"points": [
[
$NOW,
$VALUE
]
],
"tags": [
"os:${{ runner.os }}",
"arch:${{ runner.arch }}",
"repo:${{ github.repository }}",
"job:${{ github.job }}",
"workflow:${{ github.workflow }}",
"source:Github Actions",
"branch:${GITHUB_REF##*/}"
],
"type": "gauge"
}]
}
EOF
36 changes: 36 additions & 0 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Run Benchmarks

# run on changes to trunk, and also nightly

on:
push:
branches: [master]
schedule:
# Run an hour after the daily test-all-packages.yml job, so it can
# populate the build caches
- cron: '47 6 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/restore-node
with:
node-version: '18.x'

- name: yarn bench (vats)
shell: bash
run: |
cd packages/vats && yarn bench
echo "METRIC_VALUE=`cat benchmark-stress-vaults.json | jq .avgPerVaultMs`" >> $GITHUB_ENV
- uses: ./.github/actions/publish-metric
with:
metric: 'vats.perf.avgPerVaultMs'
metric-value: ${{env.METRIC_VALUE}}
datadog-token: ${{ secrets.DATADOG_API_KEY }}

0 comments on commit f1713f6

Please sign in to comment.