grafana-toolbox / grafana-client

Python client library for accessing the Grafana HTTP API.
MIT License
106 stars 30 forks source link

Feature Request: Ability to adjust niquest session pool size #189

Open sjoeboo opened 2 weeks ago

sjoeboo commented 2 weeks ago

I've got a service which is fairly busty in terms of traffic. I was manually managing the Grafana connections but your client simplifies things a great deal. However I'm now seeing issues where my traffic is overwhelming the default niquest connection pool:

urllib3.util.traffic_police.OverwhelmedTraffic: Cannot select a disposable connection to ease the charge

Which according to: https://niquests.readthedocs.io/en/v3.5.3/community/faq.html#what-are-overwhelmedtraffic-errors

is something that can be set when setting up the session (I assume here https://github.com/grafana-toolbox/grafana-client/blob/main/grafana_client/client.py#L120 and https://github.com/grafana-toolbox/grafana-client/blob/main/grafana_client/client.py#L244C9-L244C15)

Would love the ability to set this when creating the client (I could scale my service but seems wasteful in terms of resources when a larger pool would really fix my issue in the first place)

amotl commented 2 weeks ago

Hi @sjoeboo,

thanks for submitting GH-190, I think it is the right choice instead of scaling your service.

With kind regards, Andreas.

/cc @Ousret

amotl commented 2 weeks ago

I've just merged GH-190, and will run a release right away. Before closing this ticket, it makes sense to add a corresponding paragraph to the documentation about the new feature.

Update: Version 4.2.0 has been released, including your improvement. Thanks again!

amotl commented 2 weeks ago

it makes sense to add a corresponding paragraph to the documentation about the new feature.

May I ask you to add a relevant section to the README in retrospective, @sjoeboo? The right spot would probably be to add a dedicated subsection to the "Configuration Settings" section. Their titles are sorted alphabetically, as per a630b7ccfb.

sjoeboo commented 2 weeks ago

https://github.com/grafana-toolbox/grafana-client/pull/193

amotl commented 2 weeks ago

Thank you so much!

-- https://github.com/grafana-toolbox/grafana-client#pool-size