2
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 5 years have passed since last update.

scala, sbtでのkamon-cloudwatchの使い方

Posted at

kamon-cloudwatch

build.sbtに以下を追加

libraryDependencies += "com.timeout" %% "kamon-cloudwatch" % "0.0.1"

application.confに以下を追加

kamon {
  metric {
    # 秒間60でメトリクスを取得
    # これを追加しないとCloudWatchの料金が大変なことになる
    tick-interval = 60 second
  }
  cloudwatch {
    # カスタムメトリクスで表示する名前
    namespace = kamon-`<アプリ名>`
    # Cloudwatchのリージョン
    region = eu-west-1
    # Cloudwatchに一度に送るデータ数?
    batch-size = 20
    # falseだったらCloudwatchにメトリクスを送らない?
    send-metrics = true
    # スレッドプール数
    async-threads = 5

    # 取得するメトリクスを指定
    subscriptions {
      histogram         = []
      min-max-counter   = []
      gauge             = []
      counter           = []
      trace             = []
      trace-segment     = []
      akka-actor        = []
      akka-dispatcher   = []
      akka-router       = []
      # ヒープのメトリクスだけならこれでOK
      system-metric     = [ "jmx-memory" ]
      http-server       = []
      akka-http-server  = []
    }
  }
}

kamonを必要としないアプリの設定

application.confに以下を追加

play.modules.disabled += "kamon.play.di.GuiceModule"

AWSでの設定

カスタムメトリクスをPutする権限をIAMポリシーに追加

{
  "Version": "2012-10-17",
  "Statement":[{
      "Effect":"Allow",
      "Action":["cloudwatch:PutMetricData"],
      "Resource":"*"
    }]
}

Cloudwatch -> カスタムメトリクスで確認

  • kamon-<アプリ名>があればOK
2
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
2
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?