Metrics API
Send metric samples to xrelia for analysis and monitoring. Metric samples can represent infrastructure, application, or custom metrics configured for a service instance.
Endpoint
Section titled “Endpoint”POST https://api.xrelia.com/v1/metricsThe request must include a valid X-API-Key header. See Authentication section for details.
Request body
Section titled “Request body”The request body must be a JSON object containing the target platform, service instance, and one or more metric samples.
{ "platformId": "PLATFORM_ID", "instanceId": "INSTANCE_ID", "samples": [ { "id": "METRIC_ID", "ts": 1785513412, "val": 58.17422866821289 }, { "id": "METRIC_ID", "ts": 1785513412, "val": 3.5928143716714303 } ]}Request fields
Section titled “Request fields”| Field | Type | Required | Description |
|---|---|---|---|
platformId |
string | Yes | ID of the Platform receiving the metric samples. Obtain this from the xrelia console. |
instanceId |
string | Yes | ID of the Service Instance receiving the metric samples. Obtain this from the xrelia console. |
samples |
array | Yes | Collection of metric samples to submit. |
samples[].id |
string | Yes | Unique ID of the metric. Metric IDs are assigned in the xrelia console when metrics are configured. |
samples[].ts |
integer | Yes | Unix timestamp indicating when the metric sample was collected. |
samples[].val |
number | Yes | Numeric value of the metric at the specified timestamp. |
Metric IDs
Section titled “Metric IDs”Every metric configured in xrelia has a unique Metric ID. For example, a service instance may have separate metrics for CPU utilization, memory usage, system load, and network activity.
Use the Metric ID assigned to the metric in the xrelia console when submitting samples.
Timestamp
Section titled “Timestamp”The ts field specifies when the measurement was collected, rather than when it was submitted to xrelia.
The value must be a Unix timestamp expressed in seconds.
For example:
1785513412The val field contains the measured value of the metric.
The value is numeric and can be an integer or floating-point number. The expected unit and interpretation depend on how the metric is configured in the xrelia console.
Response
Section titled “Response”A successful request returns:
200 OKIf the request cannot be processed, xrelia returns an appropriate HTTP error status together with a descriptive error message.
A 207 Multi-Status response is returned when a request is only partially successful—for example, when some submitted samples are accepted while others fail validation.
See API Overview for general response and error handling.
Example
Section titled “Example”curl -X POST "https://api.xrelia.com/v1/metrics" \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "platformId": "PLATFORM_ID", "instanceId": "INSTANCE_ID", "samples": [ { "id": "CPU_METRIC_ID", "ts": 1785513412, "val": 58.17 } ] }'Metric samples submitted through this endpoint become part of the service instance’s reliability data and can contribute to xrelia’s health and confidence analysis.
