groups:
  - id: metric.cicd.pipeline.run.duration
    type: metric
    metric_name: cicd.pipeline.run.duration
    brief: 'Duration of a pipeline run grouped by pipeline, state and result.'
    instrument: histogram
    unit: "s"
    stability: experimental
    attributes:
      - ref: cicd.pipeline.name
        requirement_level: required
      - ref: cicd.pipeline.run.state
        requirement_level: required
      - ref: cicd.pipeline.result
        requirement_level:
          conditionally_required: If and only if the pipeline run result has been set during that state.
      - ref: error.type
        requirement_level:
          conditionally_required: If and only if the pipeline run failed.
  - id: metric.cicd.pipeline.run.active
    type: metric
    metric_name: cicd.pipeline.run.active
    brief: 'The number of pipeline runs currently active in the system by state.'
    instrument: updowncounter
    unit: "{run}"
    stability: experimental
    attributes:
      - ref: cicd.pipeline.name
        requirement_level: required
      - ref: cicd.pipeline.run.state
        requirement_level: required
  - id: metric.cicd.worker.count
    type: metric
    metric_name: cicd.worker.count
    brief: 'The number of workers on the CICD system by state.'
    instrument: updowncounter
    unit: "{count}"
    stability: experimental
    attributes:
      - ref: cicd.worker.state
        requirement_level: required
  - id: metric.cicd.pipeline.run.errors
    type: metric
    metric_name: cicd.pipeline.run.errors
    brief: 'The number of errors encountered in pipeline runs (eg. compile, test failures).'
    note: |
      There might be errors in a pipeline run that are non fatal (eg. they are suppressed) or in a parallel stage multiple stages could have a fatal error.
      This means that this error count might not be the same as the count of metric `cicd.pipeline.run.duration` with run result `failure`.
    instrument: counter
    unit: "{error}"
    stability: experimental
    attributes:
      - ref: cicd.pipeline.name
        requirement_level: required
      - ref: error.type
        requirement_level: required
  - id: metric.cicd.system.errors
    type: metric
    metric_name: cicd.system.errors
    brief: 'The number of errors in a component of the CICD system (eg. controller, scheduler, agent).'
    note: 'Errors in pipeline run execution are explicitly excluded. Ie a test failure is not counted in this metric.'
    instrument: counter
    unit: "{error}"
    stability: experimental
    attributes:
      - ref: cicd.system.component
        requirement_level: required
      - ref: error.type
        requirement_level: required
