In a previous change, we took a first stab at using the new API to
record some new metrics.
61
This change takes a second stab at using the new API.
We introduce an InstrumentedEventListener that records metrics
derived from the EventListener's events. The instrumented listener
ensures it properly delegates to any event listener that was previously
configured; this is required as only one event listener can be
configured on a client.
With this change, the following metrics are now being collected:
We avoid introducing metrics for more granular things like request
header parsing, response body parsing, and HTTPS connection setup.
Those will be added upon request.
Some of these new EventListener metrics duplicate the purpose of some
existing OkHttpClient metrics. This is fine for now. In the future,
we may shift 100% of the metrics to the EventListener API if we can.
OkHttp previewed a new
EventListener
API in v3.9. It became stable in 3.11.In a previous change, we took a first stab at using the new API to record some new metrics.
61
This change takes a second stab at using the new API.
We introduce an
InstrumentedEventListener
that records metrics derived from theEventListener
's events. The instrumented listener ensures it properly delegates to any event listener that was previously configured; this is required as only one event listener can be configured on a client.With this change, the following metrics are now being collected:
We avoid introducing metrics for more granular things like request header parsing, response body parsing, and HTTPS connection setup. Those will be added upon request.
Some of these new
EventListener
metrics duplicate the purpose of some existingOkHttpClient
metrics. This is fine for now. In the future, we may shift 100% of the metrics to theEventListener
API if we can.This change is easier to review commit-by-commit.
Closes #58