Skip to content

Allow configuring retries with from_config_file #506

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hterik opened this issue Oct 4, 2022 · 2 comments · Fixed by #510
Closed

Allow configuring retries with from_config_file #506

hterik opened this issue Oct 4, 2022 · 2 comments · Fixed by #510
Labels
enhancement New feature or request
Milestone

Comments

@hterik
Copy link

hterik commented Oct 4, 2022

Proposal:
I would like to configure the API url using a config-file, and still have the option to configure the retries parameter in the InfluxDBClient

Current behavior:

  1. Calling InfluxDBClient.from_config_file, proxies into _BaseClient._from_config_file.
  2. _BaseClient._from_config_file calls _BaseClient constructor without the retries-parameter set, and no other option to tunnel through kwargs.
    return cls(url, token, debug=debug, timeout=_to_int(timeout), org=org, default_tags=default_tags,
    enable_gzip=enable_gzip, verify_ssl=_to_bool(verify_ssl), ssl_ca_cert=ssl_ca_cert,
    connection_pool_maxsize=_to_int(connection_pool_maxsize), auth_basic=_to_bool(auth_basic),
    profilers=profilers, proxy=proxy)
  3. where retries is being read from kwargs, that was never passed in from the calls above:
    self.retries = kwargs.get('retries', False)

Desired behavior:
Either allow retries to be configured in the config-file, or add an additional parameter to InfluxDBClient.from_config_file that allows this to be set.

Use case:
Client-side retries is always important for a stable system. Without this option, the from_config_file function is very hard to motivate and instead one has call the InfluxDBClient constructor and provide all parameters manually.

@bednar
Copy link
Contributor

bednar commented Oct 4, 2022

Hi @hterik,

thanks for using our client.

I will change the signature of the InfluxDBClient.from_config_file to accept **kwargs which will be passed to the _BaseClient.__init__.

So you will be able to use something like:

InfluxDBClient.from_config_file(retries=WritesRetry(total=3, retry_interval=1, exponential_base=2))

Regards

@bednar
Copy link
Contributor

bednar commented Oct 5, 2022

Hi @hterik,

the proposal is fixed in #510.

You could try a dev version by:

pip install git+https://github.com/influxdata/influxdb-client-python.git@config_env_kwargs

Regards

@bednar bednar added this to the 1.34.0 milestone Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants