◾️はじめに
https://dk521123.hatenablog.com/entry/2025/06/08/011248
の続き。 今回は、datadog の Arithmetic Processor について、メモ。
目次
【1】Arithmetic Processor / 算術演算プロセッサー 1)作成方法 【2】使用可能な記号 / 演算子 【3】使用上の注意 1)小数点の扱い 2)演算子 - 【4】Tips:「Replace missing attribute by 0」
【1】Arithmetic Processor / 算術演算プロセッサー
* 指定された式の結果を含む新しい属性を追加できる => これにより、ログフォーマットを変更せずに属性追加可能に、、、 cf. Arithmetic(アリスメティック) = 算術
1)作成方法
* 以下の公式ドキュメントの「算術演算プロセッサーの例」も参照
| # | Items | Explanations | Example |
|---|---|---|---|
| [1] | Select the processor type | プロセッサータイプの選択(「Arithmetic Processor」で固定) | Arithmetic Processor |
| [2] | Name the processor type | プロセッサー名の入力 | Demo Processor |
| [3] | Set the target attribute | 計算結果を格納する属性名 | demo_result_rate |
| [4] | Set the formula | 計算式 | (100 * demo_value) / demo_total |
| - | Replace missing attribute by 0 | 値がない場合0で置き換えるか?(詳細は「【4】Tips:「Replace missing attribute by 0」」を参照) | チェックつける |
【2】使用可能な記号 / 演算子
以下が使用可能。 * 括弧 * 基本的な算術演算子( -、+、*、/ )
【3】使用上の注意
1)小数点の扱い
* 結果は小数第 9 位に丸められる => e.g. 式の結果が 0.1234567891 の場合、0.123456789 * 四捨五入はできない => round(xxx, 3) みたいなことができるって AIが言ってたけど実際やったらできなかった
2)演算子 -
* 属性名にも使用されるため、式内ではスペースで区切る必要がある
【4】Tips:「Replace missing attribute by 0」
* 作成時に「Replace missing attribute by 0」にチェックをつけると 属性値がない場合は自動的に 0 を補ってくれる
関連記事
datadog ~ 基礎知識編 ~
https://dk521123.hatenablog.com/entry/2024/03/30/004746
datadog ~ 属性/ファセット/属性検索@ ~
https://dk521123.hatenablog.com/entry/2025/02/26/150349
datadog ~ タグ ~
https://dk521123.hatenablog.com/entry/2025/02/27/002502
datadog pipeline ~ 基礎知識編 ~
https://dk521123.hatenablog.com/entry/2025/04/14/145556
datadog pipeline ~ 入門編 ~
https://dk521123.hatenablog.com/entry/2025/06/04/221715
datadog dashboard ~ 入門編 ~
https://dk521123.hatenablog.com/entry/2025/02/09/000106
datadog Logs ~ 入門編 ~
https://dk521123.hatenablog.com/entry/2025/02/14/200308
datadog Logs ~ 基本編 ~
https://dk521123.hatenablog.com/entry/2025/02/15/213417
datadog Logs ~ Array processor / 配列プロセッサー ~
https://dk521123.hatenablog.com/entry/2025/06/08/011248
datadog Alert ~ 入門編 ~
https://dk521123.hatenablog.com/entry/2025/02/16/232413