← Back to Pull requests

Report can_connect when the ibm_was request times out or the XML is malformed #25712

Closed
unknown closed this pull request without merging on Nov 10, 2026 03:18 UTC
View on GitHub
unknown unknown commented on Oct 21, 2026 03:13 UTC
Author

What does this PR do?

  • Broadens the make_request() handler from (requests.HTTPError, requests.ConnectionError) to requests.RequestException, so timeouts and other request failures report can_connect CRITICAL.

  • Catches lxml.etree.XMLSyntaxError instead of xml.etree.ElementTree.ParseError when parsing the response.

  • Fixes self.log.Error(...) -> self.log.error(...) in that handler, which would have raised AttributeError.
  • Motivation

  • requests.ReadTimeout descends from Timeout -> RequestException, never from ConnectionError. It escaped make_request() uncaught, so submit_service_checks() was never reached and the run submitted no service check and no can_connect gauge.

  • The signal therefore went absent rather than CRITICAL: a monitor sees a gap, not an alert, exactly when the servlet is unhealthy.

  • ConnectTimeout was caught, because it inherits from both ConnectionError and Timeout. So the same user-visible failure reported two different ways depending on where it timed out.

  • etree.fromstring raises XMLSyntaxError, which is a sibling of ParseError under SyntaxError, not a subclass. The existing clause never matched, so malformed responses escaped unhandled with the same silent outcome.

  • Seen in AGENT-17325: of 12 runs on the reporting host, 3 timed out at the 90s read timeout and emitted nothing; status showed 12 total runs against 9 service checks.
  • Related: #25718 adds a shared malloc_trim helper to datadog_checks_base, the first step in fixing the unbounded RSS growth found in the same investigation. Independent of this PR; either can merge first.
  • Checklist before requesting review

  • I self-reviewed the full diff, and this description matches the final change

  • Tests cover the change, or this description explains why none are needed

  • <!--
    test_request_failure_reports_critical is parameterized over ReadTimeout, ConnectTimeout and
    TooManyRedirects; test_malformed_xml_reports_critical covers the parse path and asserts the
    log line. Verified against the unfixed source: 'read timeout', 'too many redirects' and the
    malformed-XML case all fail ("Needed exactly 1 candidates for 'ibm_was.can_connect', got 0",
    and a raw XMLSyntaxError escaping). 'connect timeout' passes before and after, documenting
    the inheritance quirk and guarding it. Full suite: 13 passed, 1 skipped.
    -->
  • Automated review comments, including Codex review, were addressed or answered

  • I, the human author, understand this change, can explain it to reviewers, and believe it meets the repository standards
  • 🤖 Generated with Claude Code

    Diff: 345 lines (+258 / -87) across 4 files Reviewer: iliakur Review duration: 28805m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.42) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 345 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.350
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #25712"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.4% (MEDIUM) · Higher = larger blast radius
    42.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.3% · Safe to merge
    18.3%