Dianping CAT
Dianping-cat(Cat)は、パフォーマンス、容量、ビジネスメトリクスを監視するオープンソースの分散リアルタイム監視システムです。Meituan Dianping が開発し、公開後は広く利用されています。
Cat は CPU、メモリ、ネットワーク、ディスクなどのメトリクスを収集してリアルタイムに監視・分析し、開発者による迅速な問題の特定と解決を支援します。アラート、統計、ログ分析などの機能も提供します。
データ型¶
データ転送プロトコル:
- plaintext:プレーンテキスト形式。DataKit は現在未対応です。
- native:特定の記号を区切り文字とするテキスト形式。DataKit は対応済みです。
データ分類:
| データ型の略称 | 型 | 説明 | 現在の DataKit バージョンでの対応 | Guance でのデータ型 |
|---|---|---|---|---|
| t | transaction start | トランザクション開始 | true | trace |
| T | transaction end | トランザクション終了 | true | trace |
| E | event | イベント | false | - |
| M | metric | カスタムメトリクス | false | - |
| L | trace | トレース | false | - |
| H | heartbeat | ハートビート | true | メトリクス |
クライアントの起動モード¶
-
cat server を起動するモード
- データはすべて DataKit にあり、cat の Web ページにはデータがなくなるため、起動する意義はあまりありません。ページには CAT サーバーで問題が発生 [xxx.xxx] と表示されます。
- クライアントの動作は起動時に設定できます。
- cat server も transaction データを dk に送信するため、Guance のページに不要なデータが大量に表示されます。
-
cat server を起動しない場合:DataKit で設定します。
startTransactionTypes:Cat が自動作成するカスタムトランザクション型を定義します。複数の型はセミコロンで区切ります。block:ブロッキング監視のしきい値(ミリ秒)です。トランザクションの実行時間が超過すると、Cat がブロッキング状況を記録します。routers:Cat サーバーのアドレスとポートです。複数はセミコロンで区切ります。Cat は信頼性と耐障害性を確保するため、これらのサーバーにデータを自動送信します。sample:サンプリング率(0~1)です。1 はすべてのデータを Cat サーバーへ送信し、0 は送信しません。matchTransactionTypes:カスタムトランザクション型のマッチングルールです。主に API 監視で、性能を監視するインターフェースを指定します。
そのため、cat_home(cat server)サービスの起動は推奨しません。必要な設定は以下のように client.xml で行えます。
設定¶
クライアント設定¶
<?xml version="1.0" encoding="utf-8"?>
<config mode="client">
<servers>
<!-- datakit ip, cat port , http port -->
<server ip="10.200.6.16" port="2280" http-port="9529"/>
</servers>
</config>
注:9529 は DataKit の HTTP ポート、2280 は cat コレクターが使用するポートです。
コレクター設定¶
DataKit のインストール先の conf.d/samples で、cat.conf.sample をコピーして cat.conf とします。設定例:
[[inputs.cat]]
## tcp port
tcp_port = "2280"
##native or plaintext, datakit only support native(NT1) !!!
decode = "native"
## This is default cat-client Kvs configs.
startTransactionTypes = "Cache.;Squirrel."
MatchTransactionTypes = "SQL"
block = "false"
routers = "127.0.0.1:2280;"
sample = "1.0"
## global tags.
# [inputs.cat.tags]
# key1 = "value1"
# key2 = "value2"
# ...
設定後、DataKit を再起動します。
ConfigMap で設定を注入してコレクターを有効にできます。
設定ファイルの注意点:
startTransactionTypesMatchTransactionTypesblockrouterssampleはクライアントに返すデータです。routersは DataKit の IP またはドメイン名です。tcp_portはクライアント側の servers の IP アドレス設定に対応します。
Tracing¶
cat¶
Following is tags/fields of tracing data
| Tags & Fields | Description |
|---|---|
| base_service ( tag) |
Span base service name |
| container_host ( tag) |
Container hostname. Available in OpenTelemetry. Optional. |
| db_host ( tag) |
DB host name: ip or domain name. Optional. |
| db_name ( tag) |
Database name. Optional. |
| db_system ( tag) |
Database system name:mysql,oracle... Optional. |
| dk_fingerprint ( tag) |
DataKit fingerprint(always DataKit's hostname) |
| endpoint ( tag) |
Endpoint info. Available in SkyWalking, Zipkin. Optional. |
| env ( tag) |
Application environment info. Available in Jaeger. Optional. |
| host ( tag) |
Hostname. |
| http_method ( tag) |
HTTP request method name. Available in DDTrace, OpenTelemetry. Optional. |
| http_route ( tag) |
HTTP route. Optional. |
| http_status_code ( tag) |
HTTP response code. Available in DDTrace, OpenTelemetry. Optional. |
| http_url ( tag) |
HTTP URL. Optional. |
| operation ( tag) |
Span name |
| out_host ( tag) |
This is the database host, equivalent to db_host,only DDTrace-go. Optional. |
| project ( tag) |
Project name. Available in Jaeger. Optional. |
| service ( tag) |
Service name. Optional. |
| source_type ( tag) |
Tracing source type |
| span_type ( tag) |
Span type |
| status ( tag) |
Span status |
| version ( tag) |
Application version info. Available in Jaeger. Optional. |
| duration | Duration of span Type: int | (gauge) Unit: time,μs |
| message | Origin content of span Type: string Unit: N/A |
| parent_id | Parent span ID of current span Type: string Unit: N/A |
| resource | Resource name produce current span Type: string Unit: N/A |
| span_id | Span id Type: string Unit: N/A |
| start | start time of span. Type: int | (gauge) Unit: timeStamp,usec |
| trace_id | Trace id Type: string Unit: N/A |
Metric¶
Metric cat¶
CAT heartbeat runtime, operating system, disk, memory, and thread metrics emitted from application heartbeat XML payloads.
| Tags & Fields | Description |
|---|---|
| domain ( tag) |
CAT application domain. |
| hostName ( tag) |
Host name reported by CAT. |
| memory_gc_name ( tag) |
Garbage collector name for CAT GC points. |
| os_arch ( tag) |
CPU architecture such as AMD64 or ARM. |
| os_name ( tag) |
Operating system name on OS points; reused as disk volume ID on CAT disk points. |
| os_version ( tag) |
OS or kernel version. |
| runtime_java-version ( tag) |
Java version. |
| runtime_user-dir ( tag) |
User working directory reported in the CAT runtime block. |
| runtime_user-name ( tag) |
User name. |
| disk_free | Free disk size of the reported disk volume. Type: float | (gauge) Unit: digital,B Tagged by: domain, hostName, os_name |
| disk_total | Total disk size of the reported disk volume. Type: float | (gauge) Unit: digital,B Tagged by: domain, hostName, os_name |
| disk_usable | Usable disk size of the reported disk volume. Type: float | (gauge) Unit: digital,B Tagged by: domain, hostName, os_name |
| memory_free | Current free JVM memory size. Type: float | (gauge) Unit: count Tagged by: domain, hostName |
| memory_gc_count | Garbage collection count reported for the named GC. Type: int | (gauge) Unit: count Tagged by: domain, hostName, memory_gc_name |
| memory_gc_time | Garbage collection time reported for the named GC, in milliseconds. Type: int | (gauge) Unit: time,ms Tagged by: domain, hostName, memory_gc_name |
| memory_heap-usage | Used JVM heap memory. Type: float | (gauge) Unit: count Tagged by: domain, hostName |
| memory_max | Maximum JVM memory size. Type: float | (gauge) Unit: count Tagged by: domain, hostName |
| memory_non-heap-usage | Used JVM non-heap memory. Type: float | (gauge) Unit: count Tagged by: domain, hostName |
| memory_total | Current total JVM memory size. Type: float | (gauge) Unit: count Tagged by: domain, hostName |
| os_available-processors | The number of available processors in the host. Type: float | (gauge) Unit: count Tagged by: domain, hostName, os_arch, os_name, os_version |
| os_committed-virtual-memory | Committed virtual memory size. Type: float | (gauge) Unit: digital,B Tagged by: domain, hostName, os_arch, os_name, os_version |
| os_free-physical-memory | Free physical memory size. Type: float | (gauge) Unit: digital,B Tagged by: domain, hostName, os_arch, os_name, os_version |
| os_free-swap-space | Free swap space size Type: float | (gauge) Unit: digital,B Tagged by: domain, hostName, os_arch, os_name, os_version |
| os_system-load-average | Average system load. Type: float | (gauge) Unit: percent,percent Tagged by: domain, hostName, os_arch, os_name, os_version |
| os_total-physical-memory | Total physical memory size. Type: float | (gauge) Unit: digital,B Tagged by: domain, hostName, os_arch, os_name, os_version |
| os_total-swap-space | Total swap space size. Type: float | (gauge) Unit: digital,B Tagged by: domain, hostName, os_arch, os_name, os_version |
| runtime_start-time | JVM start time reported by CAT, as a Unix timestamp in seconds. Type: int | (gauge) Unit: time,s Tagged by: domain, hostName, runtime_java-version, runtime_user-dir, runtime_user-name |
| runtime_up-time | JVM uptime reported by CAT, in milliseconds. Type: int | (gauge) Unit: time,ms Tagged by: domain, hostName, runtime_java-version, runtime_user-dir, runtime_user-name |
| thread_cat_thread_count | The number of threads used by CAT. Type: float | (gauge) Unit: count Tagged by: domain, hostName |
| thread_count | Total number of threads. Type: float | (gauge) Unit: count Tagged by: domain, hostName |
| thread_daemon_count | The number of daemon threads. Type: float | (gauge) Unit: count Tagged by: domain, hostName |
| thread_http_thread_count | The number of HTTP threads. Type: float | (gauge) Unit: count Tagged by: domain, hostName |
| thread_peek_count | Peak thread count. Type: float | (gauge) Unit: count Tagged by: domain, hostName |
| thread_pigeon_thread_count | The number of Pigeon threads. Type: float | (gauge) Unit: count Tagged by: domain, hostName |
| thread_total_started_count | Total number of started threads. Type: float | (gauge) Unit: count Tagged by: domain, hostName |