Elli middleware for collecting stats via Prometheus.
How Elli represents timings:
request_start
headers_start
...headers receiving & parsing...
headers_end
body_start
...body receiving & parsing...
body_end
user_start
...callback code...
user_end
send_start
...sending reply....
send_end
request_end
How Elli represents sizes:
Each request has resp_headers
key and, depending on
response type, resp_body
or file
or chunks
key.
resp_header
is always present and denotes response headers wire size;resp_body
set for regular responses;file
set for file responses;chunks
set for chunked responses, wire size too.
Elli_prometheus exports the following metrics:
-
http_requests_total
, counter. Total count of requests; -
http_request_duration_microseconds
, histogram. The difference betweenrequest_end
andrequest_start
; -
http_request_headers_microseconds
, histogram. The difference betweenheaders_end
andheaders_start
; -
http_request_body_microseconds
, histogram. The difference betweenbody_end
andbody_start
; -
http_request_user_microseconds
, histogram. The difference betweenuser_end
anduser_start
; -
http_request_send_microseconds
, histogram. The difference betweensend_end
andsend_start
; -
http_response_size_bytes
, summary. Total size of the response, includes headers, body|file|chuncks; -
http_response_headers_size_bytes
, summary. Size of the response headers; -
http_response_body_size
, summary. Size of the response body;
For failed requests:
http_requests_failed_total{reason}
, Total count of failed requests. Reasons:request_closed
- the client closes the connection when Elli is waiting for the next request;request_timeout
- the client times out when Elli is waiting for the request;request_parse_error
- the request is invalid and cannot be parsed or it contains a path Elli cannot parse or doesn't support;client_closed
- the client closes the connection or socket closed unexpectedly;client_timeout
- data can't be received within a timeout;bad_request
- Elli detects a request isn't well formatted or doesn't conform to the configured limits.
http_bad_requests_total{reason}
- Total count ofbad_request
errors. Reasons:too_many_headers
;body_size
.
http_client_closed_total{request_part}
- Total count ofclient_closed
errors. Parts:receiving_headers
;receiving_body
;before_response
.
http_client_timeout_total{request_part}
Total count ofclient_timeout
errors. Parts:receiving_headers
;receiving_body
.
Exporter metrics:
-
telemetry_scrape_duration_seconds
Type: summary.
Labels:registry
,content_type
.
Scrape duration. -
telemetry_scrape_size_bytes
Type: summary.
Labels:registry
,content_type
.
Scrape size, not encoded. -
telemetry_scrape_encoded_size_bytes
Type: summary.
Labels:registry
,content_type
,encoding
.
Scrape size, encoded.
elli_prometheus
requires Elli and Prometheus, but neither are included
in this project. It has been tested and is known to work with {elli, "2.0.1"}
and {prometheus, "3.1.1"}
.