예제 #1
0
    def run(self, params):
        params = self.validate_values(params)

        account_data = analytics.get_account(account_id=params['accountId'])
        if not account_data:
            return Result(success=True, payload=[])

        errors = []
        for p in account_data['webProperties']:
            nbr_views = len(p['views'])
            if nbr_views < params['min_nbr_views_per_property']:
                errors.append({
                    'property_id':
                    p['id'],
                    'property_name':
                    p['name'],
                    'nbr_views':
                    nbr_views,
                    'min_nbr_views':
                    params['min_nbr_views_per_property'],
                })

        return Result(success=(not errors), payload=errors)
예제 #2
0
    def run(self, params):
        params = self.validate_values(params)

        adservers_hostnames = params['adservers_hostnames']
        referrers = analytics.get_referrers(view_id=params['viewId'],
                                            start_date=params['startDate'],
                                            end_date=params['endDate'])

        problems = []
        for ah in adservers_hostnames:
            for r in referrers:
                if ah in r[0]:
                    problems.append({
                        'referrer': r[0],
                        'hits': r[1],
                    })

        return Result(success=not problems, payload=problems)
예제 #3
0
    def run(self, params):
        params = self.validate_values(params)

        customDimNames = params['customDimNames']
        assert type(customDimNames) == list

        property_custom_dims = analytics.get_custom_dims(
            account_id=params['accountId'],
            web_property_id=params['webPropertyId'])

        property_custom_dims_names = [d['name'] for d in property_custom_dims]

        dims_not_present = [{
            'customDimName': d,
            'problem': 'Not found'
        } for d in customDimNames if d not in property_custom_dims_names]

        return Result(success=not dims_not_present, payload=dims_not_present)
예제 #4
0
파일: check_pii.py 프로젝트: google/dqm
    def run(self, params):
        params = self.validate_values(params)

        black_list = params['blackList']
        urls = analytics.get_url_parameters(view_id=params['viewId'],
                                            start_date=params['startDate'],
                                            end_date=params['endDate'])

        problems = []
        for url in urls:
            for p in url['params']:
                if p in black_list:
                    problems.append({
                        'url': url['url'],
                        'param': p,
                    })

        return Result(success=not problems, payload=problems)
예제 #5
0
    def run(self, params):
        params = self.validate_values(params)

        hosts = analytics.get_hostnames(view_id=params['viewId'],
                                        start_date=params['startDate'],
                                        end_date=params['endDate'])

        try:
            blacklist = [re.compile(p) for p in params['staging_hosts']]
        except Exception as e:
            raise Exception(
                'Some of your regex are failing to compile: {}'.format(e))

        errors = [
            h for h in hosts if any(
                regex.match(h['host']) for regex in blacklist)
        ]

        return Result(success=not errors, payload=errors)
예제 #6
0
    def run(self, params):
        params = self.validate_values(params)

        event_categories = analytics.get_event_categories(
            view_id=params['viewId'],
            start_date=params['startDate'],
            end_date=params['endDate'])

        nbr_event_categories = len(event_categories)

        if nbr_event_categories < params['min_nbr_event_categories']:
            errors = [{
                'nbr_event_categories':
                '{} (should be at least {})'.format(
                    nbr_event_categories, params['min_nbr_event_categories'])
            }]
        else:
            errors = []

        return Result(success=not errors, payload=errors)
예제 #7
0
파일: check_dummy.py 프로젝트: google/dqm
  def run(self, params):
    params = self.validate_values(params)

    return Result(success=params['success'],
      payload=[{'problem': p} for p in params['problems']])