(endpoint)
Show metric info from a Prometheus endpoint.

    \b
    Example:
    `$ ddev meta prom info :8080/_status/vars`
Show metric info from a Prometheus endpoint.
Show metric info from a Prometheus endpoint .
def info(endpoint):
    """Show metric info from a Prometheus endpoint.

    \b
    Example:
    `$ ddev meta prom info :8080/_status/vars`
    """
    endpoint = sanitize_endpoint(endpoint)

    metrics = parse_metrics(endpoint)
    num_metrics = len(metrics)
    num_gauge = 0
    num_counter = 0
    num_histogram = 0

    for data in metrics.values():
        metric_type = data.get('type')

        if metric_type == 'gauge':
            num_gauge += 1
        elif metric_type == 'counter':
            num_counter += 1
        elif metric_type == 'histogram':
            num_histogram += 1

    if num_metrics:
        echo_success(f'Number of metrics: {num_metrics}')
    else:
        echo_warning('No metrics!')
        return

    if num_gauge:
        echo_info(f'Type `gauge`: {num_gauge}')

    if num_counter:
        echo_info(f'Type `counter`: {num_counter}')

    if num_histogram:
        echo_info(f'Type `histogram`: {num_histogram}')
def info ( endpoint ) : endpoint = sanitize_endpoint ( endpoint ) metrics = parse_metrics ( endpoint ) num_metrics = len ( metrics ) num_gauge = 0 num_counter = 0 num_histogram = 0 for data in metrics . values ( ) : metric_type = data . get ( 'type' ) if metric_type == 'gauge' : num_gauge += 1 elif metric_type == 'counter' : num_counter += 1 elif metric_type == 'histogram' : num_histogram += 1 if num_metrics : echo_success ( f'Number of metrics: {num_metrics}' ) else : echo_warning ( 'No metrics!' ) return if num_gauge : echo_info ( f'Type `gauge`: {num_gauge}' ) if num_counter : echo_info ( f'Type `counter`: {num_counter}' ) if num_histogram : echo_info ( f'Type `histogram`: {num_histogram}' )