Skip to content
代码片段 群组 项目
提交 f70d4210 编辑于 作者: David Kim's avatar David Kim 提交者: Stan Hu
浏览文件

Ensure diff patch size limit is monitorable

上级 c94bbc2b
No related branches found
No related tags found
无相关合并请求
---
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 @@ def init_from_gitaly(gitaly_diff) ...@@ -244,6 +244,8 @@ def init_from_gitaly(gitaly_diff)
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 @@ ...@@ -100,6 +100,13 @@
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
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册