smithy-lang / smithy-kotlin

Smithy code generator for Kotlin (in development)
Apache License 2.0
72 stars 26 forks source link

feat: support for OkHttp thread metrics #1022

Open ianbotsf opened 6 months ago

ianbotsf commented 6 months ago

Issue \

894

Description of changes

This change adds metrics for the OkHttp engine's thread pool. It should be considered WIP until the following open questions are addressed:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

lauzadis commented 6 months ago
  1. I think unit tests for the metrics being emitted would be a good start. I'm not sure, is it easy to change the number of active threads in the OkHttp client, or is it more an internal implementation detail in the engine? If the latter, I think it would be sufficient to just check that the metrics are being emitted.
  2. It would be nice to have both engines' metrics aligned but it can probably be solved on the longer term
  3. I think it's a good idea
ianbotsf commented 6 months ago
  1. I think unit tests for the metrics being emitted would be a good start. I'm not sure, is it easy to change the number of active threads in the OkHttp client, or is it more an internal implementation detail in the engine? If the latter, I think it would be sufficient to just check that the metrics are being emitted.

To be clear, you mean verify that a metric value exists but not what it is? Because this is multi-threaded behavior and we don't control the implementation of the underlying thread pool, it'll be difficult to achieve a stable expectation for number of total/active threads in a test case.

lauzadis commented 6 months ago
  1. I think unit tests for the metrics being emitted would be a good start. I'm not sure, is it easy to change the number of active threads in the OkHttp client, or is it more an internal implementation detail in the engine? If the latter, I think it would be sufficient to just check that the metrics are being emitted.

To be clear, you mean verify that a metric value exists but not what it is? Because this is multi-threaded behavior and we don't control the implementation of the underlying thread pool, it'll be difficult to achieve a stable expectation for number of total/active threads in a test case.

Yes, just testing that a metric value exists if we don't have predictable behavior to test on.

sonarcloud[bot] commented 5 months ago

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud