#histogram #heap #java #elasticsearch #ingest #directory #key-id

app jhhi

将Java堆直方图导入Elasticsearch

2个版本

0.1.1 2020年12月12日
0.1.0 2020年12月10日

#1958 in 数据库接口

MIT 许可证

1.5MB
427

jhhi 持续集成

Java堆直方图导入

Kibana

  • 发送单个直方图或目录中所有直方图
    • 按照以下顺序尝试解析每个文件的时间戳
      1. 按照RFC3339解析文件名
      2. 文件创建时间戳
      3. 文件修改时间戳
  • 支持URL或云ID
  • 支持不同的认证(基本,API密钥)
  • 使用批量API
  • 使用官方Elasticsearch客户端

安装

cargo install jhhi 或从版本页面下载。

用法

为运行在 $JAVA_PID 的Java进程创建一些直方图,并将它们导入

while true; do
    jmap -histo:live,file=$(date +%Y-%m-%dT%T%z) $JAVA_PID
    sleep 5
done
jhhi\
  --dir ~/Desktop/histograms_busy \
  --api-key-id REDACTED \
  --api-key REDACTED \
  --cloud-id REDACTED

Histograms will be indexed into [jheap-histo-ingest_2020-12-10t04-11-48.108146+00-00]
Opening dir ["/Users/lloyd/Desktop/histograms_busy"]
Parsed ["/Users/lloyd/Desktop/histograms_busy/2020-12-10T04:06:37+0000"] as histogram, sending ...
  [00:00:11] ########################################   14324/14324   Done
Parsed ["/Users/lloyd/Desktop/histograms_busy/2020-12-10T04:07:16+0000"] as histogram, sending ...
  [00:00:11] ########################################   14393/14393   Done
Parsed ["/Users/lloyd/Desktop/histograms_busy/2020-12-10T04:07:00+0000"] as histogram, sending ...
  [00:00:10] ########################################   14387/14387   Done
Parsed ["/Users/lloyd/Desktop/histograms_busy/2020-12-10T04:06:31+0000"] as histogram, sending ...
  [00:00:11] ########################################   14400/14400   Done
Parsed ["/Users/lloyd/Desktop/histograms_busy/2020-12-10T04:07:50+0000"] as histogram, sending ...
  [00:00:11] ########################################   14404/14404   Done
Parsed ["/Users/lloyd/Desktop/histograms_busy/2020-12-10T04:07:11+0000"] as histogram, sending ...
  [00:00:10] ########################################   14489/14489   Done
Parsed ["/Users/lloyd/Desktop/histograms_busy/2020-12-10T04:07:45+0000"] as histogram, sending ...
  [00:00:10] ########################################   14403/14403   Done
Parsed ["/Users/lloyd/Desktop/histograms_busy/2020-12-10T04:07:28+0000"] as histogram, sending ...
  [00:00:10] ########################################   14422/14422   Done
Parsed ["/Users/lloyd/Desktop/histograms_busy/2020-12-10T04:06:48+0000"] as histogram, sending ...
  [00:00:10] ########################################   14493/14493   Done
Parsed ["/Users/lloyd/Desktop/histograms_busy/2020-12-10T04:07:33+0000"] as histogram, sending ...
  [00:00:10] ########################################   14405/14405   Done
Parsed ["/Users/lloyd/Desktop/histograms_busy/2020-12-10T04:07:05+0000"] as histogram, sending ...
  [00:00:10] ########################################   14345/14345   Done
Parsed ["/Users/lloyd/Desktop/histograms_busy/2020-12-10T04:07:22+0000"] as histogram, sending ...
  [00:00:11] ########################################   14399/14399   Done
Parsed ["/Users/lloyd/Desktop/histograms_busy/2020-12-10T04:06:54+0000"] as histogram, sending ...
  [00:00:10] ########################################   14482/14482   Done
Parsed ["/Users/lloyd/Desktop/histograms_busy/2020-12-10T04:06:43+0000"] as histogram, sending ...
  [00:00:11] ########################################   14406/14406   Done
Parsed ["/Users/lloyd/Desktop/histograms_busy/2020-12-10T04:07:39+0000"] as histogram, sending ...
  [00:00:10] ########################################   14398/14398   Done

变量可以作为标志或环境变量传递;使用 --help 查看选项。

jhhi [jheap-histo-ingest] 0.1.0
Ingests Java heap histograms from the jmap util to Elasticsearch

USAGE:
    jhhi [OPTIONS] --dir <dir> --file <file>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
        --api-key <api-key>          API key auth: API Key [env: JHHI_ES_API_KEY=]
        --api-key-id <api-key-id>    API key auth: API Key Id [env: JHHI_ES_API_KEY_id=]
        --chunk-size <chunk-size>    Ingest bulk size [env: JHHI_ES_BULK_SIZE=]  [default: 500]
        --cloud-id <cloud-id>        Cloud Id for the cluster to send data to [env: JHHI_ES_CLOUD_ID=]
    -d, --dir <dir>                  Directory holding histogram files to ingest. Should be passed if file is not [env:
                                     JHHI_HISTO_DIR=]
    -f, --file <file>                Histogram file to ingest. Should be passed if dir is not [env: JHHI_HISTO_FILE=]
        --index-name <index-name>    Target index name [env: JHHI_ES_INDEX_NAME=]
        --password <password>        Basic auth: password [env: JHHI_ES_PASSWORD=]
        --url <url>                  Url for the cluster to send data to [env: JHHI_ES_URL=]
        --user <user>                Basic auth: username [env: JHHI_ES_USER=]

依赖项

~17–30MB
~484K SLoC