![[17.0.0.3 and later]](../ng_v17003plus.gif)
MicroProfile 메트릭 REST API
mpMetrics-1.0 및 mpMetrics-1.1 기능은 관리자가 액세스할 수 있는 메트릭을 표시하는 REST API를 제공합니다.
형식
- Prometheus 텍스트 형식
- Prometheus 모니터링 도구와 호환 가능한 메트릭의 표시입니다. 이 형식은 text/plain 승인 헤더가 있는 요청에 대해 리턴됩니다.
- JSON 형식
- 메트릭의 JSON 표시입니다. 이 형식은 application/json 승인 헤더가 있는 요청에 대해 리턴됩니다.
REST 엔드포인트
엔드포인트 | 요청 유형 | 지원되는 형식 | 설명 |
---|---|---|---|
/metrics | GET | JSON, Prometheus | 등록된 모든 메트릭을 리턴합니다. |
/metrics/<scope> | GET | JSON, Prometheus | 각 범위에 대해 등록된 메트릭을 리턴합니다. |
/metrics/<scope>/<metric name> | GET | JSON, Prometheus | 각 범위의 메트릭 이름과 일치하는 메트릭을 리턴합니다. |
/metrics | OPTIONS | JSON | 등록된 모든 메타데이터를 리턴합니다. |
/metrics/<scope> | OPTIONS | JSON | 각 범위에 대해 등록된 메트릭 메타데이터를 리턴합니다. |
/metrics/<scope>/<metric name> | OPTIONS | JSON | 각 범위의 메트릭 이름과 일치하는 메트릭 메타데이터를 리턴합니다. |
데이터 저장소 및 모니터링 도구에 연결
관리자는 메트릭 정보를 분석하고 모니터링할 수 있는 다른 도구 및 스택에 애플리케이션 메트릭을 연결할 수 있습니다.
기본적으로 /metrics 엔드포인트는 Prometheus와 호환 가능한 형식으로 데이터를 리턴합니다. Liberty 서버를 Prometheus에 연결하려면 https://host:https_port/metrics 엔드포인트를 사용하도록 Prometheus를 구성하십시오.
JSON 형식은 JSON을 이해하는 다른 메트릭 콜렉션 도구에서 사용할 수 있습니다. 예를 들어, collectd curl_json 플러그인을 구성하여 MicroProfile 메트릭에서 JSON 형식을 해석할 수 있습니다. 그런 다음 collectd는 Graphite와 같은 각기 다른 여러 도구에 정보를 전달할 수 있습니다.
Prometheus 형식 세부사항
Prometheus 텍스트 형식은 Prometheus 문서에 설명된 0.0.4 노출 형식을 기반으로 합니다. 가능한 경우 각 메트릭에 대한 메타데이터가 제공됩니다. # Help 행에는 메트릭에 대한 설명이 포함되어 있습니다. 메타데이터에 있는 모든 태그는 Prometheus 레이블로 제공됩니다. 메트릭의 단위는 게이지 및 히스토그램의 메트릭 이름 끝에 추가됩니다.
# TYPE application:cost_dollars gauge
# HELP application:cost_dollars The running cost of the server in dollars.
application:cost_dollars 80
# TYPE application:visitors counter
# HELP application:visitors The number of unique visitors
application:visitors 80
# TYPE application:requests_count counter
# HELP application:requests_count Tracks the number of requests to the server
application:requests_count 29382
# TYPE application:requests_rate_per_second gauge
application:requests_rate_per_second 12.223
# TYPE application:requests_one_min_rate_per_second gauge
application:requests_one_min_rate_per_second 12.563
# TYPE application:requests_five_min_rate_per_second gauge
application:requests_five_min_rate_per_second 12.364
# TYPE application:requests_fifteen_min_rate_per_second gauge
application:requests_fifteen_min_rate_per_second 12.126
# TYPE application:file_sizes_mean_bytes gauge
application:file_sizes_mean_bytes 4738.231
# TYPE application:file_sizes_max_bytes gauge
application:file_sizes_max_bytes 31716
# TYPE application:file_sizes_min_bytes gauge
application:file_sizes_min_bytes 180
# TYPE application:file_sizes_stddev_bytes gauge
application:file_sizes_stddev_bytes 1054.7343037063602
# TYPE application:file_sizes_bytes summary
# HELP application:file_sizes_bytes Users file size
application:file_sizes_bytes_count 2037
application:file_sizes_bytes{quantile="0.5"} 4201
application:file_sizes_bytes{quantile="0.75"} 6175
application:file_sizes_bytes{quantile="0.95"} 13560
application:file_sizes_bytes{quantile="0.98"} 29643
application:file_sizes_bytes{quantile="0.99"} 31716
application:file_sizes_bytes{quantile="0.999"} 31716
# TYPE application:response_time_rate_per_second gauge
application:response_time_rate_per_second 0.004292520715985437
# TYPE application:response_time_one_min_rate_per_second gauge
application:response_time_one_min_rate_per_second 2.794076465421066E-14
# TYPE application:response_time_five_min_rate_per_second gauge
application:response_time_five_min_rate_per_second 4.800392614619373E-4
# TYPE application:response_time_fifteen_min_rate_per_second gauge
application:response_time_fifteen_min_rate_per_second 0.01063191047532505
# TYPE application:response_time_mean_seconds gauge
application:response_time_mean_seconds 0.000415041
# TYPE application:response_time_max_seconds gauge
application:response_time_max_seconds 0.0005608694
# TYPE application:response_time_min_seconds gauge
application:response_time_min_seconds 0.000169916
# TYPE application:response_time_stddev_seconds gauge
application:response_time_stddev_seconds 0.000652907
# TYPE application:response_time_seconds summary
# HELP application:response_time_seconds Server response time for /index.html
application:response_time_seconds_count 80
application:response_time_seconds{quantile="0.5"} 0.0002933240
application:response_time_seconds{quantile="0.75"} 0.000344914
application:response_time_seconds{quantile="0.95"} 0.000543647
application:response_time_seconds{quantile="0.98"} 0.002706543
application:response_time_seconds{quantile="0.99"} 0.005608694
application:response_time_seconds{quantile="0.999"} 0.005608694
JSON 형식 세부사항 - GET
JSON 형식은 트리에서 형식화된 데이터를 리턴합니다. 각 메트릭은 이름과 게이지 및 카운터의 값 또는 미터, 히스토그램 및 타이머의 맵에서 참조합니다.
{
"application": {
"hitCount": 45
},
"base": {
"thread.count" : 33,
"thread.max.count" : 47
},
"vendor": {...}
}
{
"hitCount": 45
}
{
"requests": {
"count": 29382,
"meanRate": 12.223,
"oneMinRate": 12.563,
"fiveMinRate": 12.364,
"fifteenMinRate": 12.126,
}
}
이 예제에는 다음 키가 있습니다. 키 | 값 |
---|---|
count | 이벤트 수의 계수입니다. |
meanRate | 메트릭이 등록된 이후 평균 비율(초당 이벤트 수)입니다. |
oneMinRate | 마지막 1분 동안의 평균 속도(초당 이벤트 수)입니다. |
fiveMinRate | 지난 5분 동안의 평균 속도(초당 이벤트 수)입니다. |
fifteenMinRate | 마지막 15분 동안의 평균 속도(초당 이벤트 수)입니다. |
{
"file_sizes": {
"count":2,
"min":-1624,
"max":26,
"mean":-799.0,
"stddev":825.0,
"p50":26.0,
"p75":26.0,
"p95":26.0,
"p98":26.0,
"p99":26.0,
"p999":26.0
}
}
이 예제에는 다음 키가 있습니다. 키 | 값 |
---|---|
count | 이벤트 수의 계수입니다. |
min | 기록된 최소값입니다. |
max | 기록된 최대값입니다. |
mean | 평균 값입니다. |
stddev | 표준 편차입니다. |
p50 | 중앙값과 같은 50번째 백분위수의 값입니다. |
p75 | 75번째 백분위수의 값입니다. |
p95 | 95번째 백분위수의 값입니다. |
p98 | 98번째 백분위수의 값입니다. |
p99 | 99번째 백분위수의 값입니다. |
p999 | 999번째 백분위수의 값입니다. |
{
"responseTime": {
"count": 29382,
"meanRate":12.185627192860734,
"oneMinRate": 12.563,
"fiveMinRate": 12.364,
"fifteenMinRate": 12.126,
"min":169916,
"max":5608694,
"mean":415041.00024926325,
"stddev":652907.9633011606,
"p50":293324.0,
"p75":344914.0,
"p95":543647.0,
"p98":2706543.0,
"p99":5608694.0,
"p999":5608694.0
}
}
키 | 값 |
---|---|
count | 이벤트 수의 계수입니다. |
meanRate | 메트릭이 등록된 이후 평균 비율(초당 이벤트 수)입니다. |
oneMinRate | 마지막 1분 동안의 평균 속도(초당 이벤트 수)입니다. |
fiveMinRate | 지난 5분 동안의 평균 속도(초당 이벤트 수)입니다. |
fifteenMinRate | 마지막 15분 동안의 평균 속도(초당 이벤트 수)입니다. |
min | 기록된 최소값입니다. |
max | 기록된 최대값입니다. |
mean | 평균 값입니다. |
stddev | 표준 편차입니다. |
p50 | 중앙값과 같은 50번째 백분위수의 값입니다. |
p75 | 75번째 백분위수의 값입니다. |
p95 | 95번째 백분위수의 값입니다. |
p98 | 98번째 백분위수의 값입니다. |
p99 | 99번째 백분위수의 값입니다. |
p999 | 999번째 백분위수의 값입니다. |
JSON 형식 세부사항 - OPTIONS
{
"fooVal": 12345,
"barVal": 42
}
OPTIONS
/metrics/application이 표시됩니다.{
"fooVal": {
"unit": "milliseconds",
"type": "gauge",
"description": "The average duration of foo requests during last 5 minutes",
"displayName": "Duration of foo",
"tags": "app=webshop"
},
"barVal": {
"unit": "megabytes",
"type": "gauge",
"tags": "component=backend,app=webshop"
}
}