@@ -0,0 +1,1831 @@
+# (C) Datadog, Inc. 2010-2019%0A# All rights reserved%0A# Licensed under Simplified BSD License (see LICENSE)%0Aimport re%0A%0Aimport requests%0A%0A# Make sure this expected metrics list is up to date with:%0A# - %60dogstatsd_mapper_profiles%60 configuration from README.md%0A# - metadata.csv%0AEXPECTED_METRICS = %5B%0A    '%3Cjob_name%3E_start',%0A    '%3Cjob_name%3E_end',%0A    'operator_failures_%3Coperator_name%3E',%0A    'operator_successes_%3Coperator_name%3E',%0A    'ti_failures',%0A    'ti_successes',%0A    'zombies_killed',%0A    'scheduler_heartbeat',%0A    'dag_processing.processes',%0A    'scheduler.tasks.killed_externally',%0A    'dagbag_size',%0A    'dag_processing.import_errors',%0A    'dag_processing.total_parse_time',%0A    'dag_processing.last_runtime.%3Cdag_file%3E',%0A    'dag_processing.last_run.seconds_ago.%3Cdag_file%3E',%0A    'dag_processing.processor_timeouts',%0A    'executor.open_slots',%0A    'executor.queued_tasks',%0A    'executor.running_tasks',%0A    'pool.open_slots.%3Cpool_name%3E',%0A    'pool.used_slots.%3Cpool_name%3E',%0A    'pool.starving_tasks.%3Cpool_name%3E',%0A    'dagrun.dependency-check.%3Cdag_id%3E',%0A    'dag.%3Cdag_id%3E.%3Ctask_id%3E.duration',%0A    'dag_processing.last_duration.%3Cdag_file%3E',%0A    'dagrun.duration.success.%3Cdag_id%3E',%0A    'dagrun.duration.failed.%3Cdag_id%3E',%0A    'dagrun.schedule_delay.%3Cdag_id%3E',%0A%5D%0A%0AMETRIC_PATTERN = re.compile(r'%5E%60%60(%5B%5E%60%5D+)%60%60%5Cs+(.*)', re.MULTILINE)%0A%0A%0Adef test_check_metrics_up_to_date():%0A    url = 'https://raw.githubusercontent.com/apache/airflow/master/docs/metrics.rst'%0A    resp = requests.get(url)%0A    content = resp.content.decode('utf-8')%0A    matches = METRIC_PATTERN.findall(content)%0A%0A    # Printed only on failure for convenience.%0A    print(%22Metric from %7B%7D :%22.format(url))%0A    print(%22%22)%0A    for metric, desc in matches:%0A        print(%22%7B:50%7D %7B%7D%22.format(metric, desc))%0A%0A    metrics = %5Bm for m, desc in matches%5D%0A    assert EXPECTED_METRICS == metrics%0A

Check metrics are up to date (#5311)