티스토리 뷰

Elastic Stack

[ APM ] Data Model 과 APM Data

구티맨 2020. 7. 1. 16:45

APM Server 를 구동하고, ElasticSearch를 연동해두면, 아래와 같은 형식의 인덱스들이 저장되어 있는 것을 보게 됩니다.

 

apm-%{[version]}-transaction-%{+yyyy.MM.dd}

apm-%{[version]}-span-%{+yyyy.MM.dd}

apm-%{[version]}-error-%{+yyyy.MM.dd}

apm-%{[version]}-metric-%{+yyyy.MM.dd}

apm-%{[version]}-sourcemap

 

APM 에서 수집되는 데이터를 타입에 따라 분류해서 저장을 하고 있는 것인데 이를 위해서는 먼저 APM Data Model 에 대해서 먼저 알아야 됩니다.

APM Data Model

APM Agent에서는 span, transaction, error, metric 이라는 이벤트로 분류하여 정보를 저장한다.

Transaction

서비스에서 측정할 수 있는 가장 높은 단계의 작업이라고 생각하면 된다. 예를 들면 아래 작업들이다.

  • Request to your server
  • Batch job
  • Background job
  • Custom transaction type

포함하고 있는 정보들은 아래와 같다.

  • The timestamp of the event
  • A unique id, type, and name
  • Data about the environment in which the event is recorded:

    • Service - environment, framework, language, etc.
    • Host - architecture, hostname, IP, etc.
    • Process - args, PID, PPID, etc.
    • URL - full, domain, port, query, etc.
    • User - (if supplied) email, ID, username, etc.

Transaction은 Transaction Overview 화면에서 type과 name으로 그룹이 지어지는데, 이에 대한 자세한 내용은 다른 포스팅을 통해 설명을 하겠습니다.

Span

구체적인 코드 경로의 실행에 대한 정보를 저장하는데, Transaction을 논리적 단위로 나누고 해당 동작의 시작부터 끝 날때 까지의 정보를 저장하고 있고, 다른 span 과의 부모/자식 관계를 가지고 있습니다. 구체적으로 아래의 정보를 저장하고 있습니다.

  • A transaction.id attribute that refers to its parent transaction.
  • A parent.id attribute that refers to its parent span or transaction.
  • Its start time and duration.
  • A name.
  • A type, subtype, and action.
  • An optional stack trace. Stack traces consist of stack frames, which represent a function call on the call stack. They include attributes like function name, file name and path, line number, etc.

Kibana APM UI 를 통해서 span type에 따른 소요시간을 보면, 전체 transaction 시간에서 app(java)에서 걸리는 시간과 db 처리 시간이 나누어져 나오고 있다. Transaction 처리 시간의 87%가 DB, 나머지는 java에서 시간을 잡아먹는 것으로 이해하면 된다.

Error

예외가 발생했을 때, 예외에 대한 최소한의 정보를 가지고 있습니다.

  • Both the captured exception and the captured log of an error can contain a stack trace, which is helpful for debugging.
  • The culprit of an error indicates where it originated.
  • An error might relate to the transaction during which it happened, via the transaction.id.
  • Data about the environment in which the event is recorded:

    • Service - environment, framework, language, etc.
    • Host - architecture, hostname, IP, etc.
    • Process - args, PID, PPID, etc.
    • URL - full, domain, port, query, etc.
    • User - (if supplied) email, ID, username, etc.

Metric

host, system, process level metric을 수집한다.

CPU, System Memory, Heap Memory, Non-Heap Memory Usage 와 Thread Count 가 있다.

참조

https://www.elastic.co/guide/en/apm/server/7.3/exploring-es-data.html

https://www.elastic.co/guide/en/apm/get-started/7.3/apm-data-model.html

 

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함