Skip to main content
Version: Next

Metrics API

The Metrics component of the GraphQL API grants read-access to the metrics database. The GraphQL API is served at /api/graphql.

Queries

The Metrics component of the GraphQL API comprises the following queries:

  • getAllJobs: [IngestionJob]: Gets all ingestion jobs' ID and metadata in reverse-chronological order.
  • getNewestJob: IngestionJob?: Gets the newest ingestion job's ID and metadata. If no jobs are in the metrics database, this returns null.
  • getSources(jobId: string): [JobSource]: Gets data sources for an ingestion job by ID.
  • getMetrics(jobId: string, containerType: ContainerType, containerId: string): [Metric]: Gets metrics for a network container emitted by an ingestion job.

Types

The input and response types for the queries are as follows:

ContainerType = TOTAL // Whole network
| GeographicalRegion // Everything inside a geographical region
| SubGeographicalRegion // Everything inside a sub-geographical region
| SubstationTotal // Everything inside and downstream of a substation
| Substation // Everything inside a substation
| FeederTotal // Everything inside and downstream of a feeder line
| Feeder // Everything inside a feeder line
| LvFeeder // Everything inside a contiguous LV network
IngestionJob = {
id: string, // UUID of the ingestion job
application: string, // Name of the ingestor application used
applicationVersion: string, // Version of the ingestor application used
source: string, // Short description of the source data (e.g. "ExampleEnergy 2024 HV/LV")
startTime: string // RFC 3339 timestamp of when the ingestor application started
}
JobSource = {
name: string, // Name of the data source. This will be unique within each ingestion job.
fileHash: string?, // Optional SHA-256 hash of the data source in hexadecimal
timestamp: string? // RFC 3339 timestamp of when the data source was exported
}
Metric = {
name: string, // Name of the metric. This will be unique within each network container for each ingestion job.
value: double, // Value of the metric
}