Copilot commented on code in PR #13156:
URL: https://github.com/apache/trafficserver/pull/13156#discussion_r3230063424
##########
tests/gold_tests/pluginTest/stats_over_http/stats_over_http.test.py:
##########
@@ -93,6 +93,133 @@ def __checkPrometheusMetrics(self, p: 'Test.Process',
from_prometheus: bool):
p.Streams.stdout += Testers.ContainsExpression(
'proxy_process_http_delete_requests 0', 'Verify the successful
parsing of Prometheus metrics for a counter.')
+ def __checkPrometheusV2Metrics(self, p: "Test.Process"):
+ """Check the Prometheus v2 metrics output.
+ :param p: The process whose output to check.
+ """
+ p.Streams.stdout += Testers.ContainsExpression(
+ "# HELP proxy_process_http_requests",
+ "Output should have a help line for the base metric name.",
+ )
+ p.Streams.stdout += Testers.ContainsExpression(
+ "# TYPE proxy_process_http_requests counter",
+ "Output should have a type line for the base metric name.",
+ )
+
+ p.Streams.stdout += Testers.ContainsExpression(
+ 'proxy_process_http_requests{method="delete"}',
+ "Verify that HTTP method labels (GET, POST, DELETE, etc.) are
extracted correctly.",
+ )
+
+ p.Streams.stdout += Testers.ContainsExpression(
+ 'proxy_process_http_requests{method="extension_method"}',
+ "Verify that multi-token HTTP method labels are extracted
correctly.",
Review Comment:
Testers.ContainsExpression/ExcludesExpression patterns are treated as
regular expressions in AuTest. The added Prometheus v2 checks include unescaped
'{' / '}' (e.g., metric{label="value"}), which will be parsed as an invalid
regex quantifier and can make the test error out instead of matching output.
Escape braces (and other regex metacharacters as needed) or use a
literal/escaped matcher so these checks reliably match the exposition text.
This issue also appears in the following locations of the same file:
- line 124
- line 153
- line 166
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]