Skip to content

stefafafan/post-mackerel-metrics

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

post-mackerel-metrics status

post-mackerel-metrics

post-mackerel-metrics is a simple GitHub Action for posting Service Metrics to Mackerel.

This action is inspired by the yutailang0119/action-mackerel-api action, but focuses only on posting service metrics as defined in https://mackerel.io/api-docs/entry/service-metrics#post.

Inputs

  • api-key (required): API Key value of Mackerel. Should be stored in GitHub Secrets.
  • service-name (required): The Mackerel service name you want to post metrics to.
  • metric-name: The Mackerel metric name you want to post. Accepted values are [a-zA-Z0-9._-]+ .
  • metric-value: The Mackerel metric value you want to post. Should be a numeric value.
  • metrics: A multiline input, used to specify multiple metrics at once. Formatted as name value timestamp. timestamp can be omitted, in which case the current time will be used.

Either the metric-name and metric-value pair or metrics is required. See the example usages below for details.

Outputs

  • time: The time used to post the metric (epoch seconds).

Example Usage

Posting just one service metric:

uses: stefafafan/post-mackerel-metrics@v1
with:
  api-key: ${{ secrets.MACKEREL_APIKEY }}
  service-name: ${{ secrets.MACKEREL_SERVICENAME }}
  metric-name: 'my-favorite-metric.count' # [a-zA-Z0-9._-]+
  metric-value: 12345.678 # Should be a numeric value

Posting multiple service metrics at once:

uses: stefafafan/post-mackerel-metrics@v1
with:
  api-key: ${{ secrets.MACKEREL_APIKEY }}
  service-name: ${{ secrets.MACKEREL_SERVICENAME }}
  metrics: |
    my-favorite-metric.count 12345.678 1670747999
    my-favorite-metric.count2 7777.777 1670747999

When using metrics you can omit the timestamp and let the action use current time as the time.

uses: stefafafan/post-mackerel-metrics@v1
with:
  api-key: ${{ secrets.MACKEREL_APIKEY }}
  service-name: ${{ secrets.MACKEREL_SERVICENAME }}
  metrics: |
    my-favorite-metric.count 12345.678
    my-favorite-metric.count2 7777.777

Checkout the following example workflows:

Contributing

See the Contribution Guide.

Author

stefafafan (GitHub, Twitter)