Skip to content

Commit 5ae1d1e

Browse files
authored
Merge pull request #26 from henrycpainter/main
Adds option to override the Datadog API url
2 parents e072ede + 429144f commit 5ae1d1e

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ An array of named branches to enable tagging of workflow and job metrics with `b
8888

8989
An array of custom tags to attach to any metrics sent to datadog. Example values: `'["tag:value"]'`, `'["tag1:value1", "tag2:value2"]'`
9090

91+
### api-url (Optional)
92+
93+
The datadog api url. Defaults to `https://api.datadoghq.com`. Can be used to override for datadog regional endpoints or a proxy.
94+
9195
## Environment Variables
9296

9397
The following two secrets are required to be added to your GitHub settings for access to Datadog and GitHub during the workflow run.

action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ inputs:
2020
description: 'A list of tags to attach to the metrics. In the format of "[TAG1:VALUE1,TAG2:VALUE2,..]".'
2121
required: false
2222
default: '[]'
23+
api-url:
24+
description: 'The datadog regional api url. Defaults to https://api.datadoghq.com'
25+
required: false
26+
default: 'https://api.datadoghq.com'
2327

2428
runs:
2529
using: "composite"
@@ -41,4 +45,4 @@ runs:
4145
- id: metric
4246
shell: bash
4347
run: |
44-
ruby ${{ github.action_path }}/report_github_metrics.rb ${{github.repository}} ${{github.run_id}} ${{ inputs.datadog-metric-prefix }} '${{ inputs.teams }}' '${{ inputs.tagged-branches }}' '${{ inputs.custom-tags }}'
48+
ruby ${{ github.action_path }}/report_github_metrics.rb ${{github.repository}} ${{github.run_id}} ${{ inputs.datadog-metric-prefix }} '${{ inputs.teams }}' '${{ inputs.tagged-branches }}' '${{ inputs.custom-tags }}' ${{ inputs.api-url }}

report_github_metrics.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def parse_array_input(arg)
109109
teams = parse_array_input(ARGV[3])
110110
metric_prefix += "." unless metric_prefix.end_with?(".")
111111
datadog_client = Dogapi::Client.new(ENV['DATADOG_API_KEY'])
112+
datadog_client.datadog_host = ARGV[6].strip
112113
github_client = Octokit::Client.new(:access_token => ENV['OCTOKIT_TOKEN'])
113114

114115
metrics = nil

0 commit comments

Comments
 (0)