swagger: "2.0"

info:
  version: "1.0.0"
  title: "Annotator DB Backend Health API"
  description: "An API for checking the health of the Annotator DB Backend Service."
  contact:
    name: "Infra"
    email: "infrateam@zoox.com"
    url: "https://git.zooxlabs.com/zooxco/driving/tree/master/infra/annotator_db"

basePath: "/"

produces:
  - "application/json"

paths:
  /metrics:
    get:
      summary: "Returns current metrics of the service."
      operationId: "getMetrics"
      responses:
        "200":
          schema:
            $ref: "#/definitions/Metrics"
        default:
          description: "Unexpected error."
          schema:
            $ref: "#/definitions/Error"

definitions:
  Error:
    required:
    - "code"
    - "message"
    properties:
      code:
        type: "integer"
        format: "int32"
      message:
        type: "string"

  Metrics:
    type: "object"
    additionalProperties:
      $ref: "#/definitions/Metric"
    example:
      qnaGet:
        interval_size_ms: 60000
        latency_mean_ms: 30
        latency_p50_ms: 35
        latency_p95_ms: 100
        number_of_requests: 10000
        number_of_uncaught_exceptions: 0
        number_of_http_400s: 70
        number_of_http_500s: 20
      qnaCmpXchg:
        interval_size_ms: 60000
        latency_mean_ms: 50
        latency_p50_ms: 55
        latency_p95_ms: 150
        number_of_requests: 2000
        number_of_uncaught_exceptions: 0
        number_of_http_400s: 200
        number_of_http_500s: 10

  Metric:
    type: "object"
    properties:
      interval_size_ms:
        type: "integer"
        description: "The time interval over which these statistics were computed in milliseconds."
      latency_mean_ms:
        type: "integer"
        description: "Mean latency in milliseconds."
      latency_p50_ms:
        type: "integer"
        description: "50th percentile latency in milliseconds."
      latency_p95_ms:
        type: "integer"
        description: "95th percentile latency in milliseconds."
      number_of_requests:
        type: "integer"
        description: "The number of requests to this endpoint during this interval."
      number_of_uncaught_exceptions:
        type: "integer"
        description: "The number of uncaught exceptions in this endpoint during this interval."
      number_of_http_400s:
        type: "integer"
        description: "The number of HTTP 400s on this endpoint during this interval."
      number_of_http_500s:
        type: "integer"
        description: "The number of HTTP 500s on this endpoint during this interval."
