influx_query_manager doesn't catch ApiException, so Influx error responses 500

Open Beginner friendly
#8,510 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend, databases

Research direction

Start at the influx_query_manager class and compare its query error handling with write(), which already catches both exception types. Check the existing tests around this class if available; done means Influx error responses are captured and queries degrade to an empty result instead of propagating a 500.

Written by the indexing model from the issue text.

Description

influx_query_manager catches urllib3.exceptions.HTTPError, which covers
connection failures but not error responsesinfluxdb_client.rest.ApiException
subclasses InfluxDBError. So a 400/401/429/5xx from Influx propagates and 500s
the caller instead of degrading to an empty result. write() on the same class
already catches both.

-        except HTTPError as e:
+        except (HTTPError, InfluxDBError) as e:
             capture_exception(e)
             return []

Found via the sales dashboard, where get_events_for_organisation 500s the
organisation page if Influx responds with an error. CI never hits it because
there is no Influx service, so every query fails at the socket and is swallowed.

Dominant language
Python
Stars
6.6k
Forks
571
Avg merge
1d 16h
Merged PRs (30d)
116

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Flagsmith/flagsmith

All issues in Flagsmith/flagsmith

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.