Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion slo_generator/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def process_batch_req(request, data, config):
for url in urls:
if "pubsub_batch_handler" in config:
LOGGER.info(f"Sending {url} to pubsub batch handler.")
from google.cloud import pubsub_v1
from google.cloud import pubsub_v1 # noqa: PLC0415

# pytype: disable=attribute-error

Expand Down
1 change: 1 addition & 0 deletions slo_generator/backends/cloud_monitoring_mql.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
`cloud_monitoring_mql.py`
Cloud Monitoring backend implementation with MQL (Monitoring Query Language).
"""
# ruff: noqa: UP045

import logging
import pprint
Expand Down
1 change: 1 addition & 0 deletions slo_generator/backends/cloud_service_monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
`cloud_service_monitoring.py`
Cloud Service Monitoring exporter class.
"""
# ruff: noqa: UP045,UP007

import difflib
import json
Expand Down
5 changes: 4 additions & 1 deletion slo_generator/backends/prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
`prometheus.py`
Prometheus backend implementation.
"""
# ruff: noqa: UP045,UP007

import json
import logging
Expand Down Expand Up @@ -117,6 +118,7 @@ def distribution_cut(
res_good = self.query(
expr,
window,
timestamp=timestamp,
operators=["increase", "sum"],
labels=labels,
)
Expand All @@ -130,6 +132,7 @@ def distribution_cut(
res_valid = self.query(
expr_count,
window,
timestamp=timestamp,
operators=["increase", "sum"],
)
valid_count = PrometheusBackend.count(res_valid)
Expand Down Expand Up @@ -163,7 +166,7 @@ def query( # noqa: PLR0913
labels = {}
filter = PrometheusBackend._fmt_query(filter, window, operators, labels)
LOGGER.debug(f"Query: {filter}")
response = self.client.query(metric=filter)
response = self.client.query(metric=filter, time=timestamp)
response = json.loads(response)
LOGGER.debug(pprint.pformat(response))
return response
Expand Down
2 changes: 1 addition & 1 deletion slo_generator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def compute(slo_config, config, export, delete, timestamp):
def api(ctx, config, exporters, signature_type, target, port): # noqa: PLR0913
"""Run an API that can receive requests (supports both 'http' and
'cloudevents' signature types)."""
from functions_framework._cli import _cli
from functions_framework._cli import _cli # noqa: PLC0415

os.environ["EXPORTERS"] = exporters
os.environ["CONFIG_PATH"] = config
Expand Down
1 change: 1 addition & 0 deletions slo_generator/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
`compute.py`
Compute utilities.
"""
# ruff: noqa: UP045

import logging
import pprint
Expand Down
3 changes: 2 additions & 1 deletion slo_generator/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
`utils.py`
Utility functions.
"""
# ruff: noqa: UP045

import argparse
import errno
Expand Down Expand Up @@ -188,7 +189,7 @@ def setup_logging():

# Ignore Cloud SDK warning when using a user instead of service account
try:
from google.auth._default import _CLOUD_SDK_CREDENTIALS_WARNING
from google.auth._default import _CLOUD_SDK_CREDENTIALS_WARNING # noqa: PLC0415

warnings.filterwarnings("ignore", message=_CLOUD_SDK_CREDENTIALS_WARNING)
except ImportError:
Expand Down