Metrics API

Searching Metrics

GET /api/v1/metric/search?

Curl examples:

curl -X GET "https://YOUR-API-KEY-HERE@api.hostedgraphite.com/api/v1/metric/search?pattern=foo.bar.*"

Search for metrics that match the pattern foo.bar.*

curl -X GET "https://YOUR-API-KEY-HERE@api.hostedgraphite.com/api/v1/metric/search?pattern=foo.bar.*&not_updated_in=5h"

Search for metrics that match the pattern foo.bar.* that only received datapoints in the last 5 hours.

Available Parameters:

  • pattern [REQUIRED]
    Format: foo.bar.*
    Metric pattern to search for.
  • not_updated_in
    Format: not_updated_in=1h | not_updated_in=5h
    To limit search results for metrics that only received datapoints in the last x hours.
  • with_times
    Format: with_times=true
    To return the first (“created_at”) and last (“last_updated”) seen timestamp for that metric.

Response format:

HTTP/1.1 200
Content-Type: application/json

{
       "metrics_matched": 2,
       "total_metrics": 12345,
       "result_size_limit": 100000,
       "results": ["foo.bar.1", "foo.bar.2"],
       "result_size_limited": true | false
}

Response format with ‘&with_times=true’:

HTTP/1.1 200
Content-Type: application/json

{
  "metrics_matched": 2,
  "total_metrics": 12345,
  "result_size_limit": 100000,
  "results": ["foo.bar.1", "foo.bar.2"],
  "result_size_limited": true | false,
  "times": {
    "foo.bar.1": {
      "created_at": 1234567890,
      "last_updated": 1234567890
    },
    "foo.bar.2": {
      "created_at": 1234567890,
      "last_updated": 1234567890
    }
  }
}

Response Parameters:

  • metrics_matches
    The number of metrics matched by this pattern.
  • total_metrics
    The total number of metrics on the account.
  • result_size_limit
    The number of metrics that can be searched in a single request.
  • results
    List of metrics that match the specified pattern.
  • result_size_limited
    Indicates if the result was limited because of it exceeding the result_size_limit.
  • times
    An array of dictionaries with the filtered metrics as keys containing the “created_at” and “last_updated” timestamps of the metric.

Status Codes:

  • 200 - Success
  • 400 - Invalid format.

Deleting Metrics

POST /api/v1/metric/delete

Curl example:

curl -d "pattern=foo.bar.*" "https://YOUR-API-KEY-HERE@api.hostedgraphite.com/api/v1/metric/delete/"

Delete all metrics that match the pattern foo.bar.*.

Status Codes:

  • 200 - Success
  • 400 - Invalid request.