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 웹 페이지에는 데이터가 없습니다. 서버를 시작할 필요가 거의 없으며 페이지에 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 |