[分享] 极狐GitLab快速日志收集及日志分析

Fast_log_collection_and_log_analysis

数据采集

KubeSOS

使用kubectlhelm ,获取GitLab Cloud Native chart deployments方式部署的配置和日志 。

Requirements

kubectl client v1.14+

helm 2.12+

Usage

Flags Description Required Default
-n namespace No “default”
-r helm chart release No “gitlab”

下载 并执行

chmod +x kubeSOS.sh
./kubeSOS.sh [flags]

或者使用curl 命令执行:

curl https://gitlab.com/gitlab-com/support/toolbox/kubesos/raw/master/kubeSOS.sh | bash -s -- [flags]

Data will be archived to kubesos-<timestamp>.tar.gz

gitlabsos

gitlabsos 提供了一种从 GitLab 及其运行的系统收集信息和日志的统一方法。

何时需要执行脚本

  • 如果性能下降。

  • 重现软件错误(如 500 错误),则在问题发生后立即运行该脚本时效果最佳。

如果您错过了窗口期,请不要担心。无论如何运行 gitlabsos,它仍然会收集大量有用的信息来识别问题。

限制

  • 适用于 Omnibus 安装和 GitLab Docker 镜像。这意味着该脚本不会为 k8s chart 部署或源安装收集 GitLab 相关信息。
  • 生成的存档最终可能会很大。为了减少日志和存档大小,gitlabsos 只抓取每个日志文件的最后 10MB。

用法

如果需要,您始终可以通过运行来仔细检查可用选项./gitlabsos.rb --help

Usage: gitlabsos.rb [options]
    -o, --output-file FILE           Write gitlabsos report to FILE
        --debug                      Set the log level to debug
        --skip-root-check            Run the script as non-root. Warning: script might fail
        --max-file-size MB           Set the max file size (in megabytes) for any file in the report
    -h, --help                       Prints this help

运行脚本

gitlabsos 程序是一个简单的 ruby 脚本,旨在“开箱即用”运行,无需任何进一步配置。有关如何执行脚本的示例,请参见下文。

/opt/gitlab/embedded/bin/git clone https://gitlab.com/gitlab-com/support/toolbox/gitlabsos.git && cd gitlabsos
sudo ./gitlabsos.rb

直接执行

curl https://gitlab.com/gitlab-com/support/toolbox/gitlabsos/raw/master/gitlabsos.rb | sudo /opt/gitlab/embedded/bin/ruby

在未连接到 Internet 的网络上执行

如果您的 GitLab 服务器被外部互联网阻止,您可以将此文件的内容复制到gitlabsos.rb您的 GitLab 服务器上命名的文件中,并使用以下命令运行它:

sudo /opt/gitlab/embedded/bin/ruby gitlabsos.rb

在 GitLab Docker 容器中运行 gitlabsos

首先通过gitlabsos在您的 GitLab 容器中执行脚本来捕获 gitlabsos 报告

sudo docker exec -it <gitlab-container-name> bash -c "curl https://gitlab.com/gitlab-com/support/toolbox/gitlabsos/raw/master/gitlabsos.rb | /opt/gitlab/embedded/bin/ruby"

然后将 gitlabsos 报告复制到 Docker 容器外以的服务器

sudo docker cp <gitlab-container-name>:gitlabsos.example.com_<timestamp>.tar.gz .

fast-stats 快速日志分析

常用命令总结

fast-stats FILE
fast-stats FILE --sort p95																					  # 根据列排序
 
fast-stats --bench 13.6 FILE  																				# 和基准测试作比较
fast-stats --interval 1h --limit 3 --print-fields count,rps,p99 FILE  # 分割时间片
fast-stats --search-for projects FILE 																# 查询某字段
fast-stats FILE1 --compare FILE2																			# 比较两个相同类型的日志


fast-stats top  FILE
fast-stats top --sort gitaly FILE																			# 根据某个字段排序

fast-stats errors FILE																								# 统计日志中的错误

Supported Log Types and Formats

  • production_json
  • api_json
  • gitaly
    • unstructured
    • JSON
  • sidekiq
    • unstructured
    • JSON

子命令:

  • top
  • errors
  • plot

字段定义

  • COUNT – Number of requests
  • RPS – Requests per second
  • P99 – 99th percentile request duration
  • P95 – 95th percentile request duration
  • MEDIAN – Median request duration
  • MAX – Longest request duration
  • MIN – Shortest request duration
  • % FAIL – Percentage of requests that failed. For api_json and prod_json this is defined as a status >= 500.
  • SCORECOUNT * P99

Examples

单个文件的统计信息

METHOD                       COUNT     RPS    P99_ms    P95_ms   MEDIAN_ms    MAX_ms    MIN_ms       SCORE     %FAIL
FindAllTags                     31    0.02  540180.2  531772.9     12356.7  543566.1     545.9  16745586.9     29.03
ListCommitsByOid                50    0.02  153146.8      14.9         6.1  300269.9       0.0   7657340.5      6.00
GetCommitSignatures              8    0.00  301148.9  300683.2       930.3  301265.4      45.3   2409191.5     25.00
FetchSourceBranch                3    0.00  513023.1  471603.9      5637.8  523377.9    4537.9   1539069.4     33.33
FindLicense                      2    0.00  299999.6  299910.4    298906.9  300021.9  297791.9    599999.3    100.00

在这个例子中,FindAllTags作为最慢的方法,而FindLicense最常失败。两者都是进一步调查的好候选人。

--compare比较文件之间区别,使用--print-fields输出更加精简:

FILE                CONTROLLER                                                   COUNT    P99_ms     %FAIL
prod_json.log       Projects::MergeRequestsController#ci_environments_status      4911     620.8      0.00
other_prod_json.log                                                                104   59983.3      3.85
ratio                                                                            0.02x    96.63x      infx

prod_json.log       Explore::ProjectsController#index                                4    1653.9      0.00
other_prod_json.log                                                                206    1339.2      0.00
ratio                                                                           51.50x     0.81x     0.00x

prod_json.log       Projects::JobsController#show                                 3564    1052.7      0.00
other_prod_json.log                                                                 47    2228.5      0.00
ratio                                                                            0.01x     2.12x     0.00x

Usage

下载 二进制版本 Releases · GitLab.com / GitLab Support Team / toolbox / fast-stats · GitLab 并使其可执行 ( chmod +x fast-stats) 后,您可以按如下方式运行它(添加到您的PATH或以 开头./):

fast-stats [FLAGS] [OPTIONS] <FILE> [SUBCOMMAND]

Args

<FILE>

指定要处理的文件。如果这被省略或传入参数-,则标准输入将被读取。

$ fast-stats FILE

CONTROLLER                                                   COUNT     RPS    P99_ms    P95_ms   MEDIAN_ms    MAX_ms    MIN_ms      SCORE     %FAIL
Projects::MergeRequestsController#ci_environments_status       104    0.02   59983.3   44070.7     18591.1   59984.3      25.2  6238267.6      3.85
Explore::ProjectsController#index                              206    0.03    1339.2    1127.8       976.8    3911.2     761.8   275865.1      0.00
Projects::MergeRequests::ContentController#widget              221    0.04     724.8     573.0       335.4    1132.3     113.3   160187.9      0.00

Flags

–color-output / -C

强制文本输出为彩色。默认情况下,fast-stats如果 stdout 是终端,则仅输出彩色文本。

Options

–bench / -b <BENCH_VERSION>

GitLab.com 比较性能。GitLab 版本 12.0+ 可用。

$ fast-stats --bench 13.6 FILE

FILE                CONTROLLER                                                   COUNT     RPS    P99_ms    P95_ms   MEDIAN_ms    MAX_ms    MIN_ms      SCORE     %FAIL
13.7                Projects::MergeRequestsController#ci_environments_status      1626   33.18     258.2     153.7        44.1    1092.4      11.3   419869.8      0.00
new_dur_s_prod.log                                                                 104    0.02   59983.3   44070.7     18591.1   59984.3      25.2  6238267.6      3.85
ratio                                                                            0.06x   0.00x   232.30x   286.68x     421.47x    54.91x     2.22x     14.86x      infx

13.7                Explore::ProjectsController#index                               45    0.92    1162.9     462.5       210.2    1679.8     182.7    52330.3      0.00
new_dur_s_prod.log                                                                 206    0.03    1339.2    1127.8       976.8    3911.2     761.8   275865.1      0.00
ratio                                                                            4.58x   0.04x     1.15x     2.44x       4.65x     2.33x     4.17x      5.27x     0.00x

13.7                Projects::MergeRequests::ContentController#widget             6283  128.22     412.7     268.0       137.0    1370.8       7.8  2593217.8      0.00
new_dur_s_prod.log                                                                 221    0.04     724.8     573.0       335.4    1132.3     113.3   160187.9      0.00
ratio                                                                            0.04x   0.00x     1.76x     2.14x       2.45x     0.83x    14.60x      0.06x     0.00x

–compare / -c <COMPARE_FILE>

可以比较相同类型的两个文件,列出一个与另一个的比率。

注意:日志不需要是相同的格式,只需相同的类型。例如,可以将非结构化 Gitaly 日志与 JSON gitaly 日志进行比较。

$ fast-stats FILE1 --compare FILE2

FILE             METHOD                COUNT     RPS    P99_ms    P95_ms   MEDIAN_ms    MAX_ms    MIN_ms       SCORE     %FAIL
gitaly-normal    FindAllTags             668    0.42     151.2     102.9        21.7     240.0       9.3    100998.4      0.00
gitaly-slow                               31    0.02  540180.2  531772.9     12356.7  543566.1     545.9  16745586.9     29.03
ratio                                  0.05x   0.04x  3572.73x  5167.24x     570.41x  2264.42x    58.68x     165.80x      infx

gitaly-normal    FetchSourceBranch        10    0.01    1809.7    1157.4        88.5    1972.8      74.1     18097.4      0.00
gitaly-slow                                3    0.00  513023.1  471603.9      5637.8  523377.9    4537.9   1539069.4     33.33
ratio                                  0.30x   0.23x   283.48x   407.47x      63.72x   265.29x    61.22x      85.04x      infx

gitaly-normal    FindAllTagNames         226    0.14      25.2      16.8         9.9      36.7       8.5      5687.6      0.00
gitaly-slow                               22    0.01    2589.6      62.8        16.0    3261.2       2.2     56970.3      0.00
ratio                                  0.10x   0.08x   102.90x     3.74x       1.61x    88.95x     0.26x      10.02x     0.00x

**–format / -f **

确定打印格式,默认为文本。

可用格式:

  • text
  • csv
  • md
$ fast-stats --format md FILE
CONTROLLER COUNT RPS P99_ms P95_ms MEDIAN_ms MAX_ms MIN_ms SCORE %FAIL
Projects::MergeRequestsController#ci_environments_status 104 0.02 59983.3 44070.7 18591.1 59984.3 25.2 6238267.6 3.85
Explore::ProjectsController#index 206 0.03 1339.2 1127.8 976.8 3911.2 761.8 275865.1 0.00
Projects::MergeRequests::ContentController#widget 221 0.04 724.8 573.0 335.4 1132.3 113.3 160187.9 0.00

–interval / -i <INTERVAL_LEN>

将结果拆分为 INTERVAL_LEN 时间片。INTERVAL_LEN 必须采用\<LEN>[h|m|s]格式,其中\<LEN>是正整数。

有效语法示例:

  • 1h
  • 10m
  • 30s
$ fast-stats --interval 1h --limit 3 --print-fields count,rps,p99 FILE

** Splitting input into 1 hour increments **

Start time: 2020-12-11 00:11:34.397
End time:   2020-12-11 01:56:09.791


   2020-12-11 00:11:34.397

CONTROLLER                                                   COUNT     RPS    P99_ms
Projects::MergeRequestsController#ci_environments_status        51    0.01   34602.6
Explore::ProjectsController#index                              119    0.03    1157.7
Projects::MergeRequests::ContentController#widget              116    0.03     820.8

   2020-12-11 01:11:34.397

CONTROLLER                                                   COUNT     RPS    P99_ms
Projects::MergeRequestsController#ci_environments_status        53    0.02   59983.9
Explore::ProjectsController#index                               87    0.03    1349.2
Projects::JobsController#show                                   41    0.02    2232.9

–limit / -l <LIMIT_CT>

要打印的行数/比较数。默认为完整结果。

$ fast-stats --limit 2 FILE

CONTROLLER                                                   COUNT     RPS    P99_ms    P95_ms   MEDIAN_ms    MAX_ms    MIN_ms      SCORE     %FAIL
Projects::MergeRequestsController#ci_environments_status       104    0.02   59983.3   44070.7     18591.1   59984.3      25.2  6238267.6      3.85
Explore::ProjectsController#index                              206    0.03    1339.2    1127.8       976.8    3911.2     761.8   275865.1      0.00

–print-fields / -p <PRINT_FIELDS>

仅打印\<PRINT_FIELDS>按提供的顺序列出的字段。

主列,控制器/路由/方法/类将始终打印。

可打印的字段:

  • count
  • fail
  • max
  • median
  • min
  • p95
  • p99
  • rps
  • score
$ fast-stats --print-fields fail,median,count FILE

CONTROLLER                                                   %FAIL   MEDIAN_ms     COUNT
Projects::MergeRequestsController#ci_environments_status      3.85     18591.1       104
Explore::ProjectsController#index                             0.00       976.8       206
Projects::MergeRequests::ContentController#widget             0.00       335.4       221

–sort / -s <SORT_BY>

按哪个字段对结果进行排序,默认为 SCORE。排序总是降序。

排序依据的可用字段:

  • count
  • fail
  • max
  • median
  • min
  • p95
  • p99
  • rps
  • score
$ fast-stats --sort fail FILE

METHOD                           COUNT     RPS         P99         P95      MEDIAN         MAX         MIN       SCORE      %FAIL
Cleanup                             24    0.02     67.81ms     40.36ms     25.59ms     75.87ms     23.57ms     1627.56     16.67%
ListConflictFiles                   10    0.01    179.87ms    145.98ms     35.68ms    188.34ms     12.69ms     1798.67     10.00%
FetchSourceBranch                   10    0.01   1809.74ms   1157.41ms     88.48ms   1972.82ms     74.13ms    18097.39      0.00%

–search-for / -S <SEARCH_FOR>

对 controller/route/method/class 行不区分大小写的搜索\<SEARCH_FOR>

没有查询日志中的其他字段,因此不能用于搜索特定项目。

$ fast-stats --search-for projects FILE

CONTROLLER                                                   COUNT     RPS    P99_ms    P95_ms   MEDIAN_ms    MAX_ms    MIN_ms      SCORE     %FAIL
Projects::MergeRequestsController#ci_environments_status       104    0.02   59983.3   44070.7     18591.1   59984.3      25.2  6238267.6      3.85
Explore::ProjectsController#index                              206    0.03    1339.2    1127.8       976.8    3911.2     761.8   275865.1      0.00
Projects::MergeRequests::ContentController#widget              221    0.04     724.8     573.0       335.4    1132.3     113.3   160187.9      0.00

–type / -t <LOG_TYPE>

fast-stats将尝试根据第一行自动确定传递的日志文件的类型。但是,如果这无效(行部分切断、Sidekiq 中的堆栈跟踪等),您可以覆盖自动检测并手动指定日志类型。

使用时,此参数将应用于 和 <COMPARE_FILE> --compare

可用类型:

  • api_json
  • gitaly
  • gitaly_json
  • production_json
  • sidekiq
  • sidekiq_json

–verbose / -v

按每个条目的总持续时间打印最大值、P99、P95 和中值事件的组件详细信息。这允许轻松比较最慢请求的限制因素。

具有较少事件数量的操作可能没有与检查的确切百分位数相对应的事件。在这些情况下,我们显示最接近的事件并显示该事件的实际百分位数。如果类别中没有足够的事件来为每个目标百分位数查找事件,例如第 99 和第 95 个百分位数是相同的项目,则省略重复的项目。

以 markdown 或 csv 格式打印时不可用。

fast-stats --limit 2 --verbose FILE
ROUTE                                          COUNT     RPS    P99_ms    P95_ms   MEDIAN_ms    MAX_ms    MIN_ms     SCORE     %FAIL
/api/:version/projects                            31    0.00   15426.4   14694.4     11865.7   15591.9     617.0  478218.6      0.00
    MAX dur: 15.59s  db:  0.09s  redis:  0.15s  gitaly:  8.00s  rugged:  5.12s  cpu:  0.00s -- 2020-12-11T00:48:34.667Z  LwtM3BjVSJa
    P97 dur: 15.04s  db:  0.11s  redis:  0.18s  gitaly:  7.42s  rugged:  5.56s  cpu:  0.00s -- 2020-12-11T00:48:18.950Z  Zg48xm1lsO3
    P50 dur: 11.87s  db:  0.08s  redis:  0.50s  gitaly:  5.82s  rugged:  3.57s  cpu:  0.00s -- 2020-12-11T01:01:49.725Z  iptvGokGCm5

/api/:version/projects/:id/repository/tree      1263    0.20     365.8     268.7       155.4    1516.4      64.9  461980.4      0.00
    MAX dur:  1.52s  db:  0.01s  redis:  0.00s  gitaly:  0.00s  rugged:  1.49s  cpu:  0.00s -- 2020-12-11T01:10:18.982Z  FwmXcXy9rY9
    P99 dur:  0.37s  db:  0.01s  redis:  0.00s  gitaly:  0.17s  rugged:  0.16s  cpu:  0.00s -- 2020-12-11T00:35:04.366Z  TAMxviqeGf5
    P95 dur:  0.27s  db:  0.01s  redis:  0.00s  gitaly:  0.00s  rugged:  0.24s  cpu:  0.00s -- 2020-12-11T01:14:23.955Z  XuA4a0rgY69
    P50 dur:  0.16s  db:  0.02s  redis:  0.00s  gitaly:  0.00s  rugged:  0.11s  cpu:  0.00s -- 2020-12-11T01:32:26.977Z  2ssOas2v5t5

Subcommands

top

按对 project, user, or path 的请求所消耗的总持续时间打印类别中最重要项目的摘要。比较的类型,例如path, project,会因日志文件而异,随着 GitLab 的更高版本提供更多选项。

日志中不存在的任何列都将从输出中省略,因此较旧的日志将不包含 redis 或 cpu 时间等详细信息。

类别:

  • Path: prod_json, api_json
  • Project: proj_json (13.0+), api_json (13.5+), gitaly, sidekiq (13.5+)
  • User: prod_json, api_json (13.5+), sidekiq (13.5+)
  • Client: gitaly

Usage: fast-stats top [OPTIONS] [FILE_NAME]

Options

–display / -d <DISPLAY_FMT>

显示总数的百分比、实际持续时间,或两者兼而有之。默认为两者。

可用格式:

  • value
  • perc
  • both
$ fast-stats top -d both FILE

Top 2 Paths by Duration

PATH                                                                              COUNT          DUR           DB        REDIS       GITALY       RUGGED          CPU   FAIL_CT
/group/project1/-/merge_requests/121/ci_environments_status                          13      5m36.0s      5m35.7s         0.0s         0.0s         0.0s         0.5s         1
/group/project2/-/merge_requests/48/ci_environments_status                            9      5m02.8s      5m02.5s         0.0s         0.0s         0.0s         0.4s         1


Top 2 Projects by Duration

PROJECT                                                                           COUNT          DUR           DB        REDIS       GITALY       RUGGED          CPU   FAIL_CT
/group/project1                                                                      52      7m55.5s      7m51.5s         0.1s         0.0s         2.1s         2.7s         1
/other_group/other_project                                                           53      6m24.5s      6m15.7s         0.1s         0.0s         3.3s         6.6s         0


Top 2 Users by Duration

USER                                                                              COUNT          DUR           DB        REDIS       GITALY       RUGGED          CPU   FAIL_CT
user1                                                                               164     14m28.1s     14m09.3s         0.4s         0.1s         8.6s        12.9s         1
user2                                                                                40      7m00.7s      6m57.4s         0.1s         0.1s         1.5s         2.3s         1

–limit / -l <LIMIT_CT>

要打印的行数。默认为 10。

$ fast-stats top --display value FILE

Top 2 Projects by Duration

PROJECT                                                              COUNT      DUR  FAIL_CT
group/project1                                                       0.34%    8.14%    9.09%
group/project2                                                       1.02%    7.75%    4.55%


Top 2 Clients by Duration

Client                                                               COUNT      DUR  FAIL_CT
gitlab-sidekiq                                                      40.78%   75.20%   59.09%
gitlab-web                                                          58.36%   24.80%   40.91%

–sort / -s <SORT_BY>

按哪个字段对结果进行排序,默认为 DUR。排序总是降序。

排序依据的可用字段:

  • count
  • duration
  • db
  • redis
  • gitaly
  • rugged
  • queue
  • cpu
  • fail
fast-stats top --sort gitaly --display value FILE

Top 2 Paths by Gitaly Duration

PATH                                                         COUNT      DUR       DB    REDIS   GITALY   RUGGED      CPU  FAIL_CT
/group1/project3/-/refs/master/logs_tree                     0.11%    0.14%    0.00%    0.15%   14.15%    0.20%    0.11%    0.00%
/group2/project/-/merge_requests/4/widget.json               0.90%    0.21%    0.03%    0.49%    7.09%    3.11%    0.66%    0.00%


Top 2 Projects by Gitaly Duration

PROJECT                                                      COUNT      DUR       DB    REDIS   GITALY   RUGGED      CPU  FAIL_CT
/group1/project3                                             0.67%    0.26%    0.01%    0.48%   23.76%    0.77%    0.48%    0.00%
/group2/project4                                            11.65%    4.11%    1.21%   65.76%   17.15%    4.53%   45.33%    0.00%


Top 2 Users by Gitaly Duration

USER                                                         COUNT      DUR       DB    REDIS   GITALY   RUGGED      CPU  FAIL_CT
user3                                                        2.35%    0.50%    0.04%    1.21%   36.80%    3.22%    1.23%    0.00%
user4                                                       18.37%    6.29%    3.22%   67.47%   23.31%    8.09%   48.48%    0.00%

errors

打印所有错误的列表,按计数排序。如果一个或多个回溯与错误相关联,则将打印每行的前三行。

日志中不存在的任何列都将从输出中省略,因此较旧的日志将不包含 redis 或 cpu 时间等详细信息。

用法:fast-stats top [FLAGS] [FILE_NAME]

$ fast-stats errors FILE
┌─────────────────────────────────────────────────────┐
│Error: Gitlab::Git::CommandError 4:Deadline Exceeded.│
├─────────┬───────────────────────────────────────────┘
│Count: 10│
├─────────┴─────────────────────────────────────────────────────────────────────┐
│Backtraces:                                                                    │
│                                                                               │
│  lib/gitlab/git/wraps_gitaly_errors.rb:13:in `rescue in wrapped_gitaly_errors'│
│  lib/gitlab/git/wraps_gitaly_errors.rb:6:in `wrapped_gitaly_errors'           │
│  lib/gitlab/git/repository.rb:771:in `write_ref'                              │
├───────────────────────────────────────────────────────────────────────────────┤
│  lib/gitlab/git/wraps_gitaly_errors.rb:13:in `rescue in wrapped_gitaly_errors'│
│  lib/gitlab/git/wraps_gitaly_errors.rb:6:in `wrapped_gitaly_errors'           │
│  lib/gitlab/git/commit.rb:113:in `between'                                    │
├───────────────────────────────────────────────────────────────────────────────┴─────────────────────────────────────────────┐
│Events:                                                                                                                      │
│  TIME                      CORR_ID                           ACTION                                USER      PROJECT        │
│  2020-12-15T05:32:23.327Z  GirFqA7nE99                       Deployments::UpdateEnvironmentWorker  user1     group2/project8│
│  2020-12-15T05:32:50.741Z  QH1o6KC7jE5                       Deployments::UpdateEnvironmentWorker  myuser    group/project  │
│  2020-12-15T05:33:33.961Z  P2cTptLxsN7                       Deployments::UpdateEnvironmentWorker  user1     group2/project8│
│  2020-12-15T05:33:34.092Z  ifhQmC9RnG7                       Deployments::LinkMergeRequestWorker   user1     group2/project8│
│  2020-12-15T05:33:34.095Z  QH1o6KC7jE5                       Deployments::LinkMergeRequestWorker   myuser    group/project  │
│  2020-12-15T05:34:20.020Z  jmjTNsGMyt3                       Deployments::UpdateEnvironmentWorker  user1     group2/project8│
│  2020-12-15T05:34:39.476Z  55b69ae5396624d01d3ae3af778ae7bc  Deployments::UpdateEnvironmentWorker  user1     group2/project8│
│  2020-12-15T05:38:42.066Z  atnrfyPJU95                       Deployments::LinkMergeRequestWorker   myuser    group/project  │
│  2020-12-15T05:38:52.055Z  atnrfyPJU95                       Deployments::LinkMergeRequestWorker   myuser    group/project  │
│  2020-12-15T06:30:41.704Z  wbmGxG9Cg6                        Deployments::LinkMergeRequestWorker   user1     group2/project8│
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Options

–no-border / -b

不要在每个错误条目周围打印边框。边框使区分条目更容易,但可能无法很好地粘贴到文档中。使用此标志将其关闭。

$ fast-stats errors --no-border FILE

Error: Rack::Timeout::RequestTimeoutException Request ran for longer than 60000ms
Count: 4
Backtrace:

  app/models/environment_status.rb:103:in `map'
  app/models/environment_status.rb:103:in `build_environments_status'
  app/models/environment_status.rb:14:in `for_merge_request'
Events:
  TIME                      CORR_ID       ACTION                                                    USER          PROJECT
  2020-12-11T01:18:50.248Z  YxqOfH8vfd9   Projects::MergeRequestsController#ci_environments_status  user1         group1/project1
  2020-12-11T01:19:09.672Z  bR78i04wGI3   Projects::MergeRequestsController#ci_environments_status  user2         group2/project2
  2020-12-11T01:35:29.744Z  bZe7787hsU7   Projects::MergeRequestsController#ci_environments_status  user3         group1/project7
  2020-12-11T01:37:08.751Z  YOTxaq1hq74   Projects::MergeRequestsController#ci_environments_status  user4         group3/project5

–color-output / -C

强制文本输出为彩色。默认情况下,fast-stats如果 stdout 是终端,则仅输出彩色文本。

plot

Output a 2560x1440 PNG with graphs of the following values:

  • Request Duration
  • Request Rate
  • Queue Duration
  • DB Duration
  • Redis Duration
  • Gitaly Duration
  • Rugged Duration
  • CPU Time
  • Failure Rate

If the data needed to create some of these graphs is not be present in the log then the corresponding graph will be blank.

Note: This feature is not enabled in pre-built Linux binaries.

Options

–outfile / -o <OUTPUT_FILE>

输出的文件名

Building from Source

支持的最低 Rust 版本是 1.49

在基于 Debian 的 Linux 系统上,需要在plot 启用默认功能的情况下构建以下软件包:

sudo apt install gcc make pkg-config libfreetype6-dev libfontconfig1-dev

要在没有绘图的情况下构建,请运行 cargo build --release --no-default-features