Skip to content

InfluxDBClient.ping() method shouldn't log an error #382

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
pbybee opened this issue Dec 11, 2021 · 3 comments · Fixed by #391
Closed

InfluxDBClient.ping() method shouldn't log an error #382

pbybee opened this issue Dec 11, 2021 · 3 comments · Fixed by #391
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@pbybee
Copy link

pbybee commented Dec 11, 2021

Steps to reproduce:
List the minimal actions needed to reproduce the behavior.

  1. Create influxdbclient instance without influx backend running
  2. Run instance.ping() method within a try:... except: block.
  3. Observe ERROR logged.

Expected behavior:
Error should be raised instead of logged, or ping should simply return false is connection cannot be created.

Actual behavior:
Error is logged when connection cannot be created.
influxdb_client.client.influxdb_client| Unexpected error during /ping: <urllib3.connection.HTTPConnection object at 0x7fd486f43f50>: Failed to establish a new connection: [Errno 111]
Connection refused

Specifications:

  • Client Version: influxdb-client 1.24.0
  • InfluxDB Version: 1.8
  • Platform: Ubuntu 18.04
@bednar bednar added the question Further information is requested label Dec 13, 2021
@bednar
Copy link
Contributor

bednar commented Dec 13, 2021

Hi @pbybee,

thanks for using our client.

Can you share a little bit more about your usages? Is there a reason why the error can't be logged?

Regards

@pbybee
Copy link
Author

pbybee commented Dec 13, 2021

Hi there! maybe I don't have the same design mindset. I would expect a client that I am writing into a larger piece of software to throw exceptions and let the caller deal with logging. In this specific case, I am using ping to confirm that influx is available. And if it is not, then it is not an error in my application. If ping is a check which should return true or false depending on the state of the influxdb instance, I would assume it returns false, and not log an error. Does that make sense?

@bednar
Copy link
Contributor

bednar commented Dec 14, 2021

I would assume it returns false, and not log an error. Does that make sense?

Yes, thanks for clarification.

I would like to keep possibility to log the reason of failure. I will change the log level to debug.

@bednar bednar added enhancement New feature or request and removed question Further information is requested labels Dec 14, 2021
@michaelahojna michaelahojna added this to the 1.25.0 milestone Jan 10, 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
Development

Successfully merging a pull request may close this issue.

3 participants