Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly handle a parsing edge case #7717

Merged
merged 1 commit into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions envoy/datadog_checks/envoy/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this was not correct but seems that the PEP to make it incorrect got rejected https://www.python.org/dev/peps/pep-0317 :p


for tags in metric_mapping['|_tags_|']:
if num_tags >= len(tags):
break
Expand Down
5 changes: 5 additions & 0 deletions envoy/tests/fixtures/multiple_services
Original file line number Diff line number Diff line change
Expand Up @@ -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