groups:
  - id: metric.vcs.change.count
    type: metric
    metric_name: vcs.change.count
    brief: 'The number of changes (pull requests/merge requests/changelists) in a repository, categorized by their state (e.g. open or merged)'
    instrument: updowncounter
    unit: "{change}"
    stability: development
    attributes:
      - ref: vcs.change.state
        requirement_level: required
      - ref: vcs.repository.url.full
        requirement_level: required
      - ref: vcs.repository.name
        requirement_level: recommended
  - id: metric.vcs.change.duration
    type: metric
    metric_name: vcs.change.duration
    brief: 'The time duration a change (pull request/merge request/changelist) has been in a given state.'
    instrument: gauge
    unit: "s"
    stability: development
    attributes:
      - ref: vcs.repository.url.full
        requirement_level: required
      - ref: vcs.repository.name
        requirement_level: recommended
      - ref: vcs.ref.head.name
        requirement_level: required
      - ref: vcs.change.state
        requirement_level: required
  - id: metric.vcs.change.time_to_approval
    type: metric
    metric_name: vcs.change.time_to_approval
    brief: 'The amount of time since its creation it took a change (pull request/merge request/changelist) to get the first approval.'
    instrument: gauge
    unit: "s"
    stability: development
    attributes:
      - ref: vcs.repository.url.full
        requirement_level: required
      - ref: vcs.repository.name
        requirement_level: recommended
      - ref: vcs.ref.head.name
        requirement_level: required
      - ref: vcs.ref.head.revision
        requirement_level: opt_in
      - ref: vcs.ref.base.name
        requirement_level: recommended
      - ref: vcs.ref.base.revision
        requirement_level: opt_in
  - id: metric.vcs.change.time_to_merge
    type: metric
    metric_name: vcs.change.time_to_merge
    brief: 'The amount of time since its creation it took a change (pull request/merge request/changelist) to get merged into the target(base) ref.'
    instrument: gauge
    unit: "s"
    stability: development
    attributes:
      - ref: vcs.repository.url.full
        requirement_level: required
      - ref: vcs.repository.name
        requirement_level: recommended
      - ref: vcs.ref.head.name
        requirement_level: required
      - ref: vcs.ref.head.revision
        requirement_level: opt_in
      - ref: vcs.ref.base.name
        requirement_level: recommended
      - ref: vcs.ref.base.revision
        requirement_level: opt_in
  - id: metric.vcs.repository.count
    type: metric
    metric_name: vcs.repository.count
    brief: 'The number of repositories in an organization.'
    instrument: updowncounter
    unit: "{repository}"
    stability: development
    attributes: []
  - id: metric.vcs.ref.count
    type: metric
    metric_name: vcs.ref.count
    brief: 'The number of refs of type branch or tag in a repository.'
    instrument: updowncounter
    unit: "{ref}"
    stability: development
    attributes:
      - ref: vcs.repository.url.full
        requirement_level: required
      - ref: vcs.repository.name
        requirement_level: recommended
      - ref: vcs.ref.type
        requirement_level: required
  - id: metric.vcs.ref.lines_delta
    type: metric
    metric_name: vcs.ref.lines_delta
    brief: 'The number of lines added/removed in a ref (branch) relative to the ref from the `vcs.ref.base.name` attribute.'
    note: |
      This metric should be reported for each `vcs.line_change.type` value. For example if a ref added 3 lines and removed 2 lines,
      instrumentation SHOULD report two measurements: 3 and 2 (both positive numbers).
      If number of lines added/removed should be calculated from the start of time, then `vcs.ref.base.name` SHOULD be set to an empty string.
    instrument: gauge
    unit: "{line}"
    stability: development
    attributes:
      - ref: vcs.change.id
        requirement_level:
          conditionally_required: if a change is associate with the ref.
      - ref: vcs.repository.url.full
        requirement_level: required
      - ref: vcs.repository.name
        requirement_level: recommended
      - ref: vcs.ref.head.name
        requirement_level: required
      - ref: vcs.ref.head.type
        requirement_level: required
      - ref: vcs.ref.base.name
        requirement_level: required
      - ref: vcs.ref.base.type
        requirement_level: required
      - ref: vcs.line_change.type
        requirement_level: required
  - id: metric.vcs.ref.revisions_delta
    type: metric
    metric_name: vcs.ref.revisions_delta
    brief: 'The number of revisions (commits) a ref (branch) is ahead/behind the branch from the `vcs.ref.base.name` attribute'
    note: |
      This metric should be reported for each `vcs.revision_delta.direction` value. For example if branch `a` is 3 commits behind and 2 commits ahead of `trunk`,
      instrumentation SHOULD report two measurements: 3 and 2 (both positive numbers) and `vcs.ref.base.name` is set to `trunk`.
    instrument: gauge
    unit: "{revision}"
    stability: development
    attributes:
      - ref: vcs.change.id
        requirement_level:
          conditionally_required: if a change is associate with the ref.
      - ref: vcs.repository.url.full
        requirement_level: required
      - ref: vcs.repository.name
        requirement_level: recommended
      - ref: vcs.ref.head.name
        requirement_level: required
      - ref: vcs.ref.head.type
        requirement_level: required
      - ref: vcs.ref.base.name
        requirement_level: required
      - ref: vcs.ref.base.type
        requirement_level: required
      - ref: vcs.revision_delta.direction
        requirement_level: required
  - id: metric.vcs.ref.time
    type: metric
    metric_name: vcs.ref.time
    brief: 'Time a ref (branch) created from the default branch (trunk) has existed. The `ref.type` attribute will always be `branch`'
    instrument: gauge
    unit: "s"
    stability: development
    attributes:
      - ref: vcs.repository.url.full
        requirement_level: required
      - ref: vcs.repository.name
        requirement_level: recommended
      - ref: vcs.ref.head.name
        requirement_level: required
      - ref: vcs.ref.head.type
        requirement_level: required
  - id: metric.vcs.contributor.count
    type: metric
    metric_name: vcs.contributor.count
    brief: 'The number of unique contributors to a repository'
    instrument: gauge
    unit: "{contributor}"
    stability: development
    attributes:
      - ref: vcs.repository.url.full
        requirement_level: required
      - ref: vcs.repository.name
        requirement_level: recommended
