-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add action for sending custom metrics
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
## Description | ||
|
||
Sends custom metrics to a specified metrics endpoint. This action makes a POST request using a bearer token for authorization. | ||
|
||
## Inputs | ||
|
||
| parameter | description | required | default | | ||
|---|---|---|--- | ||
| METRICS_ENDPOINT_URL| The metrics endpoint URL where the data will be sent. | `true` | | | ||
| BEARER_TOKEN | The authorization token for the endpoint. | `true` | | | ||
| data | The metric data to send, formatted as required by the endpoint. | `true` | | | ||
|
||
### Example Usage | ||
|
||
Replace `METRICS_ENDPOINT_URL` and `BEARER_TOKEN` with your actual metrics endpoint URL and bearer token, which should be stored as secrets in your GitHub repository. | ||
|
||
``` | ||
jobs: | ||
send-metrics: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Send Custom Metrics | ||
uses: your-username/send-custom-metrics-action@main | ||
with: | ||
METRICS_ENDPOINT_URL: ${{ secrets.METRICS_ENDPOINT_URL }} | ||
BEARER_TOKEN: ${{ secrets.BEARER_TOKEN }} | ||
data: 'your_metric{label="value"} 123' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Send Custom Metrics | ||
description: Sends custom metrics to an endpoint | ||
|
||
inputs: | ||
METRICS_ENDPOINT_URL: | ||
description: The metrics endpoint URL | ||
required: true | ||
BEARER_TOKEN: | ||
description: The authorization token for the endpoint | ||
required: true | ||
data: | ||
description: The metric data to send | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Send Metric | ||
shell: bash | ||
run: | | ||
curl -H "Authorization: Bearer ${{ inputs.BEARER_TOKEN }}" \ | ||
-X POST "${{ inputs.METRICS_ENDPOINT_URL }}" \ | ||
-d '${{ inputs.data }}' |