(self, data, tags, metrics, max_metrics, namespace)
Report all the metrics based on the configuration in instance
        If a metric is not well configured or is not present in the payload,
        continue processing metrics but log the information to the info page
Report all the metrics based on the configuration in instance
        If a metric is not well configured or is not present in the payload,
        continue processing metrics but log the information to the info page
Report all the metrics based on the configuration in instance If a metric is not well configured or is not present in the payload continue processing metrics but log the information to the info page
def parse_expvar_data(self, data, tags, metrics, max_metrics, namespace):
        """
        Report all the metrics based on the configuration in instance
        If a metric is not well configured or is not present in the payload,
        continue processing metrics but log the information to the info page
        """
        count = 0
        for metric in metrics:
            path = metric.get(PATH)
            metric_type = metric.get(TYPE, DEFAULT_TYPE)
            metric_tags = list(metric.get(TAGS, []))
            metric_tags += tags
            alias = metric.get(ALIAS)

            if not path:
                self.warning("Metric %s has no path", metric)
                continue

            if metric_type not in SUPPORTED_TYPES:
                self.warning("Metric type %s not supported for this check", metric_type)
                continue

            keys = path.split("/")
            values = self.deep_get(data, keys)

            if len(values) == 0:
                self.warning("No results matching path %s", path)
                continue
            self.log.debug("%s result(s) matching path %s", len(values), path)

            tag_by_path = alias is not None

            for traversed_path, value in values:
                actual_path = ".".join(traversed_path)
                path_tag = ["path:%s" % actual_path] if tag_by_path else []

                metric_name = alias or self.normalize(actual_path, namespace, fix_case=True)

                try:
                    float(value)
                except (TypeError, ValueError):
                    if isinstance(value, dict) or isinstance(value, list):
                        if actual_path == DEFAULT_MAPPING:
                            self.log.debug(
                                "Skipping configured path %s; most memstats metrics are collected by default."
                                "Specify a more specific path to report a new value",
                                actual_path,
                            )
                        else:
                            self.log.warning(
                                "Path %s cannot be a mapping or array; specify a more specific path to report a value",
                                actual_path,
                            )
                    else:
                        self.log.warning("Unreportable value for path %s: %s", actual_path, value)
                    continue

                if count >= max_metrics:
                    self.log.debug(
                        "Exceeded maximum allowed metrics (%s) while processing: %s", max_metrics, metric_name
                    )
                    self.warning(
                        "Reporting more metrics than the allowed maximum. "
                        "Please contact support@datadoghq.com for more information."
                    )
                    return

                SUPPORTED_TYPES[metric_type](self, metric_name, value, metric_tags + path_tag)

                # Submit 'go_expvar.memstats.total_alloc' as a monotonic count
                if 'memstats.total_alloc' in metric_name:
                    self.monotonic_count(metric_name + '.count', value, metric_tags + path_tag)
                    count += 1

                count += 1
def parse_expvar_data ( self , data , tags , metrics , max_metrics , namespace ) : count = 0 for metric in metrics : path = metric . get ( PATH ) metric_type = metric . get ( TYPE , DEFAULT_TYPE ) metric_tags = list ( metric . get ( TAGS , [ ] ) ) metric_tags += tags alias = metric . get ( ALIAS ) if not path : self . warning ( "Metric %s has no path" , metric ) continue if metric_type not in SUPPORTED_TYPES : self . warning ( "Metric type %s not supported for this check" , metric_type ) continue keys = path . split ( "/" ) values = self . deep_get ( data , keys ) if len ( values ) == 0 : self . warning ( "No results matching path %s" , path ) continue self . log . debug ( "%s result(s) matching path %s" , len ( values ) , path ) tag_by_path = alias is not None for traversed_path , value in values : actual_path = "." . join ( traversed_path ) path_tag = [ "path:%s" % actual_path ] if tag_by_path else [ ] metric_name = alias or self . normalize ( actual_path , namespace , fix_case = True ) try : float ( value ) except ( TypeError , ValueError ) : if isinstance ( value , dict ) or isinstance ( value , list ) : if actual_path == DEFAULT_MAPPING : self . log . debug ( "Skipping configured path %s; most memstats metrics are collected by default." "Specify a more specific path to report a new value" , actual_path , ) else : self . log . warning ( "Path %s cannot be a mapping or array; specify a more specific path to report a value" , actual_path , ) else : self . log . warning ( "Unreportable value for path %s: %s" , actual_path , value ) continue if count >= max_metrics : self . log . debug ( "Exceeded maximum allowed metrics (%s) while processing: %s" , max_metrics , metric_name ) self . warning ( "Reporting more metrics than the allowed maximum. " "Please contact support@datadoghq.com for more information." ) return SUPPORTED_TYPES [ metric_type ] ( self , metric_name , value , metric_tags + path_tag ) # Submit 'go_expvar.memstats.total_alloc' as a monotonic count if 'memstats.total_alloc' in metric_name : self . monotonic_count ( metric_name + '.count' , value , metric_tags + path_tag ) count += 1 count += 1