1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PlayframeworkでHikariCPのコネクション数をDataDogでモニタリング

Posted at

アプリケーション側の設定

hikariCPのMbeansの設定を有効にする

application.conf
    play.db.prototype.hikaricp.registerMbeans = true

ConnectionPoolにPoolNameを設定する

デフォルトだと HikariCP-1, HikariCP-2 みたいになってしまうので、わかりやすい名前をつける

application.conf
    db.default.hikaricp.poolName = default
    db.default-ro.hikaricp.poolName = default-ro
    db.accesslog.hikaricp.poolName = accesslog

DataDog-agentの設定

参考: https://docs.datadoghq.com/ja/integrations/java

conf.d/jmx.d/conf.yaml を編集する

PoolごとにMBeanが登録されるので、 bean_regex で指定する

conf.d/jmx.d/conf.yaml
    conf:
      - include:
          domain: com.zaxxer.hikari
          bean_regex:
            - com\.zaxxer\.hikari.*[,:]type=Pool.*
          attribute:
            - ActiveConnections
            - IdleConnections
            - ThreadsAwaitingConnection
            - TotalConnections

確認 👀

あとは Metrics Expoler とかでメトリクスが取れるか見てみればOK :thumbsup:

スクリーンショット 2020-06-01 11.25.20.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?