Skip to content

Commit

Permalink
reverse last changes
Browse files Browse the repository at this point in the history
  • Loading branch information
faissaloux committed Oct 22, 2022
1 parent c0ad4fb commit b3c6357
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
8 changes: 2 additions & 6 deletions slo_generator/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,7 @@ def run_export(request):

# Construct exporters block
spec = {}
default_exporters = (
config.get('default_exporters', [])
if config is not None
else []
)
default_exporters = config.get('default_exporters', [])
cli_exporters = os.environ.get('EXPORTERS', None)
if cli_exporters:
cli_exporters = cli_exporters.split(',')
Expand Down Expand Up @@ -193,7 +189,7 @@ def process_batch_req(request, data, config):
headers['Authorization'] = request.headers['Authorization']
service_url = service_url.replace('http:', 'https:') # force HTTPS auth
for url in urls:
if config is not None and 'pubsub_batch_handler' in config:
if 'pubsub_batch_handler' in config:
LOGGER.info(f'Sending {url} to pubsub batch handler.')
from google.cloud import pubsub_v1 # pylint: disable=C0415
exporter_conf = config.get('pubsub_batch_handler')
Expand Down
12 changes: 5 additions & 7 deletions slo_generator/backends/cloud_monitoring_mql.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,11 @@ def query(self, query: str, window: int) -> List[TimeSeriesData]:
'query': formatted_query
})

timeseries: list
if self.client:
timeseries_pager: QueryTimeSeriesPager = (
self.client.query_time_series(request)
)
timeseries = list(timeseries_pager) # convert pager to flat list
LOGGER.debug(pprint.pformat(timeseries))
timeseries_pager: QueryTimeSeriesPager = (
self.client.query_time_series(request)
)
timeseries: list = list(timeseries_pager) # convert pager to flat list
LOGGER.debug(pprint.pformat(timeseries))
return timeseries

@staticmethod
Expand Down

0 comments on commit b3c6357

Please sign in to comment.