Retrieve metrics

Retrieves metrics related to your Algolia infrastructure, aggregated over a selected time window.

Access to this API is available as part of the Premium or Elevate plans. You must authenticate requests with the x-algolia-application-id and x-algolia-api-key headers (using the Monitoring API key).

Usage

1
2
3
4
5
6
7
8
9
10
11
12
import algoliasearch.api.MonitoringClient
import algoliasearch.config.*

val client = MonitoringClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY")

val response = Await.result(
  client.getMetrics(
    metric = Metric.withName("avg_build_time"),
    period = Period.withName("minute")
  ),
  Duration(100, "sec")
)
Did you find this page helpful?