Support 'never' as expiry date.
Bug: 923083
Change-Id: I25136857b84832ac896e76f32c182af8eb190e15
Reviewed-on: https://chromium-review.googlesource.com/c/1418517
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Commit-Queue: Brian White <bcwhite@chromium.org>
Cr-Commit-Position: refs/heads/master@{#625353}
diff --git a/tools/metrics/histograms/extract_histograms.py b/tools/metrics/histograms/extract_histograms.py
index c18e4ab..549a166f 100644
--- a/tools/metrics/histograms/extract_histograms.py
+++ b/tools/metrics/histograms/extract_histograms.py
@@ -303,14 +303,14 @@
# Handle expiry attribute.
if histogram.hasAttribute('expires_after'):
expiry_str = histogram.getAttribute('expires_after')
- if _ValidateMilestoneString(expiry_str) or _ValidateDateString(
- expiry_str):
+ if (expiry_str == "never" or _ValidateMilestoneString(expiry_str) or
+ _ValidateDateString(expiry_str)):
histogram_entry['expires_after'] = expiry_str
else:
logging.error(
- 'Expiry of histogram %s does not match expected date format: "%s"'
- ' or milestone format: M* found %s.', name, EXPIRY_DATE_PATTERN,
- expiry_str)
+ 'Expiry of histogram %s does not match expected date format ("%s"),'
+ ' milestone format (M*), or "never": found %s.', name,
+ EXPIRY_DATE_PATTERN, expiry_str)
have_errors = True
# Find <owner> tag.
diff --git a/tools/metrics/histograms/generate_expired_histograms_array.py b/tools/metrics/histograms/generate_expired_histograms_array.py
index bbf283f..a122247 100755
--- a/tools/metrics/histograms/generate_expired_histograms_array.py
+++ b/tools/metrics/histograms/generate_expired_histograms_array.py
@@ -67,6 +67,8 @@
if "obsolete" in content or "expires_after" not in content:
continue
expiry_str = content["expires_after"]
+ if expiry_str == "never":
+ continue
match = _MILESTONE_EXPIRY_RE.search(expiry_str)
if match: