Как получить метрики (prometheus-nginxlog-exporter) для Nginx arg_ *? - PullRequest
0 голосов
/ 06 апреля 2020

Формат журнала Ngixn:

log_format main '$remote_addr - $remote_user [$time_local] '
                '"$request" $status $body_bytes_sent '
                '"$http_referer" "$http_user_agent" $request_time "$upstream_connect_time" "$upstream_header_time" "$upstream_response_time" '
                'api_key="$arg_api_key"';

После перезагрузки Nginx в файле журнала:

51.89.173.169 - - [03/Apr/2020:13:46:14 +0200] "GET /v1/?api_key=9ed1f3de-e1c3-4c73-bc33-9cd484d1e5ea HTTP/1.1" 200 516 "-" "open" 0.523 "0.004" "0.524" "0.524" api_key="9ed1f3de-e1c3-4c73-bc33-9cd484d1e5ea"

Следующий файл config.yaml для экспортера:

...
namespaces:
  - name: api
    format: "$remote_addr - $remote_user [$time_local] \"$request\" $status $body_bytes_sent \"$http_referer\" \"$http_user_agent\" $request_time \"$upstream_connect_time\" \"$upstream_header_time\" \"$upstream_response_time\" api_key=\"$arg_api_key\""
    source_files:
      - /var/log/nginx/api-access.log
    labels:
      app: "api"
      environment: "production"
    histogram_buckets: [.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10]

Формат от Nginx и формат из конфигурации экспортера идентичны. Но когда я получаю метрики в localhost: 4040 / metrics, я не могу найти никаких метрик с помощью api_key:

# HELP api_http_response_count_total Amount of processed HTTP requests
# TYPE api_http_response_count_total counter
api_http_response_count_total{app="api",environment="production",method="GET",status="200"} 8686
api_http_response_count_total{app="api",environment="production",method="GET",status="204"} 19193
api_http_response_count_total{app="api",environment="production",method="GET",status="400"} 112
api_http_response_count_total{app="api",environment="production",method="GET",status="422"} 10
api_http_response_count_total{app="api",environment="production",method="GET",status="499"} 450
# HELP api_http_response_size_bytes Total amount of transferred bytes
# TYPE api_http_response_size_bytes counter
api_http_response_size_bytes{app="api",environment="production",method="GET",status="200"} 4.083825e+06
api_http_response_size_bytes{app="api",environment="production",method="GET",status="204"} 0
api_http_response_size_bytes{app="api",environment="production",method="GET",status="400"} 2352
api_http_response_size_bytes{app="api",environment="production",method="GET",status="422"} 380
api_http_response_size_bytes{app="api",environment="production",method="GET",status="499"} 0
# HELP api_http_response_time_seconds Time needed by NGINX to handle requests
# TYPE api_http_response_time_seconds summary
api_http_response_time_seconds_sum{app="api",environment="production",method="GET",status="200"} 3172.2189999999914
api_http_response_time_seconds_count{app="api",environment="production",method="GET",status="200"} 8686
api_http_response_time_seconds_sum{app="api",environment="production",method="GET",status="204"} 550.4739999999842
api_http_response_time_seconds_count{app="api",environment="production",method="GET",status="204"} 19191
api_http_response_time_seconds_sum{app="api",environment="production",method="GET",status="400"} 0.5530000000000004
api_http_response_time_seconds_count{app="api",environment="production",method="GET",status="400"} 112
api_http_response_time_seconds_sum{app="api",environment="production",method="GET",status="422"} 0.038
api_http_response_time_seconds_count{app="api",environment="production",method="GET",status="422"} 10
api_http_response_time_seconds_sum{app="api",environment="production",method="GET",status="499"} 106.21899999999988
api_http_response_time_seconds_count{app="api",environment="production",method="GET",status="499"} 450
# HELP api_http_response_time_seconds_hist Time needed by NGINX to handle requests
# TYPE api_http_response_time_seconds_hist histogram
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="0.005"} 0
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="0.01"} 0
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="0.025"} 443
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="0.05"} 1207
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="0.1"} 1385
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="0.25"} 1584
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="0.5"} 5643
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="1"} 8686
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="2.5"} 8686
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="5"} 8686
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="10"} 8686
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="+Inf"} 8686
api_http_response_time_seconds_hist_sum{app="api",environment="production",method="GET",status="200"} 3172.2189999999914
api_http_response_time_seconds_hist_count{app="api",environment="production",method="GET",status="200"} 8686
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="0.005"} 1
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="0.01"} 1
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="0.025"} 11216
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="0.05"} 18448
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="0.1"} 18675
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="0.25"} 18930
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="0.5"} 19177
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="1"} 19193
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="2.5"} 19193
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="5"} 19193
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="10"} 19193
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="+Inf"} 19193
api_http_response_time_seconds_hist_sum{app="api",environment="production",method="GET",status="204"} 550.5209999999842
api_http_response_time_seconds_hist_count{app="api",environment="production",method="GET",status="204"} 19193
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="0.005"} 66
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="0.01"} 111
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="0.025"} 112
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="0.05"} 112
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="0.1"} 112
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="0.25"} 112
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="0.5"} 112
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="1"} 112
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="2.5"} 112
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="5"} 112
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="10"} 112
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="+Inf"} 112
api_http_response_time_seconds_hist_sum{app="api",environment="production",method="GET",status="400"} 0.5530000000000004
api_http_response_time_seconds_hist_count{app="api",environment="production",method="GET",status="400"} 112
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="0.005"} 5
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="0.01"} 10
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="0.025"} 10
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="0.05"} 10
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="0.1"} 10
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="0.25"} 10
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="0.5"} 10
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="1"} 10
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="2.5"} 10
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="5"} 10
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="10"} 10
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="+Inf"} 10
api_http_response_time_seconds_hist_sum{app="api",environment="production",method="GET",status="422"} 0.038
api_http_response_time_seconds_hist_count{app="api",environment="production",method="GET",status="422"} 10
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="499",le="0.005"} 11
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="499",le="0.01"} 25
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="499",le="0.025"} 53
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="499",le="0.05"} 59
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="499",le="0.1"} 117
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="499",le="0.25"} 295
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="499",le="0.5"} 438
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="499",le="1"} 450
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="499",le="2.5"} 450
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="499",le="5"} 450
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="499",le="10"} 450
api_http_response_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="499",le="+Inf"} 450
api_http_response_time_seconds_hist_sum{app="api",environment="production",method="GET",status="499"} 106.21899999999988
api_http_response_time_seconds_hist_count{app="api",environment="production",method="GET",status="499"} 450
# HELP api_http_upstream_time_seconds Time needed by upstream servers to handle requests
# TYPE api_http_upstream_time_seconds summary
api_http_upstream_time_seconds{app="api",environment="production",method="GET",status="200",quantile="0.5"} 0.424
api_http_upstream_time_seconds{app="api",environment="production",method="GET",status="200",quantile="0.9"} 0.524
api_http_upstream_time_seconds{app="api",environment="production",method="GET",status="200",quantile="0.99"} 0.564
api_http_upstream_time_seconds_sum{app="api",environment="production",method="GET",status="200"} 3171.5159999998605
api_http_upstream_time_seconds_count{app="api",environment="production",method="GET",status="200"} 8685
api_http_upstream_time_seconds{app="api",environment="production",method="GET",status="204",quantile="0.5"} 0.02
api_http_upstream_time_seconds{app="api",environment="production",method="GET",status="204",quantile="0.9"} 0.036
api_http_upstream_time_seconds{app="api",environment="production",method="GET",status="204",quantile="0.99"} 0.292
api_http_upstream_time_seconds_sum{app="api",environment="production",method="GET",status="204"} 550.0080000000071
api_http_upstream_time_seconds_count{app="api",environment="production",method="GET",status="204"} 19188
api_http_upstream_time_seconds{app="api",environment="production",method="GET",status="400",quantile="0.5"} 0.004
api_http_upstream_time_seconds{app="api",environment="production",method="GET",status="400",quantile="0.9"} 0.008
api_http_upstream_time_seconds{app="api",environment="production",method="GET",status="400",quantile="0.99"} 0.012
api_http_upstream_time_seconds_sum{app="api",environment="production",method="GET",status="400"} 0.5400000000000004
api_http_upstream_time_seconds_count{app="api",environment="production",method="GET",status="400"} 112
api_http_upstream_time_seconds{app="api",environment="production",method="GET",status="422",quantile="0.5"} 0.004
api_http_upstream_time_seconds{app="api",environment="production",method="GET",status="422",quantile="0.9"} 0.008
api_http_upstream_time_seconds{app="api",environment="production",method="GET",status="422",quantile="0.99"} 0.008
api_http_upstream_time_seconds_sum{app="api",environment="production",method="GET",status="422"} 0.032
api_http_upstream_time_seconds_count{app="api",environment="production",method="GET",status="422"} 10
# HELP api_http_upstream_time_seconds_hist Time needed by upstream servers to handle requests
# TYPE api_http_upstream_time_seconds_hist histogram
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="0.005"} 0
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="0.01"} 0
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="0.025"} 495
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="0.05"} 1193
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="0.1"} 1386
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="0.25"} 1582
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="0.5"} 5998
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="1"} 8686
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="2.5"} 8686
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="5"} 8686
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="10"} 8686
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="200",le="+Inf"} 8686
api_http_upstream_time_seconds_hist_sum{app="api",environment="production",method="GET",status="200"} 3171.9319999998606
api_http_upstream_time_seconds_hist_count{app="api",environment="production",method="GET",status="200"} 8686
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="0.005"} 1
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="0.01"} 1
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="0.025"} 11442
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="0.05"} 18442
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="0.1"} 18676
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="0.25"} 18926
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="0.5"} 19179
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="1"} 19191
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="2.5"} 19191
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="5"} 19191
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="10"} 19191
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="204",le="+Inf"} 19191
api_http_upstream_time_seconds_hist_sum{app="api",environment="production",method="GET",status="204"} 550.0800000000071
api_http_upstream_time_seconds_hist_count{app="api",environment="production",method="GET",status="204"} 19191
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="0.005"} 77
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="0.01"} 109
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="0.025"} 112
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="0.05"} 112
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="0.1"} 112
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="0.25"} 112
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="0.5"} 112
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="1"} 112
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="2.5"} 112
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="5"} 112
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="10"} 112
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="400",le="+Inf"} 112
api_http_upstream_time_seconds_hist_sum{app="api",environment="production",method="GET",status="400"} 0.5400000000000004
api_http_upstream_time_seconds_hist_count{app="api",environment="production",method="GET",status="400"} 112
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="0.005"} 8
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="0.01"} 10
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="0.025"} 10
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="0.05"} 10
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="0.1"} 10
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="0.25"} 10
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="0.5"} 10
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="1"} 10
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="2.5"} 10
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="5"} 10
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="10"} 10
api_http_upstream_time_seconds_hist_bucket{app="api",environment="production",method="GET",status="422",le="+Inf"} 10
api_http_upstream_time_seconds_hist_sum{app="api",environment="production",method="GET",status="422"} 0.032
api_http_upstream_time_seconds_hist_count{app="api",environment="production",method="GET",status="422"} 10
# HELP api_parse_errors_total Total number of log file lines that could not be parsed
# TYPE api_parse_errors_total counter
api_parse_errors_total 0
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 7.0303e-05
go_gc_duration_seconds{quantile="0.25"} 9.0321e-05
go_gc_duration_seconds{quantile="0.5"} 0.000108528
go_gc_duration_seconds{quantile="0.75"} 0.000141313
go_gc_duration_seconds{quantile="1"} 0.000187819
go_gc_duration_seconds_sum 0.006653174
go_gc_duration_seconds_count 58
# HELP go_goroutines Number of goroutines that currently exist.
# TYPE go_goroutines gauge
go_goroutines 20
# HELP go_info Information about the Go environment.
# TYPE go_info gauge
go_info{version="go1.14.1"} 1
# HELP go_memstats_alloc_bytes Number of bytes allocated and still in use.
# TYPE go_memstats_alloc_bytes gauge
go_memstats_alloc_bytes 2.782296e+06
# HELP go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed.
# TYPE go_memstats_alloc_bytes_total counter
go_memstats_alloc_bytes_total 1.0261328e+08
# HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table.
# TYPE go_memstats_buck_hash_sys_bytes gauge
go_memstats_buck_hash_sys_bytes 1.450187e+06
# HELP go_memstats_frees_total Total number of frees.
# TYPE go_memstats_frees_total counter
go_memstats_frees_total 372953
# HELP go_memstats_gc_cpu_fraction The fraction of this program's available CPU time used by the GC since the program started.
# TYPE go_memstats_gc_cpu_fraction gauge
go_memstats_gc_cpu_fraction 0.0017486897047792715
# HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata.
# TYPE go_memstats_gc_sys_bytes gauge
go_memstats_gc_sys_bytes 3.63956e+06
# HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and still in use.
# TYPE go_memstats_heap_alloc_bytes gauge
go_memstats_heap_alloc_bytes 2.782296e+06
# HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used.
# TYPE go_memstats_heap_idle_bytes gauge
go_memstats_heap_idle_bytes 6.16448e+07
# HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use.
# TYPE go_memstats_heap_inuse_bytes gauge
go_memstats_heap_inuse_bytes 4.284416e+06
# HELP go_memstats_heap_objects Number of allocated objects.
# TYPE go_memstats_heap_objects gauge
go_memstats_heap_objects 3431
# HELP go_memstats_heap_released_bytes Number of heap bytes released to OS.
# TYPE go_memstats_heap_released_bytes gauge
go_memstats_heap_released_bytes 5.9375616e+07
# HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system.
# TYPE go_memstats_heap_sys_bytes gauge
go_memstats_heap_sys_bytes 6.5929216e+07
# HELP go_memstats_last_gc_time_seconds Number of seconds since 1970 of last garbage collection.
# TYPE go_memstats_last_gc_time_seconds gauge
go_memstats_last_gc_time_seconds 1.585909696454233e+09
# HELP go_memstats_lookups_total Total number of pointer lookups.
# TYPE go_memstats_lookups_total counter
go_memstats_lookups_total 0
# HELP go_memstats_mallocs_total Total number of mallocs.
# TYPE go_memstats_mallocs_total counter
go_memstats_mallocs_total 376384
# HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures.
# TYPE go_memstats_mcache_inuse_bytes gauge
go_memstats_mcache_inuse_bytes 111104
# HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system.
# TYPE go_memstats_mcache_sys_bytes gauge
go_memstats_mcache_sys_bytes 131072
# HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures.
# TYPE go_memstats_mspan_inuse_bytes gauge
go_memstats_mspan_inuse_bytes 187816
# HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system.
# TYPE go_memstats_mspan_sys_bytes gauge
go_memstats_mspan_sys_bytes 196608
# HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place.
# TYPE go_memstats_next_gc_bytes gauge
go_memstats_next_gc_bytes 4.679424e+06
# HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations.
# TYPE go_memstats_other_sys_bytes gauge
go_memstats_other_sys_bytes 2.856749e+06
# HELP go_memstats_stack_inuse_bytes Number of bytes in use by the stack allocator.
# TYPE go_memstats_stack_inuse_bytes gauge
go_memstats_stack_inuse_bytes 1.114112e+06
# HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator.
# TYPE go_memstats_stack_sys_bytes gauge
go_memstats_stack_sys_bytes 1.114112e+06
# HELP go_memstats_sys_bytes Number of bytes obtained from system.
# TYPE go_memstats_sys_bytes gauge
go_memstats_sys_bytes 7.5317504e+07
# HELP go_threads Number of OS threads created.
# TYPE go_threads gauge
go_threads 23
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 3.66
# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1024
# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 12
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 1.7424384e+07
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1.58590969104e+09
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 2.324307968e+09
# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.
# TYPE process_virtual_memory_max_bytes gauge
process_virtual_memory_max_bytes -1
# HELP promhttp_metric_handler_requests_in_flight Current number of scrapes being served.
# TYPE promhttp_metric_handler_requests_in_flight gauge
promhttp_metric_handler_requests_in_flight 1
# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code.
# TYPE promhttp_metric_handler_requests_total counter
promhttp_metric_handler_requests_total{code="200"} 0
promhttp_metric_handler_requests_total{code="500"} 0
promhttp_metric_handler_requests_total{code="503"} 0

Моя задача состоит в том, чтобы получать среднее количество запросов в секунду для каждого api_key. Что я делаю не так?

...