# Path: slo_generator/constants.py
# NO_DATA = -1


import logging
import pprint
import warnings
from collections import OrderedDict
from google.cloud import monitoring_v3
from slo_generator.constants import NO_DATA
                "One of `filter_bad` or `filter_valid` is required.")

        LOGGER.debug(f'Good events: {good_event_count} | '
                     f'Bad events: {bad_event_count}')

        return (good_event_count, bad_event_count)

    def distribution_cut(self, timestamp, window, slo_config):
        """Query one timeserie of type 'exponential'.

        Args:
            timestamp (int): UNIX timestamp.
            window (int): Window size (in seconds).
            slo_config (dict): SLO configuration.

        Returns:
            tuple: A tuple (good_event_count, bad_event_count).
        """
        measurement = slo_config['spec']['service_level_indicator']
        filter_valid = measurement['filter_valid']
        threshold_bucket = int(measurement['threshold_bucket'])
        good_below_threshold = measurement.get('good_below_threshold', True)

        # Query 'valid' events
        series = self.query(timestamp=timestamp,
                            window=window,
                            filter=filter_valid)
        series = list(series)

        if not series:

# Path: slo_generator/constants.py
# NO_DATA = -1


# Path: slo_generator/backends/cloud_monitoring.py
import logging
import pprint
import warnings
from collections import OrderedDict
from google.cloud import monitoring_v3
from slo_generator.constants import NO_DATA

                "One of `filter_bad` or `filter_valid` is required.")

        LOGGER.debug(f'Good events: {good_event_count} | '
                     f'Bad events: {bad_event_count}')

        return (good_event_count, bad_event_count)

    def distribution_cut(self, timestamp, window, slo_config):
        """Query one timeserie of type 'exponential'.

        Args:
            timestamp (int): UNIX timestamp.
            window (int): Window size (in seconds).
            slo_config (dict): SLO configuration.

        Returns:
            tuple: A tuple (good_event_count, bad_event_count).
        """
        measurement = slo_config['spec']['service_level_indicator']
        filter_valid = measurement['filter_valid']
        threshold_bucket = int(measurement['threshold_bucket'])
        good_below_threshold = measurement.get('good_below_threshold', True)

        # Query 'valid' events
        series = self.query(timestamp=timestamp,
                            window=window,
                            filter=filter_valid)
        series = list(series)

        if not series:

            return (NO_DATA, NO_DATA)  # no timeseries