All Projects → int128 → datadog-actions-metrics

int128 / datadog-actions-metrics

Licence: Apache-2.0 license
Send GitHub Actions metrics to Datadog

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to datadog-actions-metrics

Datav
📊https://datav.io is a modern APM, provide observability for your business, application and infrastructure. It's also a lightweight alternative to Grafana.
Stars: ✭ 2,757 (+10111.11%)
Mutual labels:  datadog, observability
goodfirstissues
A website that targets developers who want to contribute to open source software but do not know where or how to start.
Stars: ✭ 59 (+118.52%)
Mutual labels:  github-actions
mojito-admin-starter
此项目主要为了演示如何自动化 Fullstack project 的 Infrastructure。
Stars: ✭ 17 (-37.04%)
Mutual labels:  github-actions
phpstan-ga
GithubAction for PHPStan
Stars: ✭ 85 (+214.81%)
Mutual labels:  github-actions
ssh-action
🖥 github ssh action
Stars: ✭ 122 (+351.85%)
Mutual labels:  github-actions
discord-action
GitHub Action that sends a Discord message.
Stars: ✭ 66 (+144.44%)
Mutual labels:  github-actions
setup-just
🤖 GitHub Action to install the just command runner
Stars: ✭ 21 (-22.22%)
Mutual labels:  github-actions
actions
Collection of repetitive GitHub Actions
Stars: ✭ 12 (-55.56%)
Mutual labels:  github-actions
open-telemetry-java-guides
Java OpenTelemetry 测试指南 :Open-Telemetry-Java-Guides 案例,用于测试常用中间件支持及 Otel 相关组件的使用情况。 可观察性Sig: https://i.cloudnative.to/observability/
Stars: ✭ 67 (+148.15%)
Mutual labels:  observability
start-here
You should open this repo first
Stars: ✭ 86 (+218.52%)
Mutual labels:  github-actions
gitactionboard
GitactionBoard - Ultimate Dashboard for GithubActions.
Stars: ✭ 30 (+11.11%)
Mutual labels:  github-actions
corona-kakao-bot
🤖 카카오톡 코로나 알리미
Stars: ✭ 17 (-37.04%)
Mutual labels:  github-actions
ghaction-chocolatey
GitHub Action for Chocolatey, the package manager for Windows
Stars: ✭ 58 (+114.81%)
Mutual labels:  github-actions
slab
An extensible Scala framework for creating monitoring dashboards.
Stars: ✭ 23 (-14.81%)
Mutual labels:  observability
terraform-github-actions-demo
HashiCorp Terraform Github Actions Demo for Github Satellite 2020.
Stars: ✭ 40 (+48.15%)
Mutual labels:  github-actions
flatpak-github-actions
Build your Flatpak application using Github Actions
Stars: ✭ 73 (+170.37%)
Mutual labels:  github-actions
beefheart
A tool to index Fastly realtime analytics metrics into Elasticsearch.
Stars: ✭ 14 (-48.15%)
Mutual labels:  observability
typescript-api-starter
🔰 Starter for Node.js express API in Typescript 🚀
Stars: ✭ 72 (+166.67%)
Mutual labels:  github-actions
nrwl-nx-action
A GitHub Action to wrap Nrwl Nx commands in your workflows.
Stars: ✭ 163 (+503.7%)
Mutual labels:  github-actions
action-eslint
GitHub Action to run ESLint on files changed in current PR
Stars: ✭ 44 (+62.96%)
Mutual labels:  github-actions

datadog-actions-metrics ts e2e

This is an action to send metrics of GitHub Actions to Datadog on an event. It is inspired from yuya-takeyama/github-actions-metrics-to-datadog-action.

Purpose

Analyze workflow run statistics

You can analyze the workflow run statistics such as duration or success rate. It is useful to improve long-time tests or flaky tests.

Here is an example of screenshot in Datadog.

image

To collect the metrics of a workflow on completed:

on:
  workflow_run:
    workflows:
      - '**'
    types:
      - completed

jobs:
  send:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: int128/datadog-actions-metrics@v1
        with:
          # create an API key in https://docs.datadoghq.com/account_management/api-app-keys/
          datadog-api-key: ${{ secrets.DATADOG_API_KEY }}

See also the actual metrics in the E2E test.

Analyze pull request statistics

You can analyze your development activity such as number of merged pull requests. It helps the continuous process improvement of your team.

To collect the metrics of a pull request:

on:
  pull_request:
    types:
      - opened
      - closed

jobs:
  send:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: int128/datadog-actions-metrics@v1
        with:
          # create an API key in https://docs.datadoghq.com/account_management/api-app-keys/
          datadog-api-key: ${{ secrets.DATADOG_API_KEY }}

Overview

This action handles the following events:

  • workflow_run event
  • pull_request event
  • push event
  • schedule event

It ignores other events.

Metrics for workflow_run event

Workflow run

This action sends the following metrics.

  • github.actions.workflow_run.total
  • github.actions.workflow_run.conclusion.{CONCLUSION}_total
    • e.g. github.actions.workflow_run.conclusion.success_total
    • e.g. github.actions.workflow_run.conclusion.failure_total
    • See the official document for the possible values of CONCLUSION field
  • github.actions.workflow_run.duration_second
    • Time from a workflow is started until it is updated
  • github.actions.workflow_run.queued_duration_second
    • Time from a workflow is created until the first job is started
    • Available for the first workflow run only

It has the following tags:

  • repository_owner
  • repository_name
  • workflow_name
  • workflow_id
  • event
  • sender
  • sender_type = either Bot, User or Organization
  • branch
  • default_branch = true or false
  • conclusion

Job

This action sends the following metrics if enabled.

  • github.actions.job.total
  • github.actions.job.conclusion.{CONCLUSION}_total
    • e.g. github.actions.job.conclusion.success_total
    • e.g. github.actions.job.conclusion.failure_total
  • github.actions.job.duration_second
    • Time from a job is started to completed
  • github.actions.job.queued_duration_second
    • Time from a job is started until the first step is started

It has the following tags:

  • repository_owner
  • repository_name
  • workflow_name
  • workflow_id
  • event
  • sender
  • sender_type = either Bot, User or Organization
  • branch
  • default_branch = true or false
  • job_name
  • job_id
  • conclusion
  • status
  • runs_on
    • Runner label inferred from the workflow file if available
    • e.g. ubuntu-latest

Step

This action sends the following metrics if enabled.

  • github.actions.step.total
  • github.actions.step.conclusion.{CONCLUSION}_total
    • e.g. github.actions.step.conclusion.success_total
    • e.g. github.actions.step.conclusion.failure_total
  • github.actions.step.duration_second

It has the following tags:

  • repository_owner
  • repository_name
  • workflow_name
  • workflow_id
  • event
  • sender
  • sender_type = either Bot, User or Organization
  • branch
  • default_branch = true or false
  • job_name
  • job_id
  • step_name
  • step_number = 1, 2, ...
  • conclusion
  • status
  • runs_on
    • Runner label inferred from the workflow file if available
    • e.g. ubuntu-latest

Enable job and step metrics

To send the metrics of jobs and steps:

      - uses: int128/datadog-actions-metrics@v1
        with:
          datadog-api-key: ${{ secrets.DATADOG_API_KEY }}
          collect-job-metrics: true

Note that this action calls GitHub GraphQL API to get jobs and steps of a workflow run. It may cause the rate exceeding error if too many workflows are run.

To send the metrics of jobs and steps on the default branch only:

      - uses: int128/datadog-actions-metrics@v1
        with:
          datadog-api-key: ${{ secrets.DATADOG_API_KEY }}
          collect-job-metrics: ${{ github.event.workflow_run.head_branch == github.event.repository.default_branch }}

Metrics for pull_request event

Pull request (opened)

This action sends the following metrics on opened type.

  • github.actions.pull_request_opened.total
  • github.actions.pull_request_opened.commits
  • github.actions.pull_request_opened.changed_files
  • github.actions.pull_request_opened.additions
  • github.actions.pull_request_opened.deletions

It has the following tags:

  • repository_owner
  • repository_name
  • sender
  • sender_type = either Bot, User or Organization
  • user
  • pull_request_number
  • draft = true or false
  • base_ref
  • head_ref

Pull request (closed)

This action sends the following metrics on closed type.

  • github.actions.pull_request_closed.total
  • github.actions.pull_request_closed.since_opened_seconds
    • Time from a pull request is opened to closed
  • github.actions.pull_request_closed.since_first_authored_seconds
    • Time from the authored time of the first commit until closed
  • github.actions.pull_request_closed.since_first_committed_seconds
    • Time from the committed time of the first commit until closed
  • github.actions.pull_request_closed.commits
  • github.actions.pull_request_closed.changed_files
  • github.actions.pull_request_closed.additions
  • github.actions.pull_request_closed.deletions

It has the following tags:

  • repository_owner
  • repository_name
  • sender
  • sender_type = either Bot, User or Organization
  • user
  • pull_request_number
  • draft = true or false
  • base_ref
  • head_ref
  • merged = true or false
  • requested_team
    • Team(s) of requested reviewer(s)
  • label
    • Label(s) of a pull request
    • Available if send-pull-request-labels is set

Metrics for push event

This action sends the following metrics.

  • github.actions.push.total

It has the following tags:

  • repository_owner
  • repository_name
  • sender
  • sender_type = either Bot, User or Organization
  • ref
  • created = true or false
  • deleted = true or false
  • forced = true or false
  • default_branch = true or false

Metrics for schedule event

Workflow run

This action sends the following metrics:

  • github.actions.schedule.queued_workflow_run.total (gauge)

It has the following tags:

  • repository_owner
  • repository_name

It is useful for monitoring self-hosted runners.

Metrics for all supported events

Rate limit

This action always sends the following metrics of the built-in GITHUB_TOKEN rate limit.

  • github.actions.api_rate_limit.remaining
  • github.actions.api_rate_limit.limit

It has the following tags:

  • repository_owner
  • repository_name
  • resource = core, search and graphql

This does not affect the rate limit of GitHub API because it just calls /rate_limit endpoint.

Specification

You can set the following inputs:

Name Default Description
github-token github.token GitHub token to get jobs and steps if needed
github-token-rate-limit-metrics github.token GitHub token for rate limit metrics
datadog-api-key - Datadog API key. If not set, this action does not send metrics actually
datadog-site - Datadog Server name such as datadoghq.eu, ddog-gov.com, us3.datadoghq.com
send-pull-request-labels false Send pull request labels as Datadog tags
collect-job-metrics false Collect metrics of jobs and steps

Note that collect-job-metrics-for-only-default-branch is no longer supported. Use collect-job-metrics instead.

Contribution

This is an open source software. Feel free to open issues and pull requests.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].