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

Is there a Debug Parameter?

Open benjaminu opened this issue 2 years ago • 3 comments
trafficstars

Hi, @int128, I've set this up to send data from my GHA workflow to DataDog; however, I've encountered a number of issues.

  1. When trying to filter, not all my workflows show up as options in DataDog.
  2. Some filter options show up then disappear. So not sure what consistent param to filter by.
  3. github.actions.pull_request_closed.since_first_authored_seconds and github.actions.pull_request_closed.since_first_committed_seconds do not show up in DataDog. I only see github.actions.pull_request_closed.since_opened_seconds.

I'd like to figure out why. Any ideas or is there a param I can use to debug the library and/or payload being sent to DataDog please?

Could it be because I'm using this in my config? collect-job-metrics: ${{ github.event.workflow_run.head_branch == github.event.repository.default_branch }}

benjaminu avatar Dec 01 '22 11:12 benjaminu

Hi @int128, if there is no debug param, can you shed some light on how I can get the following to show up in datadog please?

  1. github.actions.pull_request_closed.since_first_authored_seconds
  2. github.actions.pull_request_closed.since_first_committed_seconds
  3. Workflow names to use as filters

This is what my config file looks like.

name: Track DORA Metrics via Datadog

permissions:
  actions: read

on:
  workflow_run:
    workflows:
      - name-of-workflow-which-merges-into-main
    types:
      - completed
  pull_request:
    types:
      - opened
      - closed

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: ${{ github.event.workflow_run.head_branch == github.event.repository.default_branch }}
          github-token: ${{ secrets.GITHUB_TOKEN }}
          send-pull-request-labels: true

benjaminu avatar Dec 06 '22 08:12 benjaminu

This action shows a payload here: https://github.com/int128/datadog-actions-metrics/blob/de9c6ff18e5d55bd53d986c2c43225be7dcbb2b4/src/run.ts#L159-L165

Here is an example in the e2e test: https://github.com/int128/datadog-actions-metrics/actions/runs/4090948703/jobs/7054711331

image

int128 avatar Feb 04 '23 09:02 int128

Both metrics are sent here: https://github.com/int128/datadog-actions-metrics/blob/de9c6ff18e5d55bd53d986c2c43225be7dcbb2b4/src/pullRequest/metrics.ts#L119-L136

If this action cannot get the details of pull request, both metrics may not be sent. Can you check if there is some warning log? https://github.com/int128/datadog-actions-metrics/blob/de9c6ff18e5d55bd53d986c2c43225be7dcbb2b4/src/run.ts#L95-L105

int128 avatar Feb 04 '23 09:02 int128