You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/05/15 02:10:49 UTC
(superset) branch tdd/issue-33365-parsedatetime-log-noise created (now 0e4ff147a23)
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a change to branch tdd/issue-33365-parsedatetime-log-noise
in repository https://gitbox.apache.org/repos/asf/superset.git
at 0e4ff147a23 test(date_parser): assert parsedatetime DEBUG logs are silenced
This branch includes the following new commits:
new 0e4ff147a23 test(date_parser): assert parsedatetime DEBUG logs are silenced
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(superset) 01/01: test(date_parser): assert parsedatetime DEBUG logs are silenced
Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch tdd/issue-33365-parsedatetime-log-noise
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 0e4ff147a2304491ce268352ccc5b6a3f37ac801
Author: Claude Code <no...@anthropic.com>
AuthorDate: Thu May 14 19:10:15 2026 -0700
test(date_parser): assert parsedatetime DEBUG logs are silenced
Closes #33365
Co-Authored-By: Claude Sonnet 4.6 <no...@anthropic.com>
---
tests/unit_tests/utils/date_parser_tests.py | 38 +++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/tests/unit_tests/utils/date_parser_tests.py b/tests/unit_tests/utils/date_parser_tests.py
index d5cb387f897..5d275f2f271 100644
--- a/tests/unit_tests/utils/date_parser_tests.py
+++ b/tests/unit_tests/utils/date_parser_tests.py
@@ -722,3 +722,41 @@ def test_time_range_bounded_whitespace_regex_invalid(time_range: str) -> None:
"""Reject expressions with 0 or 6+ spaces (fall back to DATETIME wrapping)."""
result = get_since_until(time_range)
assert result[0] is None, f"Expected '{time_range}' to NOT match bounded regex"
+
+
+def test_datetime_eval_does_not_emit_parsedatetime_debug_logs(
+ caplog: pytest.LogCaptureFixture,
+) -> None:
+ """
+ Regression for #33365: ``parsedatetime`` emits a noisy DEBUG record
+ (``parsedatetime:eval now with context - False, False``) every time
+ ``datetime_eval`` runs against a relative expression. In production
+ deployments running at DEBUG level this floods the logs — the user
+ report notes "this appears frequently" and a search of the issue
+ tracker turns up "dozens of places where people have posted a log
+ with that in it."
+
+ The fix is to silence the ``parsedatetime`` logger at module load
+ in ``superset/utils/date_parser.py`` (e.g.
+ ``logging.getLogger("parsedatetime").setLevel(logging.WARNING)``).
+ Their own DEBUG output is internal library chatter that Superset
+ does not surface to operators in any actionable way.
+
+ This test captures all log records at DEBUG level during a single
+ ``datetime_eval`` call and asserts that none of them come from the
+ ``parsedatetime`` logger. If the suppression is removed or bypassed,
+ the test fails immediately.
+ """
+ import logging
+
+ with caplog.at_level(logging.DEBUG):
+ datetime_eval("datetime('now')")
+
+ parsedatetime_records = [
+ r for r in caplog.records if r.name.startswith("parsedatetime")
+ ]
+ assert not parsedatetime_records, (
+ "parsedatetime emitted DEBUG records during datetime_eval — these "
+ "flood production logs. Records: "
+ + repr([(r.levelname, r.getMessage()) for r in parsedatetime_records])
+ )