openapi: 3.1.0
info:
  title: DTZ Observability
  version: 1.0.8
  description: a generated client for the DTZ Observability API
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  contact:
    name: Jens Walter
    email: jens@apimeister.com
servers:
- url: https://observability.dtz.rocks/api/{version}
  variables:
    version:
      default: "2021-12-21"
      enum:
        - "2021-12-21"
paths:
  /enable:
    post:
      summary: enable the observability service
      operationId: enable
      responses:
        "200":
          description: service enabled
  /disable:
    post:
      summary: disable the observability service
      operationId: disable
      responses:
        "200":
          description: service disabled
  /log:
    get:
      summary: get logs
      operationId: getLogs
      responses:
        "200":
          description: status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DtzLogs'
    post:
      summary: query logs
      operationId: queryLogs
      requestBody: 
        description: log query
        content: 
          application/json:
            schema:
              type: object
              properties:
                search:
                  type: string
      responses:
        "200":
          description: status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DtzLogs'
  /log/activity:
    get:
      summary: get log activity over time
      operationId: getLogActivity
      responses:
        "200":
          description: success
          content: 
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    ts:
                      type: string
                    count:
                      type: integer
    post:
      summary: get log activity over time filtered
      operationId: queryLogActivity
      requestBody: 
        description: log query
        content:
          application/json:
            schema:
              type: object
              properties:
                search:
                  type: string
      responses:
        "200":
          description: context informatio
          content: 
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    ts:
                      type: string
                    count:
                      type: integer
  /log/attribute:
    get:
      summary: get log attributes
      operationId: getLogAttributes
      responses:
        "200":
          description: attribute activity
          content: 
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                    count:
                      type: integer
  /log/push:
    post:
      summary: push log data
      operationId: postLog
      requestBody: 
        description: log data
        content:
          application/json:
            schema:
              type: array
              items:
                type: object
                properties:
                  tsNanos:
                    type: string
                  spanId:
                    type: string
                  traceId:
                    type: string
                  parentId:
                    type: string
                  childId:
                    type: string
                  payload:
                    type: string
                  attributes:
                    type: object
                  tags:
                    type: array
                    items:
                      type: string
                  links:
                    type: array
                    items:
                      type: object
                      properties:
                        alias:
                          type: string
                        url:
                          type: string
                  attachments:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        name:
                          type: string
                        contentType:
                          type: string
      responses:
        "200":
          description: success
  /metric:
    post:
      summary: push metric data
      operationId: postMetric
      requestBody: 
        description: metric data
        content: 
          application/json:
            schema:
              $ref: '#/components/schemas/DtzMetrics'
      responses:
        "200":
          description: success
  /prometheus:
    post:
      summary: Push endpoint for prometheus data.
      operationId: postPrometheus
      requestBody:
        description: prometheus format
        content: 
          text/plain:
            schema:
              type: string
      responses:
        "200":
          description: success
  /prometheus/api/v1/label/{label}/values:
    get:
      summary: list all available values for one labels
      operationId: listLabelValues
      parameters:
        - in: path
          name: label
          schema:
            type: string
          required: true
          description: name of the label
      responses:
        "200":
          description: prometheus format
          content: 
            text/plain:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  data:
                    type: array    
                    items:
                      type: string
  /prometheus/api/v1/labels:
    get:
      summary: list all available labels
      operationId: listLabels
      responses:
        "200":
          description: prometheus format
          content: 
            text/plain:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  data:
                    type: array    
                    items:
                      type: string
  /prometheus/api/v1/metadata:
    get:
      summary: query metric metadata
      operationId: getMetricMetadata
      responses:
        "200":
          description: prometheus format
          content: 
            text/plain:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  data:
                    type: object
  /prometheus/api/v1/status/buildinfo:
    get:
      summary: retreive build information about the dtz backend
      operationId: getBuildInfo
      responses:
        "200":
          description: prometheus format
          content: 
            text/plain:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  data:
                    type: object
                    properties:
                      version:
                        type: string
                      revision:
                        type: string
                      branch:
                        type: string
                      buildUser:
                        type: string
  /stats:
    get:
      summary: get statistics
      operationId: getStats
      responses:
        "200":
          description: statistics
          content: 
            application/json:
              schema:
                type: object
                properties:
                  logCount:
                    type: integer
                  logSize:
                    type: integer
                  metricCount:
                    type: integer
                  metricSize:
                    type: integer
components:
  schemas:
    DtzLogs:
      type: array
      items:
        type: object
        properties:
          ts:
            type: string
          traceId:
            type: string
          spanId:
            type: string
          payload:
            type: string
          attributes:
            type: object
    DtzMetrics:
      type: array
      items:
        $ref: '#/components/schemas/DtzMetric'
    DtzMetric:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        attributes:
          type: object
          additionalProperties:
            type: string
        intervalStartTsNanos:
          type: integer
          format: int64
        intervalEndTsNanos:
          type: integer
          format: int64
        value:
          type: number
        unit:
          type: string
        kind:
          type: string
          enum:
            - Gauge
            - Sum
            - Counter
        traceId:
          type: string
        spanId:
          type: string
      required:
        - name
        - value
        - intervalEndTsNanos
        - unit
        - kind
  securitySchemes:
    dtz_auth:
      type: apiKey
      in: header
      name: X-API-KEY
    dtz_auth2:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: https://identity.dtz.rocks/api/2021-02-21/token/auth
          scopes:
            dummy:dummy: dummy
security:
  - dtz_auth: []
  - dtz_auth2: []