stefafafan/post-mackerel-metrics

Support posting multiple service metrics at once

Closed this issue · 4 comments

API supports an array to POST multiple metrics at once: https://mackerel.io/api-docs/entry/service-metrics#post .

Maybe we should add something like this? 🤔 Hmm...

uses: stefafafan/post-mackerel-metrics@v1
with:
  api-key: ${{ secrets.MACKEREL_APIKEY }}
  service-name: ${{ secrets.MACKEREL_SERVICENAME }}
  metrics: |
    [
      {
        "name": "my-favorite-metric.count",
        "value": 123
      },
      {
        "name": "my-favorite-metric2.count",
        "value": 111
      },
      {
        "name": "my-favorite-metric3.count",
        "value": 222
      }
    ]

name,value space separated?

uses: stefafafan/post-mackerel-metrics@v1
with:
  api-key: ${{ secrets.MACKEREL_APIKEY }}
  service-name: ${{ secrets.MACKEREL_SERVICENAME }}
  metrics: "my-favorite-metric.count,123 my-favorite-metric2.count,111 my-favorite-metric3.count,222"

name:value comma separated?

uses: stefafafan/post-mackerel-metrics@v1
with:
  api-key: ${{ secrets.MACKEREL_APIKEY }}
  service-name: ${{ secrets.MACKEREL_SERVICENAME }}
  metrics: "my-favorite-metric.count:123,my-favorite-metric2.count:111,my-favorite-metric3.count:222"

name value newline separated?

uses: stefafafan/post-mackerel-metrics@v1
with:
  api-key: ${{ secrets.MACKEREL_APIKEY }}
  service-name: ${{ secrets.MACKEREL_SERVICENAME }}
  metrics: |
    my-favorite-metric.count 123
    my-favorite-metric2.count 111
    my-favorite-metric3.count 222

Supported and updated the examples in README: https://github.com/stefafafan/post-mackerel-metrics#example-usage

Format is inspired by the official format for posting metrics
https://mackerel.io/docs/entry/advanced/custom-metrics#post-metric