Skip to content

Harden UDP queue metrics InfluxDB writes against overlap and failed resets#1649

Draft
Copilot wants to merge 5 commits into
dedup-metrics-influx-1from
copilot/fix-comments-in-review-thread
Draft

Harden UDP queue metrics InfluxDB writes against overlap and failed resets#1649
Copilot wants to merge 5 commits into
dedup-metrics-influx-1from
copilot/fix-comments-in-review-thread

Conversation

Copilot AI commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

This PR addresses the review-thread feedback on the new UDP queue metrics writer. The main issue was incorrect snapshot/reset behavior when InfluxDB writes failed or overlapped, which could drop counters or start duplicate periodic writers.

  • Write completion semantics

    • postUdpQueueMetricsToInfluxDb() now supports separate onSuccess and onComplete callbacks.
    • Metric clearing stays on the success path only.
    • Timer cleanup state is released on both success and failure.
  • Timer overlap protection

    • startUdpQueueMetricsTimer() now guards against duplicate initialization.
    • Added an in-flight flag so a slow/unavailable InfluxDB write cannot overlap with the next interval tick.
    • The in-flight guard is also released when pre-write work fails, preventing the writer from stalling.
  • Focused test coverage

    • Updated UDP queue metrics tests to exercise promise-based write behavior.
    • Added cases for:
      • onSuccess vs onComplete
      • no reset on failed writes
      • duplicate timer startup
      • overlapping interval suppression
      • recovery after getMetrics() errors
  • Minor log cleanup

    • Refactored the Qlik Sense version monitor error log expression to satisfy the formatting feedback without changing behavior.
postUdpQueueMetricsToInfluxDb(
    metrics,
    measurementName,
    () => globals.udpQueueManager.clearMetrics(),
    () => {
        writeInProgress = false;
    },
);

Copilot AI and others added 4 commits June 23, 2026 05:22
Co-authored-by: mountaindude <1029262+mountaindude@users.noreply.github.com>
Co-authored-by: mountaindude <1029262+mountaindude@users.noreply.github.com>
Co-authored-by: mountaindude <1029262+mountaindude@users.noreply.github.com>
Co-authored-by: mountaindude <1029262+mountaindude@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix code based on feedback from review thread Harden UDP queue metrics InfluxDB writes against overlap and failed resets Jun 23, 2026
Copilot AI requested a review from mountaindude June 23, 2026 05:27
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants