{"id":15643071,"url":"https://github.com/int128/datadog-actions-metrics","last_synced_at":"2026-02-07T19:20:26.907Z","repository":{"id":37048297,"uuid":"387928092","full_name":"int128/datadog-actions-metrics","owner":"int128","description":"Send GitHub Actions metrics to Datadog for developer experience","archived":false,"fork":false,"pushed_at":"2024-05-28T10:07:08.000Z","size":33515,"stargazers_count":60,"open_issues_count":15,"forks_count":17,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-29T02:39:41.843Z","etag":null,"topics":["datadog","github-actions","metrics","observability"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/int128.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-20T22:28:29.000Z","updated_at":"2024-07-31T13:05:02.987Z","dependencies_parsed_at":"2024-01-24T11:39:46.461Z","dependency_job_id":"35f0ecac-20bc-4b27-8d40-9586ab8d1d66","html_url":"https://github.com/int128/datadog-actions-metrics","commit_stats":{"total_commits":607,"total_committers":3,"mean_commits":"202.33333333333334","dds":"0.15980230642504123","last_synced_commit":"871346c9e050e0eb1d0f6bdc66d925bfa43cb20a"},"previous_names":[],"tags_count":108,"template":false,"template_full_name":"int128/typescript-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Fdatadog-actions-metrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Fdatadog-actions-metrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Fdatadog-actions-metrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Fdatadog-actions-metrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/int128","download_url":"https://codeload.github.com/int128/datadog-actions-metrics/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154983,"owners_count":21056543,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datadog","github-actions","metrics","observability"],"created_at":"2024-10-03T11:58:48.162Z","updated_at":"2025-12-28T01:37:14.595Z","avatar_url":"https://github.com/int128.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# datadog-actions-metrics [![ts](https://github.com/int128/datadog-actions-metrics/actions/workflows/ts.yaml/badge.svg)](https://github.com/int128/datadog-actions-metrics/actions/workflows/ts.yaml) [![e2e](https://github.com/int128/datadog-actions-metrics/actions/workflows/e2e.yaml/badge.svg)](https://github.com/int128/datadog-actions-metrics/actions/workflows/e2e.yaml)\n\nThis is an action to send metrics of GitHub Actions to Datadog on an event.\nIt is inspired from [yuya-takeyama/github-actions-metrics-to-datadog-action](https://github.com/yuya-takeyama/github-actions-metrics-to-datadog-action).\n\n## Purpose\n\n### Improve the reliability and experience of CI/CD pipeline\n\nTo collect the metrics when a workflow run is completed:\n\n```yaml\non:\n  workflow_run:\n    workflows:\n      - '**'\n    types:\n      - completed\n\njobs:\n  send:\n    runs-on: ubuntu-latest\n    timeout-minutes: 10\n    steps:\n      - uses: int128/datadog-actions-metrics@v1\n        with:\n          # create an API key in https://docs.datadoghq.com/account_management/api-app-keys/\n          datadog-api-key: ${{ secrets.DATADOG_API_KEY }}\n```\n\nFor the developer experience, you can analyze the following metrics:\n\n- Time to test an application\n- Time to build and deploy an application\n\nFor the reliability, you can monitor the following metrics:\n\n- Success rate of the default branch\n- Rate limit of built-in `GITHUB_TOKEN`\n\nHere is an example of screenshot in Datadog.\n\n\u003cimg width=\"1342\" alt=\"image\" src=\"https://github.com/int128/datadog-actions-metrics/assets/321266/99e813d7-8f42-4896-aba5-c66fe6b84a53\"\u003e\n\n### Improve the reliability and experience of self-hosted runners\n\nFor the self-hosted runners, you can monitor the following metrics for reliability and experience:\n\n- Queued time of a job\n- Count of the [lost communication with the server](https://github.com/actions-runner-controller/actions-runner-controller/issues/466) errors\n\nHere is an example of screenshot in Datadog.\n\n\u003cimg width=\"562\" alt=\"image\" src=\"https://github.com/int128/datadog-actions-metrics/assets/321266/0baba537-a5f2-4a66-98b6-e3f372f5871d\"\u003e\n\n### Improve your team development process\n\nYou can analyze your development activity such as number of merged pull requests.\nIt helps the continuous process improvement of your team.\n\nTo collect the metrics when a pull request is opened, closed or merged into main:\n\n```yaml\non:\n  pull_request:\n    types:\n      - opened\n      - closed\n  push:\n    branches:\n      - main\n\njobs:\n  send:\n    runs-on: ubuntu-latest\n    timeout-minutes: 10\n    steps:\n      - uses: int128/datadog-actions-metrics@v1\n        with:\n          # create an API key in https://docs.datadoghq.com/account_management/api-app-keys/\n          datadog-api-key: ${{ secrets.DATADOG_API_KEY }}\n```\n\n## Overview\n\nThis action can handle the following events:\n\n- workflow_run event\n- pull_request event\n- push event\n- schedule event\n\nOther events are ignored.\n\n## Metrics for workflow_run event\n\n### Workflow run\n\nThis action sends the following metrics.\n\n- `github.actions.workflow_run.total`\n  - Total workflow runs (count)\n- `github.actions.workflow_run.conclusion.{CONCLUSION}_total`\n  - Total workflow runs by the conclusion (count).\n    See [the official document](https://docs.github.com/en/rest/reference/checks#create-a-check-run) for the possible values of `CONCLUSION` field\n  - e.g. `github.actions.workflow_run.conclusion.success_total`\n  - e.g. `github.actions.workflow_run.conclusion.failure_total`\n- `github.actions.workflow_run.duration_second`\n- `github.actions.workflow_run.duration_second.distribution`\n  - Time from a workflow run is started until it is updated (gauge or distribution)\n\nIt has the following tags:\n\n- `repository_owner`\n- `repository_name`\n- `workflow_name`\n- `workflow_id`\n- `run_attempt`\n  - Attempt number of the run, 1 for first attempt and higher if the workflow was re-run\n- `event`\n- `sender`\n- `sender_type` = either `Bot`, `User` or `Organization`\n- `branch`\n- `default_branch` = `true` or `false`\n- `pull_request_number`\n  - Pull request(s) which triggered the workflow\n- `conclusion`\n\nSee also the actual metrics in the [E2E test](https://github.com/int128/datadog-actions-metrics/actions/workflows/e2e.yaml).\n\n### Job\n\nThis action sends the following metrics if `collect-job-metrics` is enabled.\n\n- `github.actions.job.total`\n  - Total jobs (count)\n- `github.actions.job.conclusion.{CONCLUSION}_total`\n  - Total jobs by the conclusion (count)\n  - e.g. `github.actions.job.conclusion.success_total`\n  - e.g. `github.actions.job.conclusion.failure_total`\n- `github.actions.job.queued_duration_second`\n- `github.actions.job.queued_duration_second.distribution`\n  - Time from a job is created to started (gauge or distribution)\n- `github.actions.job.duration_second`\n- `github.actions.job.duration_second.distribution`\n  - Time from a job is started to completed (gauge or distribution)\n- `github.actions.job.start_time_from_workflow_start_second`\n- `github.actions.job.start_time_from_workflow_start_second.distribution`\n  - Time from the workflow run is started until a job is started (gauge or distribution)\n- `github.actions.job.lost_communication_with_server_error_total`\n  - Count of \"lost communication with the server\" errors of self-hosted runners.\n    See the issue [#444](https://github.com/int128/datadog-actions-metrics/issues/444) for details\n- `github.actions.job.received_shutdown_signal_error_total`\n  - Count of \"The runner has received a shutdown signal\" errors of self-hosted runners.\n\nIt has the following tags:\n\n- `repository_owner`\n- `repository_name`\n- `workflow_name`\n- `workflow_id`\n- `event`\n- `sender`\n- `sender_type` = either `Bot`, `User` or `Organization`\n- `branch`\n- `default_branch` = `true` or `false`\n- `pull_request_number`\n  - Pull request(s) which triggered the workflow\n- `job_name`\n- `job_id`\n- `conclusion`\n- `status`\n- `runs_on`\n  - Runner label inferred from the workflow file if available\n  - e.g. `ubuntu-latest`\n\n### Step\n\nThis action sends the following metrics if `collect-step-metrics` is enabled.\n\n- `github.actions.step.total`\n  - Total steps (count)\n- `github.actions.step.conclusion.{CONCLUSION}_total`\n  - Total steps by the conclusion (count)\n  - e.g. `github.actions.step.conclusion.success_total`\n  - e.g. `github.actions.step.conclusion.failure_total`\n- `github.actions.step.duration_second`\n- `github.actions.step.duration_second.distribution`\n  - Time from a step is started until completed (gauge or distribution)\n- `github.actions.step.start_time_from_workflow_start_second`\n- `github.actions.step.start_time_from_workflow_start_second.distribution`\n  - Time from the workflow run is started until a step is started (gauge or distribution)\n\nIt has the following tags:\n\n- `repository_owner`\n- `repository_name`\n- `workflow_name`\n- `workflow_id`\n- `event`\n- `sender`\n- `sender_type` = either `Bot`, `User` or `Organization`\n- `branch`\n- `default_branch` = `true` or `false`\n- `pull_request_number`\n  - Pull request(s) which triggered the workflow\n- `job_name`\n- `job_id`\n- `step_name`\n- `step_number` = 1, 2, ...\n- `conclusion`\n- `status`\n- `runs_on`\n  - Runner label inferred from the workflow file if available\n  - e.g. `ubuntu-latest`\n\n### Enable job or step metrics\n\nTo send the metrics of jobs and steps:\n\n```yaml\nsteps:\n  - uses: int128/datadog-actions-metrics@v1\n    with:\n      datadog-api-key: ${{ secrets.DATADOG_API_KEY }}\n      collect-job-metrics: true\n      collect-step-metrics: true\n```\n\nTo send the metrics of jobs and steps on the default branch only:\n\n```yaml\nsteps:\n  - uses: int128/datadog-actions-metrics@v1\n    with:\n      datadog-api-key: ${{ secrets.DATADOG_API_KEY }}\n      collect-job-metrics: ${{ github.event.workflow_run.head_branch == github.event.repository.default_branch }}\n      collect-step-metrics: ${{ github.event.workflow_run.head_branch == github.event.repository.default_branch }}\n```\n\nThis action calls GitHub REST API and GraphQL API to get jobs and steps of the current workflow run.\nNote that it may cause the rate exceeding error when too many workflows are run.\n\nIf the job or step metrics is enabled, this action requires the following permissions:\n\n```yaml\npermissions:\n  actions: read\n  checks: read\n  contents: read\n```\n\n### Prefer distribution metrics\n\nThis action sends the gauge metrics by default.\nTo send the distribution metrics instead of the gauge metrics,\n\n```yaml\nsteps:\n  - uses: int128/datadog-actions-metrics@v1\n    with:\n      datadog-api-key: ${{ secrets.DATADOG_API_KEY }}\n      prefer-distribution-workflow-run-metrics: true\n      collect-job-metrics: true\n      collect-step-metrics: true\n      prefer-distribution-job-metrics: true\n      prefer-distribution-step-metrics: true\n```\n\nNote that the distribution metrics may increase the custom metrics cost.\n\n## Metrics for pull_request event\n\n### Pull request (opened)\n\nThis action sends the following metrics on `opened` type.\n\n- `github.actions.pull_request_opened.total`\n  - Total opened events (count)\n- `github.actions.pull_request_opened.commits`\n  - Number of commits in a pull request (count)\n- `github.actions.pull_request_opened.changed_files`\n  - Number of changed files in a pull request (count)\n- `github.actions.pull_request_opened.additions`\n  - Number of added lines in a pull request (count)\n- `github.actions.pull_request_opened.deletions`\n  - Number of deleted lines in a pull request (count)\n\nIt has the following tags:\n\n- `repository_owner`\n- `repository_name`\n- `sender`\n- `sender_type` = either `Bot`, `User` or `Organization`\n- `user`\n- `pull_request_number`\n- `draft` = `true` or `false`\n- `base_ref`\n- `head_ref`\n\n### Pull request (closed)\n\nThis action sends the following metrics on `closed` type.\n\n- `github.actions.pull_request_closed.total`\n  - Total closed events (count)\n- `github.actions.pull_request_closed.since_opened_seconds`\n  - Time from a pull request is opened to closed (gauge)\n- `github.actions.pull_request_closed.since_first_authored_seconds`\n  - Time from the authored time of the first commit until closed (gauge)\n- `github.actions.pull_request_closed.since_first_committed_seconds`\n  - Time from the committed time of the first commit until closed (gauge)\n- `github.actions.pull_request_closed.commits`\n  - Number of commits in a pull request (count)\n- `github.actions.pull_request_closed.changed_files`\n  - Number of changed files in a pull request (count)\n- `github.actions.pull_request_closed.additions`\n  - Number of added lines in a pull request (count)\n- `github.actions.pull_request_closed.deletions`\n  - Number of deleted lines in a pull request (count)\n\nIt has the following tags:\n\n- `repository_owner`\n- `repository_name`\n- `sender`\n- `sender_type` = either `Bot`, `User` or `Organization`\n- `user`\n- `pull_request_number`\n- `draft` = `true` or `false`\n- `base_ref`\n- `head_ref`\n- `merged` = `true` or `false`\n- `requested_team`\n  - Team(s) of requested reviewer(s)\n- `label`\n  - Label(s) of a pull request\n  - Available if `send-pull-request-labels` is set\n\n### Permissions\n\nFor pull_request event, this action requires the following permissions:\n\n```yaml\npermissions:\n  pull-requests: read\n```\n\n## Metrics for push event\n\nThis action sends the following metrics.\n\n- `github.actions.push.total`\n  - Total push events (count)\n\nIt has the following tags:\n\n- `repository_owner`\n- `repository_name`\n- `sender`\n- `sender_type` = either `Bot`, `User` or `Organization`\n- `ref`\n- `created` = `true` or `false`\n- `deleted` = `true` or `false`\n- `forced` = `true` or `false`\n- `default_branch` = `true` or `false`\n\n## Metrics for schedule event\n\n### Workflow run\n\nThis action sends the following metrics:\n\n- `github.actions.schedule.queued_workflow_run.total`\n  - Number of queued workflow runs (gauge)\n\nIt has the following tags:\n\n- `repository_owner`\n- `repository_name`\n\nIt is useful for monitoring self-hosted runners.\n\n### Permissions\n\nFor schedule event, this action requires the following permissions:\n\n```yaml\npermissions:\n  actions: read\n```\n\n## Metrics for all supported events\n\n### Rate limit\n\nThis action always sends the following metrics of [the built-in `GITHUB_TOKEN` rate limit](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api).\n\n- `github.actions.api_rate_limit.remaining`\n  - Remaining requests of GitHub API (gauge)\n- `github.actions.api_rate_limit.limit`\n  - Limit of requests of GitHub API (gauge)\n\nIt has the following tags:\n\n- `repository_owner`\n- `repository_name`\n- `resource` = `core`, `search` and `graphql`\n\nThis does not affect the rate limit of GitHub API because it just calls [`/rate_limit` endpoint](https://docs.github.com/en/rest/reference/rate-limit).\n\n## Specification\n\nYou can set the following inputs:\n\n| Name                                       | Default        | Description                                                                     |\n| ------------------------------------------ | -------------- | ------------------------------------------------------------------------------- |\n| `github-token`                             | `github.token` | GitHub token to get jobs and steps if needed                                    |\n| `github-token-rate-limit-metrics`          | `github.token` | GitHub token for rate limit metrics                                             |\n| `datadog-api-key`                          | -              | Datadog API key. If not set, this action does not send metrics actually         |\n| `datadog-site`                             | -              | Datadog Server name such as `datadoghq.eu`, `ddog-gov.com`, `us3.datadoghq.com` |\n| `datadog-tags`                             | -              | Additional tags in the form of `key:value` in a multiline string                |\n| `metrics-patterns`                         | -              | Filter the metrics by patterns in a multiline string                            |\n| `tag-key-patterns`                         | -              | Filter the tag keys by patterns in a multiline string                           |\n| `send-pull-request-labels`                 | `false`        | Send pull request labels as Datadog tags                                        |\n| `collect-job-metrics`                      | `false`        | Collect job metrics                                                             |\n| `collect-step-metrics`                     | `false`        | Collect step metrics                                                            |\n| `prefer-distribution-workflow-run-metrics` | `false`        | If true, send the distribution metrics instead of gauge metrics                 |\n| `prefer-distribution-job-metrics`          | `false`        | If true, send the distribution metrics instead of gauge metrics                 |\n| `prefer-distribution-step-metrics`         | `false`        | If true, send the distribution metrics instead of gauge metrics                 |\n\n### Filter metrics\n\nIf `metrics-patterns` is set, this action sends the metrics filtered by the glob patterns.\nThe glob specification is same as [the filters of workflow](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/triggering-a-workflow#using-filters).\n\nTo include the specific metrics,\n\n```yaml\nsteps:\n  - uses: int128/datadog-actions-metrics@v1\n    with:\n      metrics-patterns: |\n        github.actions.workflow_run.*\n        github.actions.job.*\n```\n\nTo exclude the specific metrics,\n\n```yaml\nsteps:\n  - uses: int128/datadog-actions-metrics@v1\n    with:\n      metrics-patterns: |\n        *\n        !github.actions.*.conclusion.*\n```\n\nIf both include and exclude patterns are given, the later pattern has higher precedence.\n\n### Filter tags\n\nThe `tag-key-patterns` input allows you to specify the tag keys to be included or excluded from the metrics sent to Datadog.\nThe glob specification is same as [the filters of workflow](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/triggering-a-workflow#using-filters).\n\nTo include the specific tags,\n\n```yaml\nsteps:\n  - uses: int128/datadog-actions-metrics@v1\n    with:\n      tag-key-patterns: |\n        workflow_*\n        job_name\n```\n\nTo exclude the specific tags,\n\n```yaml\nsteps:\n  - uses: int128/datadog-actions-metrics@v1\n    with:\n      tag-key-patterns: |\n        *\n        !job_id\n        !runs_on\n```\n\nIf both include and exclude patterns are given, the later pattern has higher precedence.\n\n### Proxy\n\nTo connect to Datadog API via a HTTPS proxy, set `https_proxy` environment variable.\nFor example,\n\n```yaml\nsteps:\n  - uses: int128/datadog-actions-metrics@v1\n    with:\n      datadog-api-key: ${{ secrets.DATADOG_API_KEY }}\n    env:\n      https_proxy: http://proxy.example.com:8080\n```\n\n## Contribution\n\nThis is an open source software.\nFeel free to open issues and pull requests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fint128%2Fdatadog-actions-metrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fint128%2Fdatadog-actions-metrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fint128%2Fdatadog-actions-metrics/lists"}