From 676c3716b2a87ad47a88fd9f1b3bfdb50c4462a7 Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Tue, 6 Oct 2020 09:57:19 -0400 Subject: [PATCH] Properly handle a parsing edge case (#7717) --- envoy/datadog_checks/envoy/parser.py | 4 ++++ envoy/tests/fixtures/multiple_services | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/envoy/datadog_checks/envoy/parser.py b/envoy/datadog_checks/envoy/parser.py index f4dc32f1a3041..343c75af653ea 100644 --- a/envoy/datadog_checks/envoy/parser.py +++ b/envoy/datadog_checks/envoy/parser.py @@ -41,6 +41,10 @@ def parse_metric(metric, metric_mapping=METRIC_TREE): if metric_part in metric_mapping and num_tags >= minimum_tag_length: # Rebuild any built up tags whenever we encounter a known metric part. if tag_builder: + # Edge case where we hit a known metric part after a sequence of all unknown parts + if '|_tags_|' not in metric_mapping: + raise UnknownMetric + for tags in metric_mapping['|_tags_|']: if num_tags >= len(tags): break diff --git a/envoy/tests/fixtures/multiple_services b/envoy/tests/fixtures/multiple_services index 153efc9146aa6..10db29d1854cd 100644 --- a/envoy/tests/fixtures/multiple_services +++ b/envoy/tests/fixtures/multiple_services @@ -4505,3 +4505,8 @@ tcp_mixer_filter.total_remote_check_calls: 0 tcp_mixer_filter.total_remote_quota_calls: 0 tcp_mixer_filter.total_remote_report_calls: 0 tcp_mixer_filter.total_report_calls: 0 +wasm.envoy.wasm.runtime.null.active: 0 +wasm.envoy.wasm.runtime.null.created: 0 +wasm_vm.envoy.wasm.runtime.null.active: 0 +wasm_vm.envoy.wasm.runtime.null.cloned: 0 +wasm_vm.envoy.wasm.runtime.null.created: 0