Skip to content

Commit

Permalink
[vcs] add vcs.change.time_to_merge metric
Browse files Browse the repository at this point in the history
  • Loading branch information
adrielp committed Dec 14, 2024
1 parent 294d2db commit 1e20f5a
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 8 deletions.
22 changes: 22 additions & 0 deletions .chloggen/vcs-ttm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Use this changelog template to create an entry for release notes.
#
# If your change doesn't affect end users you should instead start
# your pull request title with [chore] or use the "Skip Changelog" label.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
component: vcs

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add `vcs.change.time_to_merge` metric.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
# The values here must be integers.
issues: []

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
8 changes: 4 additions & 4 deletions docs/cicd/cicd-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ This metric is [recommended][MetricRecommended].

| Name | Instrument Type | Unit (UCUM) | Description | Stability |
| -------- | --------------- | ----------- | -------------- | --------- |
| `vcs.change.time_to_approval` | Gauge | `s` | The amount of time since its creation it took a change (pull request/merge request/changelist) to get the first approval | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `vcs.change.time_to_approval` | Gauge | `s` | The amount of time since its creation it took a change (pull request/merge request/changelist) to get the first approval. | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
Expand Down Expand Up @@ -165,7 +165,7 @@ This metric is [recommended][MetricRecommended].

| Name | Instrument Type | Unit (UCUM) | Description | Stability |
| -------- | --------------- | ----------- | -------------- | --------- |
| `vcs.repository.count` | UpDownCounter | `{repository}` | The number of repositories in an organization | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `vcs.repository.count` | UpDownCounter | `{repository}` | The number of repositories in an organization. | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
Expand All @@ -185,7 +185,7 @@ This metric is [recommended][MetricRecommended].

| Name | Instrument Type | Unit (UCUM) | Description | Stability |
| -------- | --------------- | ----------- | -------------- | --------- |
| `vcs.ref.count` | UpDownCounter | `{ref}` | The number of refs of type branch or tag in a repository | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `vcs.ref.count` | UpDownCounter | `{ref}` | The number of refs of type branch or tag in a repository. | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
Expand Down Expand Up @@ -227,7 +227,7 @@ This metric is [recommended][MetricRecommended].

| Name | Instrument Type | Unit (UCUM) | Description | Stability |
| -------- | --------------- | ----------- | -------------- | --------- |
| `vcs.ref.lines_delta` | Gauge | `{line}` | The number of lines added/removed in a ref (branch) relative to the ref from the `vcs.ref.base.name` attribute [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `vcs.ref.lines_delta` | Gauge | `{line}` | The number of lines added/removed in a ref (branch) relative to the ref from the `vcs.ref.base.name` attribute. [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

**[1]:** 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).
Expand Down
30 changes: 26 additions & 4 deletions model/vcs/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ groups:
- 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'
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: experimental
Expand All @@ -43,18 +43,40 @@ groups:
requirement_level: recommended
- ref: vcs.ref.head.name
requirement_level: required
- 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: experimental
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.base.name
requirement_level: recommended
- ref: vcs.ref.base.revision
requirement_level: recommended
- ref: vcs.ref.head.name
requirement_level: recommended
- ref: vcs.ref.head.revision
requirement_level: recommended
- id: metric.vcs.repository.count
type: metric
metric_name: vcs.repository.count
brief: 'The number of repositories in an organization'
brief: 'The number of repositories in an organization.'
instrument: updowncounter
unit: "{repository}"
stability: experimental
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'
brief: 'The number of refs of type branch or tag in a repository.'
instrument: updowncounter
unit: "{ref}"
stability: experimental
Expand All @@ -68,7 +90,7 @@ groups:
- 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'
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).
Expand Down

0 comments on commit 1e20f5a

Please sign in to comment.