A singleton InfluxDB client instance
(cls)
| 52 | @classmethod |
| 53 | @functools.cache |
| 54 | def get_client(cls) -> InfluxDBClient: |
| 55 | """A singleton InfluxDB client instance""" |
| 56 | retries = Retry(connect=3, read=3, redirect=3) |
| 57 | return InfluxDBClient( |
| 58 | url=settings.INFLUXDB_URL, |
| 59 | token=settings.INFLUXDB_TOKEN, |
| 60 | org=settings.INFLUXDB_ORG, |
| 61 | retries=retries, |
| 62 | timeout=30000, # Hard stop to prevent hanging requests |
| 63 | ) |
| 64 | |
| 65 | @classmethod |
| 66 | def get_downsampled_bucket(cls, size: DownsampleSize) -> str: |
no outgoing calls