Help us learn about your current experience with the documentation. Take the survey.

GitLab Prometheus 指标

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab Self-Managed

要启用 GitLab Prometheus 指标:

  1. 以具有管理员权限的用户登录 GitLab。
  2. 在左侧边栏底部选择 管理
  3. 选择 设置 > 度量和性能分析
  4. 找到 度量指标 - Prometheus 部分,然后选择 启用 GitLab Prometheus 指标端点
  5. 重启 GitLab 以使更改生效。

对于自编译安装,您必须自行配置。

收集指标

GitLab 监控其自身的内部服务指标,并在 /-/metrics 端点提供这些指标。与其他 Prometheus 导出器不同,要访问这些指标,客户端 IP 地址必须被显式允许

这些指标针对 Linux 软件包 和 Helm 图表安装启用并收集。对于自编译安装,这些指标必须手动启用并由 Prometheus 服务器收集。

有关启用和查看 Sidekiq 节点的指标,请参阅 Sidekiq 指标

可用指标

以下指标可供使用:

指标 类型 描述 标签
gitlab_cache_misses_total 计数器 10.2 缓存读取未命中 controller, action, store, endpoint_id
gitlab_cache_operation_duration_seconds 直方图 10.2 缓存访问时间 operation, store, endpoint_id
gitlab_cache_operations_total 计数器 12.2 控制器或操作的缓存操作总数 controller, action, operation, store, endpoint_id
gitlab_cache_read_multikey_count 直方图 15.7 多键缓存读取操作中的键数量 controller, action, store, endpoint_id
gitlab_ci_job_token_inbound_access 计数器 17.2 通过 CI 作业令牌的入站访问次数
gitlab_ci_job_token_authorization_failures 计数器 17.11 通过 CI 作业令牌的身份验证失败尝试次数 same_root_ancestor
gitlab_ci_pipeline_builder_scoped_variables_duration 直方图 14.5 为 CI/CD 作业创建作用域变量所需的时间(秒)
gitlab_ci_pipeline_creation_duration_seconds 直方图 13.0 创建 CI/CD 流水线所需的时间(秒) gitlab
gitlab_ci_pipeline_size_builds 直方图 13.1 按流水线来源分组的流水线内构建总数 source
gitlab_ci_runner_authentication_success_total 计数器 15.2 运行者身份验证成功总次数 type
gitlab_ci_runner_authentication_failure_total 计数器 15.2 运行者身份验证失败总次数
gitlab_ghost_user_migration_lag_seconds 仪表盘 15.6 幽灵用户迁移的最旧计划记录等待时间(秒)
gitlab_ghost_user_migration_scheduled_records_total 仪表盘 15.6 计划的幽灵用户迁移总数
gitlab_ci_active_jobs 直方图 14.2 流水线创建时的活跃作业数
gitlab_database_transaction_seconds 直方图 12.1 数据库事务耗时(秒)
gitlab_method_call_duration_seconds 直方图 10.2 方法调用实际耗时 controller, action, module, method

| gitlab_omniauth_login_total | 计数器 | 16.1 | 总OmniAuth登录尝试次数 | omniauth_provider, status | | gitlab_page_out_of_bounds | 计数器 | 12.8 | 当PageLimiter分页限制被触发时的计数器 | controller, action, bot | | gitlab_rails_boot_time_seconds | 仪表盘 | 14.8 | Rails主进程完成启动所经过的时间 | | | gitlab_rails_queue_duration_seconds | 直方图 | 9.4 | 测量GitLab Workhorse将请求转发到Rails之间的延迟 | | | gitlab_sql_duration_seconds | 直方图 | 10.2 | SQL执行时间,不包括SCHEMA操作和BEGIN/COMMIT | | | gitlab_sql_<role>_duration_seconds | 直方图 | 13.10 | SQL执行时间,不包括SCHEMA操作和BEGIN/COMMIT,按数据库角色(主/副本)分组 | | | gitlab_ruby_threads_max_expected_threads | 仪表盘 | 13.3 | 预期运行并执行应用程序工作的最大线程数 | | | gitlab_ruby_threads_running_threads | 仪表盘 | 13.3 | 按名称统计的运行中的Ruby线程数 | | | gitlab_transaction_cache_<key>_count_total | 计数器 | 10.2 | 每个键的总Rails缓存调用计数器 | | | gitlab_transaction_cache_<key>_duration_total | 计数器 | 10.2 | 每个键在Rails缓存调用中花费的总时间(秒)计数器 | | | gitlab_transaction_cache_count_total | 计数器 | 10.2 | 总Rails缓存调用计数器(聚合) | | | gitlab_transaction_cache_duration_total | 计数器 | 10.2 | 总Rails缓存调用耗时(秒)(聚合)计数器 | | | gitlab_transaction_cache_read_hit_count_total | 计数器 | 10.2 | Rails缓存调用命中计数器 | controller, action, store, endpoint_id | | gitlab_transaction_cache_read_miss_count_total | 计数器 | 10.2 | Rails缓存调用未命中计数器 | controller, action, store, endpoint_id | | gitlab_transaction_duration_seconds | 直方图 | 10.2 | 成功请求的持续时间(秒)(gitlab_transaction_*指标) | controller, action, endpoint_id | | gitlab_transaction_event_build_found_total | 计数器 | 9.4 | API /jobs/request找到构建的计数器 | | | gitlab_transaction_event_build_invalid_total | 计数器 | 9.4 | API /jobs/request因并发冲突导致构建无效的计数器 | | | gitlab_transaction_event_build_not_found_cached_total | 计数器 | 9.4 | API /jobs/request构建未找到的缓存响应计数器 | |

| gitlab_transaction_event_build_not_found_total | Counter | 9.4 | API /jobs/request 未找到构建的计数器 | | | gitlab_transaction_event_change_default_branch_total | Counter | 9.4 | 任何仓库更改默认分支时的计数器 | | | gitlab_transaction_event_create_repository_total | Counter | 9.4 | 创建任何仓库时的计数器 | | | gitlab_transaction_event_etag_caching_cache_hit_total | Counter | 9.4 | ETag 缓存命中计数器. | endpoint | | gitlab_transaction_event_etag_caching_header_missing_total | Counter | 9.4 | ETag 缓存未命中 - 头部缺失计数器 | endpoint | | gitlab_transaction_event_etag_caching_key_not_found_total | Counter | 9.4 | ETag 缓存未命中 - 键未找到计数器 | endpoint | | gitlab_transaction_event_etag_caching_middleware_used_total | Counter | 9.4 | 访问 ETag 中间件计数器 | endpoint | | gitlab_transaction_event_etag_caching_resource_changed_total | Counter | 9.4 | ETag 缓存未命中 - 资源已变更计数器 | endpoint | | gitlab_transaction_event_fork_repository_total | Counter | 9.4 | 仓库分叉计数器(RepositoryForkWorker)。仅当源仓库存在时递增 | | | gitlab_transaction_event_import_repository_total | Counter | 9.4 | 仓库导入计数器(RepositoryImportWorker) | | | gitlab_transaction_event_patch_hard_limit_bytes_hit_total | Counter | 13.9 | diff 补丁大小限制命中计数器 | | | gitlab_transaction_event_push_branch_total | Counter | 9.4 | 所有分支推送计数器 | | | gitlab_transaction_event_rails_exception_total | Counter | 9.4 | Rails 异常数量计数器 | | | gitlab_transaction_event_receive_email_total | Counter | 9.4 | 收到邮件计数器 | handler | | gitlab_transaction_event_remove_branch_total | Counter | 9.4 | 任何仓库删除分支时的计数器 | | | gitlab_transaction_event_remove_repository_total | Counter | 9.4 | 删除仓库时的计数器 | | | gitlab_transaction_event_remove_tag_total | Counter | 9.4 | 任何仓库删除标签时的计数器 | | | gitlab_transaction_event_sidekiq_exception_total | Counter | 9.4 | Sidekiq 异常计数器 | |

| gitlab_transaction_event_stuck_import_jobs_total | Counter | 9.4 | 卡住的导入作业数量 | projects_without_jid_count, projects_with_jid_count | | gitlab_transaction_event_update_build_total | Counter | 9.4 | 用于API /jobs/request/:id更新构建的计数器 | | | gitlab_transaction_new_redis_connections_total | Counter | 9.4 | 新Redis连接计数器 | | | gitlab_transaction_rails_queue_duration_total | Counter | 9.4 | 衡量GitLab Workhorse将请求转发到Rails之间延迟的指标 | controller, action, endpoint_id | | gitlab_transaction_view_duration_total | Counter | 9.4 | 视图持续时间 | controller, action, view, endpoint_id | | gitlab_view_rendering_duration_seconds | Histogram | 10.2 | 视图渲染持续时间(直方图) | controller, action, view, endpoint_id | | http_requests_total | Counter | 9.4 | Rack请求计数 | method, status | | http_request_duration_seconds | Histogram | 9.4 | 成功请求的Rack中间件HTTP响应时间 | method | | gitlab_transaction_db_count_total | Counter | 13.1 | SQL调用总数的计数器 | controller, action, endpoint_id | | gitlab_transaction_db_<role>_count_total | Counter | 13.10 | 按数据库角色(主/副本)分组的SQL调用总数计数器 | controller, action, endpoint_id | | gitlab_transaction_db_write_count_total | Counter | 13.1 | 写入SQL调用总数的计数器 | controller, action, endpoint_id | | gitlab_transaction_db_cached_count_total | Counter | 13.1 | 缓存SQL调用总数的计数器 | controller, action, endpoint_id | | gitlab_transaction_db_<role>_cached_count_total | Counter | 13.1 | 按数据库角色(主/副本)分组的缓存SQL调用总数计数器 | controller, action, endpoint_id | | gitlab_transaction_db_<role>_wal_count_total | Counter | 14.0 | 按数据库角色(主/副本)分组的WAL(预写日志位置)查询总数计数器 | controller, action, endpoint_id | | gitlab_transaction_db_<role>_wal_cached_count_total | Counter | 14.1 | 按数据库角色(主/副本)分组的缓存WAL(预写日志位置)查询总数计数器 | controller, action, endpoint_id | | http_elasticsearch_requests_duration_seconds | Histogram | 13.1 | Web事务期间的Elasticsearch请求持续时间。仅适用于Premium和Ultimate版。 | controller, action, endpoint_id | | http_elasticsearch_requests_total | Counter | 13.1 | Web事务期间的Elasticsearch请求数量。仅适用于Premium和Ultimate版。 | controller, action, endpoint_id |

| pipelines_created_total | 计数器 | 9.4 | 创建的流水线计数器 | source, partition_id | | rack_uncaught_errors_total | 计数器 | 9.4 | 处理Rack连接时未捕获错误的数量 | | | user_session_logins_total | 计数器 | 9.4 | 自GitLab启动或重启以来用户登录次数的计数器 | | | upload_file_does_not_exist | 计数器 | 10.7 | 无法找到对应文件的次数。 | | | failed_login_captcha_total | 仪表盘 | 11.0 | 登录期间失败的验证码尝试次数计数器 | | | successful_login_captcha_total | 仪表盘 | 11.0 | 登录期间成功的验证码尝试次数计数器 | | | auto_devops_pipelines_completed_total | 计数器 | 12.7 | 已完成自动DevOps流水线的计数器,按状态标记 | | | artifact_report_<report_type>_builds_completed_total | 计数器 | 15.3 | 带有报告类型工件的CI构建完成计数器,按报告类型分组并按状态标记 | | | action_cable_active_connections | 仪表盘 | 13.4 | 当前连接的ActionCable WebSocket客户端数量 | server_mode | | action_cable_broadcasts_total | 计数器 | 13.10 | 发出的ActionCable广播数量 | server_mode | | action_cable_pool_min_size | 仪表盘 | 13.4 | ActionCable线程池中最小工作线程数 | server_mode | | action_cable_pool_max_size | 仪表盘 | 13.4 | ActionCable线程池中最大工作线程数 | server_mode | | action_cable_pool_current_size | 仪表盘 | 13.4 | ActionCable线程池中当前工作线程数 | server_mode | | action_cable_pool_largest_size | 仪表盘 | 13.4 | ActionCable线程池中迄今为止观察到的最大工作线程数 | server_mode | | action_cable_pool_pending_tasks | 仪表盘 | 13.4 | ActionCable线程池中等待执行的任务数量 | server_mode | | action_cable_pool_tasks_total | 仪表盘 | 13.4 | ActionCable线程池中执行的总任务数 | server_mode | | gitlab_ci_trace_operations_total | 计数器 | 13.4 | 构建跟踪上不同操作的总数 | operation | | gitlab_ci_trace_bytes_total | 计数器 | 13.4 | 传输的构建跟踪字节总量 | |

| action_cable_single_client_transmissions_total | Counter | 13.10 | 向任意频道中任意客户端传输的ActionCable消息数量 | server_mode | | action_cable_subscription_confirmations_total | Counter | 13.10 | 客户端确认的ActionCable订阅数量 | server_mode | | action_cable_subscription_rejections_total | Counter | 13.10 | 客户端被拒绝的ActionCable订阅数量 | server_mode | | action_cable_transmitted_bytes_total | Counter | 16.0 | 通过ActionCable传输的总字节数 | operation, channel | | gitlab_issuable_fast_count_by_state_total | Counter | 13.5 | 在Issue和Merge request页面上的行计数操作总数 | | | gitlab_issuable_fast_count_by_state_failures_total | Counter | 13.5 | 在Issue和Merge request页面上软失败的行计数操作数量 | | | gitlab_ci_trace_finalize_duration_seconds | Histogram | 13.6 | 构建跟踪片段迁移到对象存储的持续时间 | | | gitlab_vulnerability_report_branch_comparison_real_duration_seconds | Histogram | 15.11 | 默认分支上存在的漏洞报告SQL查询的实际执行时长 | | | gitlab_vulnerability_report_branch_comparison_cpu_duration_seconds | Histogram | 15.11 | 默认分支上存在的漏洞报告SQL查询的CPU执行时长 | | | gitlab_external_http_total | Counter | 13.8 | 对外部系统的HTTP调用总数 | controller, action, endpoint_id | | gitlab_external_http_duration_seconds | Counter | 13.8 | 每次对外系统HTTP调用的耗时(秒) | | | gitlab_external_http_exception_total | Counter | 13.8 | 进行外部HTTP调用时抛出的异常总数 | | | ci_report_parser_duration_seconds | Histogram | 13.9 | 解析CI/CD报告工件的耗时 | parser | | pipeline_graph_link_calculation_duration_seconds | Histogram | 13.9 | 计算链接所花费的总时间(秒) | | | pipeline_graph_links_total | Histogram | 13.9 | 每个图的链接数量 | | | pipeline_graph_links_per_job_ratio | Histogram | 13.9 | 每个图中链接与作业的比例 | | | gitlab_ci_pipeline_security_orchestration_policy_processing_duration_seconds | Histogram | 13.12 | 处理CI/CD流水线中安全策略所需的秒数 | |

| gitlab_spamcheck_request_duration_seconds | 直方图 | 13.12 | Rails与反垃圾邮件引擎之间请求的持续时间 | | | service_desk_thank_you_email | 计数器 | 14.0 | 对新Service Desk电子邮件的回复总数 | | | service_desk_new_note_email | 计数器 | 14.0 | 新Service Desk评论的电子邮件通知总数 | | | email_receiver_error | 计数器 | 14.1 | 处理传入电子邮件时的错误总数 | | | gitlab_snowplow_events_total | 计数器 | 14.1 | 发出的GitLab Snowplow分析工具事件总数 | | | gitlab_snowplow_failed_events_total | 计数器 | 14.1 | GitLab Snowplow分析工具事件发送失败次数 | | | gitlab_snowplow_successful_events_total | 计数器 | 14.1 | GitLab Snowplow分析工具事件发送成功次数 | | | gitlab_ci_build_trace_errors_total | 计数器 | 14.4 | 构建跟踪的不同错误类型数量 | error_reason | | gitlab_presentable_object_cacheless_render_real_duration_seconds | 直方图 | 15.3 | 缓存特定Web请求对象并呈现所花费的实际时间 | controller, action, endpoint_id | | cached_object_operations_total | 计数器 | 15.3 | 特定Web请求缓存的对象总数 | controller, action, endpoint_id | | redis_hit_miss_operations_total | 计数器 | 15.6 | Redis缓存命中和未命中的总数 | cache_hit, cache_identifier, feature_category, backing_resource | | redis_cache_generation_duration_seconds | 直方图 | 15.6 | 生成Redis缓存的时间 | cache_hit, cache_identifier, feature_category, backing_resource | | gitlab_diffs_reorder_real_duration_seconds | 直方图 | 15.8 | 批量请求中重新排序差异文件所花费的秒数 | controller, action, endpoint_id | | gitlab_diffs_collection_real_duration_seconds | 直方图 | 15.8 | 批量请求中查询合并请求差异文件所花费的秒数 | controller, action, endpoint_id | | gitlab_diffs_comparison_real_duration_seconds | 直方图 | 15.8 | 批量请求中获取比较数据所花费的秒数 | controller, action, endpoint_id | | gitlab_diffs_unfoldable_positions_real_duration_seconds | 直方图 | 15.8 | 批量请求中获取可展开注释位置所花费的秒数 | controller, action | | gitlab_diffs_unfold_real_duration_seconds | 直方图 | 15.8 | 批量请求中展开位置所花费的秒数 | controller, action, endpoint_id | | gitlab_diffs_write_cache_real_duration_seconds | 直方图 | 15.8 | 批量请求中缓存高亮行和统计信息所花费的秒数 | controller, action, endpoint_id | | gitlab_diffs_highlight_cache_decorate_real_duration_seconds | 直方图 | 15.8 | 批量请求中从缓存设置高亮行所花费的秒数 | controller, action, endpoint_id | | gitlab_diffs_render_real_duration_seconds | 直方图 | 15.8 | 批量请求中序列化和渲染差异所花费的秒数 | controller, action, endpoint_id |

| gitlab_memwd_violations_total | Counter | 15.9 | Ruby进程违反内存阈值的总次数 | | | gitlab_memwd_violations_handled_total | Counter | 15.9 | Ruby进程内存违规被处理的次数 | | | gitlab_sli_rails_request_apdex_total | Counter | 14.4 | 请求Apdex测量的总次数 | endpoint_id, feature_category, request_urgency | | gitlab_sli_rails_request_apdex_success_total | Counter | 14.4 | 满足其紧急程度目标持续时间的成功请求数量。除以gitlab_sli_rails_requests_apdex_total得到成功率 | endpoint_id, feature_category, request_urgency | | gitlab_sli_rails_request_error_total | Counter | 15.7 | 请求错误测量的总次数 | endpoint_id, feature_category, request_urgency, error | | job_register_attempts_failed_total | Counter | 9.5 | Runner未能注册作业的次数 | | | job_register_attempts_total | Counter | 9.5 | Runner尝试注册作业的次数 | | | job_queue_duration_seconds | Histogram | 9.5 | 请求处理执行时间 | | | gitlab_ci_queue_operations_total | Counter | 16.3 | 队列内发生的所有操作数量 | | | gitlab_ci_queue_depth_total | Histogram | 16.3 | 相对于操作结果的CI/CD构建队列大小 | | | gitlab_ci_queue_size_total | Histogram | 16.3 | 已初始化的CI/CD构建队列的大小 | | | gitlab_ci_current_queue_size | Gauge | 16.3 | 已初始化的CI/CD构建队列的当前大小 | | | gitlab_ci_queue_iteration_duration_seconds | Histogram | 16.3 | 在CI/CD队列中查找构建所需的时间 | | | gitlab_ci_queue_retrieval_duration_seconds | Histogram | 16.3 | 执行SQL查询以检索构建队列所需的时间 | | | gitlab_connection_pool_size | Gauge | 16.7 | 连接池的大小 | | | gitlab_connection_pool_available_count | Gauge | 16.7 | 连接池中可用连接的数量 | | | gitlab_security_policies_scan_result_process_duration_seconds | Histogram | 16.7 | 处理合并请求审批策略所需的时间 | | | gitlab_security_policies_policy_sync_duration_seconds | Histogram | 17.6 | 同步策略配置更改所需的时间 | | | gitlab_security_policies_policy_deletion_duration_seconds | Histogram | 17.6 | 删除与策略相关的配置所需的时间 | | | gitlab_security_policies_policy_creation_duration_seconds | Histogram | 17.6 | 创建与策略相关的配置所需的时间 | | | gitlab_security_policies_sync_opened_merge_requests_duration_seconds | Histogram | 17.6 | 策略变更后同步打开的合并请求所需的时间 | | | gitlab_security_policies_scan_execution_configuration_rendering_seconds | Histogram | 17.3 | 渲染扫描执行策略CI配置所需的时间 | | | gitlab_security_policies_update_configuration_duration_seconds | Histogram | 17.6 | 安排策略配置变更的同步所需的时间 | | | gitlab_highlight_usage | Counter | 16.8 | Gitlab::Highlight的使用次数 | used_on | | dependency_linker_usage | Counter | 16.8 | 依赖链接器的使用次数 | used_on | | gitlab_keeparound_refs_requested_total | Counter | 16.10 | 请求创建的保留引用数量 | source | | gitlab_keeparound_refs_created_total | Counter | 16.10 | 实际创建的保留引用数量 | source | | search_advanced_index_repair_total | Counter | 17.3 | 索引修复操作的数量 | document_type | | search_advanced_boolean_settings | Gauge | 17.3 | 高级搜索布尔设置的当前状态 | name | | gitlab_http_router_rule_total | Counter | 17.4 | HTTP路由规则的rule_actionrule_type出现次数 | rule_action, rule_type | | gitlab_rack_attack_events_total | Counter | 17.6 | Rack Attack处理的事件总数 | event_type, event_name | | gitlab_rack_attack_throttle_limit | Gauge | 17.6 | 报告客户端在被Rack Attack节流之前可发出的最大请求数量 | event_name | | gitlab_rack_attack_throttle_period_seconds | Gauge | 17.6 | 报告客户端在被Rack Attack节流之前的请求计数周期时长 | event_name | | gitlab_application_rate_limiter_throttle_utilization_ratio | Histogram | 17.6 | GitLab应用速率限制器中节流的利用率比率 | throttle_key, peek, feature_category | | gitlab_find_dependency_paths_real_duration_seconds | Histogram | 18.3 | 解析给定组件的祖先依赖路径所花费的秒数 | |

| gitlab_dependency_paths_found_total | Counter | 18.3 | 计算给定依赖项找到的祖先依赖路径数量。 | cyclic |

受功能标志控制的指标

以下指标可由功能标志控制:

指标 功能标志
gitlab_view_rendering_duration_seconds prometheus_metrics_view_instrumentation
gitlab_ci_queue_depth_total gitlab_ci_builds_queuing_metrics
gitlab_ci_queue_size gitlab_ci_builds_queuing_metrics
gitlab_ci_queue_size_total gitlab_ci_builds_queuing_metrics
gitlab_ci_queue_iteration_duration_seconds gitlab_ci_builds_queuing_metrics
gitlab_ci_current_queue_size gitlab_ci_builds_queuing_metrics
gitlab_ci_queue_retrieval_duration_seconds gitlab_ci_builds_queuing_metrics
gitlab_ci_queue_active_runners_total gitlab_ci_builds_queuing_metrics

Praefect 指标

您可以配置 Praefect 来报告指标。有关可用指标的信息,请参阅监控 Gitaly 集群(Praefect)