Slide 9
Slide 9 text
Settings
● Datadog 側の設定
○ 私たちのユースケースでは、以下のような設定を⾏いました
init_config:
instances:
- dbm: true
host: ""
port: "5432"
username: "datadog"
password: ""
custom_queries:
- metric_prefix: outbox
query: SELECT COALESCE(MAX(EXTRACT(EPOCH
FROM AGE(CURRENT_TIMESTAMP, occurred_at))), 0) AS
max_processing_delay FROM outbox WHERE
is_published = false
columns:
- name: max_processing_delay
type: gauge
tags:
- query:custom
tags:
- env:
● metrics 名は outbox.max_processing_delay
● outbox テーブルで is_published = false である
⾏から、最⼤処理遅延(秒)を計算‧返却させる
● is_published = false が 0 件であるとき、No
Data ではなく、最⼤処理遅延時間は 0 として扱
いたいので、COALESCE 関数で null ではなく 0
を返却させる
● custom_queries 単位で custom metrics である
ことを⽰す tag を指定し、instances 単位で発⽣
環境を⽰す tag を指定することで、metrics を
切り分けやすくする