INNER CODE UNIT · Python

run_query

braedon/prometheus-es-exporter · prometheus_es_exporter/__init__.py:203

def run_query(es_client, query_name, indices, query,
              timeout, on_error, on_missing):

    try:
        response = es_client.search(index=indices, body=query, request_timeout=timeout)

        metrics = parse_response(response, [query_name])
        metric_dict = group_metrics(metrics)

    except Exception:
        log.exception('Error while querying indices %(indices)s, query %(query)s.',
                      {'indices': indices, 'query': query})

        # If this query has successfully run before, we need to handle any
        # metrics produced by that previous run.
        if query_name in METRICS_BY_QUERY:
            old_metric_dict = METRICS_BY_QUERY[query_name]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…