Closed nictrix closed 3 years ago
Adds prometheus metrics endpoint and http middleware for basic statistics from: https://github.com/slok/go-http-metrics
go_gc_duration_seconds{quantile="0"} 3.6638e-05 go_gc_duration_seconds{quantile="0.25"} 3.6638e-05 go_gc_duration_seconds{quantile="0.5"} 0.000196271 go_gc_duration_seconds{quantile="0.75"} 0.000196271 go_gc_duration_seconds{quantile="1"} 0.000196271 go_gc_duration_seconds_sum 0.000232909 go_gc_duration_seconds_count 2 go_goroutines 12 go_info{version="go1.16.2"} 1 go_memstats_alloc_bytes 2.455176e+06 go_memstats_alloc_bytes_total 5.48844e+06 go_memstats_buck_hash_sys_bytes 1.448337e+06 go_memstats_frees_total 19611 go_memstats_gc_cpu_fraction 9.343727681883547e-05 go_memstats_gc_sys_bytes 5.238272e+06 go_memstats_heap_alloc_bytes 2.455176e+06 go_memstats_heap_idle_bytes 6.1997056e+07 go_memstats_heap_inuse_bytes 4.456448e+06 go_memstats_heap_objects 18070 go_memstats_heap_released_bytes 6.1833216e+07 go_memstats_heap_sys_bytes 6.6453504e+07 go_memstats_last_gc_time_seconds 1.616545425130037e+09 go_memstats_lookups_total 0 go_memstats_mallocs_total 37681 go_memstats_mcache_inuse_bytes 9600 go_memstats_mcache_sys_bytes 16384 go_memstats_mspan_inuse_bytes 116008 go_memstats_mspan_sys_bytes 131072 go_memstats_next_gc_bytes 4.194304e+06 go_memstats_other_sys_bytes 1.637495e+06 go_memstats_stack_inuse_bytes 655360 go_memstats_stack_sys_bytes 655360 go_memstats_sys_bytes 7.5580424e+07 go_threads 13 http_request_duration_seconds_bucket{code="400",handler="/",method="GET",service="",le="0.005"} 7 http_request_duration_seconds_bucket{code="400",handler="/",method="GET",service="",le="0.01"} 7 http_request_duration_seconds_bucket{code="400",handler="/",method="GET",service="",le="0.025"} 7 http_request_duration_seconds_bucket{code="400",handler="/",method="GET",service="",le="0.05"} 7 http_request_duration_seconds_bucket{code="400",handler="/",method="GET",service="",le="0.1"} 7 http_request_duration_seconds_bucket{code="400",handler="/",method="GET",service="",le="0.25"} 7 http_request_duration_seconds_bucket{code="400",handler="/",method="GET",service="",le="0.5"} 7 http_request_duration_seconds_bucket{code="400",handler="/",method="GET",service="",le="1"} 7 http_request_duration_seconds_bucket{code="400",handler="/",method="GET",service="",le="2.5"} 7 http_request_duration_seconds_bucket{code="400",handler="/",method="GET",service="",le="5"} 7 http_request_duration_seconds_bucket{code="400",handler="/",method="GET",service="",le="10"} 7 http_request_duration_seconds_bucket{code="400",handler="/",method="GET",service="",le="+Inf"} 7 http_request_duration_seconds_sum{code="400",handler="/",method="GET",service=""} 0.002136677 http_request_duration_seconds_count{code="400",handler="/",method="GET",service=""} 7 http_requests_inflight{handler="/",service=""} 0 http_response_size_bytes_bucket{code="400",handler="/",method="GET",service="",le="100"} 0 http_response_size_bytes_bucket{code="400",handler="/",method="GET",service="",le="1000"} 7 http_response_size_bytes_bucket{code="400",handler="/",method="GET",service="",le="10000"} 7 http_response_size_bytes_bucket{code="400",handler="/",method="GET",service="",le="100000"} 7 http_response_size_bytes_bucket{code="400",handler="/",method="GET",service="",le="1e+06"} 7 http_response_size_bytes_bucket{code="400",handler="/",method="GET",service="",le="1e+07"} 7 http_response_size_bytes_bucket{code="400",handler="/",method="GET",service="",le="1e+08"} 7 http_response_size_bytes_bucket{code="400",handler="/",method="GET",service="",le="1e+09"} 7 http_response_size_bytes_bucket{code="400",handler="/",method="GET",service="",le="+Inf"} 7 http_response_size_bytes_sum{code="400",handler="/",method="GET",service=""} 1687 http_response_size_bytes_count{code="400",handler="/",method="GET",service=""} 7 promhttp_metric_handler_requests_in_flight 1 promhttp_metric_handler_requests_total{code="200"} 6 promhttp_metric_handler_requests_total{code="500"} 0 promhttp_metric_handler_requests_total{code="503"} 0
Added basic unit test to make sure middleware is registering and displaying the http_ data
ok github.com/cruise-automation/k-rail/v3/server (cached) coverage: 39.7% of statements
Adds prometheus metrics endpoint and http middleware for basic statistics from: https://github.com/slok/go-http-metrics
Added basic unit test to make sure middleware is registering and displaying the http_ data