datadog-actions-metrics icon indicating copy to clipboard operation
datadog-actions-metrics copied to clipboard

No job metrics sent

Open craig-cazoo opened this issue 3 years ago • 3 comments

Hi, I recently started using this action and was able to start sending workflow metrics easily

However, I have ran into an issue when enabling collect-job-metrics

No job metrics are being sent to datadog and I get the following warning for my workflow:

Warning: Could not get the check suite: GraphqlError: Resource not accessible by integration

Here's my workflow:

name: Track deployment workflow metrics to Datadog

on:
    workflow_run:
        workflows:
            - Deploy to dev environment
            - Deploy to test environment
            - Deploy to prod environment
        types:
            - completed

jobs:
    send_metrics:
        runs-on: ubuntu-latest
        timeout-minutes: 10
        steps:
            - uses: int128/datadog-actions-metrics@v1
              with:
                  datadog-api-key: ${{ secrets.DATADOG_API_KEY }}
                  datadog-site: datadoghq.eu
                  collect-job-metrics: true
                  github-token: ${{ secrets.GITHUB_TOKEN }}

Do I need to enable some permissions for my github token or have I set up my workflow incorrectly?

Many thanks

Craig

craig-cazoo avatar Nov 17 '22 14:11 craig-cazoo

This action requires checks scope for the job and step metrics.

If you are using the default token (i.e., GITHUB_TOKEN), see https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token. If you are using your personal token or GitHub App, you may need to explicitly give the permission.

int128 avatar Nov 26 '22 05:11 int128

Thanks for the response @int128. But I tried adding read and write permissions for checks but I'm still seeing the same warning and no job metrics are being sent.

Are there any other permissions that I should be adding? I am using the default token but I believe my organisation has restricted access by default.

craig-cazoo avatar Nov 29 '22 14:11 craig-cazoo

FYI, Another issue was open about this and after some manual trial and error I've found the necessary permissions. https://github.com/int128/datadog-actions-metrics/issues/614

uittorio avatar Mar 20 '23 08:03 uittorio