Metrics API Documentation

The Metrics API provides access to various operational and performance metrics of the Net platform. This allows for monitoring, analysis, and performance tuning.

Metrics Endpoints

GET /metrics/availability

Retrieves the availability metrics for the system.

Example Request

GET /metrics/availability?start_time=2023-10-26T00:00:00Z&end_time=2023-10-27T00:00:00Z
GET /metrics/performance

Retrieves the performance metrics for key operations.

Example Request

GET /metrics/performance?service=user_auth&period=1h
GET /metrics/usage

Retrieves the usage metrics, such as request counts and data transfer.

Example Request

GET /metrics/usage?granularity=daily

Common Parameters

Query Parameters

Most metrics endpoints accept common query parameters to filter and refine the data:

Name Type Description Required
start_time string (ISO 8601) The start of the time range for the metrics. e.g., 2023-10-26T00:00:00Z Optional
end_time string (ISO 8601) The end of the time range for the metrics. e.g., 2023-10-27T00:00:00Z Optional
service string Filter metrics for a specific service (e.g., user_auth, order_processing). Optional
period string A relative time period for metrics (e.g., 1h, 24h, 7d). If start_time and end_time are provided, this is ignored. Optional
granularity string The granularity of the data points (e.g., minute, hour, day). Optional

Metrics Data Structure

The response for metrics endpoints will typically be a JSON object containing an array of data points. Each data point includes a timestamp and the relevant metric value(s).

Availability Metrics Example

{
  "status": "success",
  "data": [
    {
      "timestamp": "2023-10-26T10:00:00Z",
      "availability_percentage": 99.95,
      "downtime_minutes": 0.02
    },
    {
      "timestamp": "2023-10-26T11:00:00Z",
      "availability_percentage": 100.00,
      "downtime_minutes": 0.00
    }
    // ... more data points
  ]
}

Performance Metrics Example

{
  "status": "success",
  "data": [
    {
      "timestamp": "2023-10-26T10:00:00Z",
      "service": "user_auth",
      "average_latency_ms": 55,
      "p95_latency_ms": 120,
      "error_rate": 0.01
    }
    // ... more data points
  ]
}

Usage Metrics Example

{
  "status": "success",
  "data": [
    {
      "timestamp": "2023-10-26T10:00:00Z",
      "total_requests": 15000,
      "unique_users": 5000,
      "data_transfer_gb": 2.5
    }
    // ... more data points
  ]
}