Skip to content

Commit

Permalink
Merge pull request #7965 from Agoric/7964-benchmark-ci-job
Browse files Browse the repository at this point in the history
CI: Github Action to run vats benchmark test and upload results to datadog
  • Loading branch information
toliaqat authored Jun 23, 2023
2 parents 6bce049 + f1713f6 commit 48da763
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 48da763

Please sign in to comment.