datadog-actions-metrics
datadog-actions-metrics copied to clipboard
Is there a Debug Parameter?
Hi, @int128, I've set this up to send data from my GHA workflow to DataDog; however, I've encountered a number of issues.
- When trying to filter, not all my workflows show up as options in DataDog.
- Some filter options show up then disappear. So not sure what consistent param to filter by.
github.actions.pull_request_closed.since_first_authored_secondsandgithub.actions.pull_request_closed.since_first_committed_secondsdo not show up in DataDog. I only seegithub.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 }}
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?
github.actions.pull_request_closed.since_first_authored_secondsgithub.actions.pull_request_closed.since_first_committed_seconds- 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
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
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