Commit a30776e0 authored by Stan Hu's avatar Stan Hu

Merge branch '31064-ensure-diff-patch-size-limit-is-monitorable' into 'master'

Ensure diff patch size limit is monitorable

See merge request gitlab-org/gitlab!52456
parents 96492111 f70d4210
---
title: Add `patch_hard_limit_bytes_hit` metric for monitoring diff patch size limit hits
merge_request: 52456
author:
type: added
...@@ -71,6 +71,7 @@ The following metrics are available: ...@@ -71,6 +71,7 @@ The following metrics are available:
| `gitlab_transaction_event_etag_caching_resource_changed_total` | Counter | 9.4 | Counter for ETag cache miss - resource changed | `endpoint` | | `gitlab_transaction_event_etag_caching_resource_changed_total` | Counter | 9.4 | Counter for ETag cache miss - resource changed | `endpoint` |
| `gitlab_transaction_event_fork_repository_total` | Counter | 9.4 | Counter for repository forks (RepositoryForkWorker). Only incremented when source repository exists | | | `gitlab_transaction_event_fork_repository_total` | Counter | 9.4 | Counter for repository forks (RepositoryForkWorker). Only incremented when source repository exists | |
| `gitlab_transaction_event_import_repository_total` | Counter | 9.4 | Counter for repository imports (RepositoryImportWorker) | | | `gitlab_transaction_event_import_repository_total` | Counter | 9.4 | Counter for repository imports (RepositoryImportWorker) | |
| `gitlab_transaction_event_patch_hard_limit_bytes_hit_total` | Counter | 13.9 | Counter for diff patch size limit hits | |
| `gitlab_transaction_event_push_branch_total` | Counter | 9.4 | Counter for all branch pushes | | | `gitlab_transaction_event_push_branch_total` | Counter | 9.4 | Counter for all branch pushes | |
| `gitlab_transaction_event_push_commit_total` | Counter | 9.4 | Counter for commits | `branch` | | `gitlab_transaction_event_push_commit_total` | Counter | 9.4 | Counter for commits | `branch` |
| `gitlab_transaction_event_push_tag_total` | Counter | 9.4 | Counter for tag pushes | | | `gitlab_transaction_event_push_tag_total` | Counter | 9.4 | Counter for tag pushes | |
......
...@@ -244,6 +244,8 @@ module Gitlab ...@@ -244,6 +244,8 @@ module Gitlab
def prune_diff_if_eligible def prune_diff_if_eligible
if too_large? if too_large?
::Gitlab::Metrics.add_event(:patch_hard_limit_bytes_hit)
too_large! too_large!
elsif collapsed? elsif collapsed?
collapse! collapse!
......
...@@ -100,6 +100,13 @@ EOT ...@@ -100,6 +100,13 @@ EOT
expect(diff.diff).to be_empty expect(diff.diff).to be_empty
expect(diff).to be_too_large expect(diff).to be_too_large
end end
it 'logs the event' do
expect(Gitlab::Metrics).to receive(:add_event)
.with(:patch_hard_limit_bytes_hit)
diff
end
end end
context 'using a collapsable diff that is too large' do context 'using a collapsable diff that is too large' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment