Ralph Ursprung created HTTPCLIENT-2435:
------------------------------------------

             Summary: httpclient5-observation: opt-in request/response body 
size distribution metrics
                 Key: HTTPCLIENT-2435
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2435
             Project: HttpComponents HttpClient
          Issue Type: Improvement
            Reporter: Ralph Ursprung


{{httpclient5-observation}} has no way to record the distribution of HTTP
request and response body sizes. The existing {{IO}} metric set
({{IoByteCounterExec}} / {{AsyncIoByteCounterExec}}) records only cumulative
{{Counter}}s ({{<prefix>.request.bytes}}, {{<prefix>.response.bytes}}). Counters
show total throughput, but not the size of single requests (for example,
how large bulk requests to a search cluster are, or how many responses are
larger than 10 MB).

Micrometer users asked for this for a long time 
([micrometer#880|https://github.com/micrometer-metrics/micrometer/issues/880]). 
The Micrometer team said that this must be done in each HTTP library, not at 
framework level, because only the library knows when the length is known and 
whether compression is applied ([see 
comment|https://github.com/micrometer-metrics/micrometer/issues/880#issuecomment-1625381050]).
 Micrometer's own HttpClient 5 binder is deprecated since Micrometer 1.17.0 in 
favor of {{httpclient5-observation}} 
([micrometer#7158|https://github.com/micrometer-metrics/micrometer/issues/7158]),
 so the
feature belongs in this module.

Proposal:

* New opt-in {{ObservingOptions.MetricSet.BODY_SIZE}}.
* New interceptors {{BodySizeExec}} (classic) and {{AsyncBodySizeExec}} (async).
* Meters {{<prefix>.request.body.size}} and {{<prefix>.response.body.size}},
  {{DistributionSummary}}, base unit bytes. With the default prefix the names
  are the OpenTelemetry names {{http.client.request.body.size}} and
  {{http.client.response.body.size}}.
* Tags are the same as for the request timer.
* Sizes come from the declared content length only. Nothing is recorded if
  the length is unknown. No wrapping or buffering of entities.
* No change to existing meters, APIs or default behavior. 



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to