Skip to content

Enhance telemetry message publishing with buffered metrics - #5036

Open
Samith-NM wants to merge 3 commits into
aws:masterfrom
Samith-NM:master
Open

Enhance telemetry message publishing with buffered metrics#5036
Samith-NM wants to merge 3 commits into
aws:masterfrom
Samith-NM:master

Conversation

@Samith-NM

@Samith-NM Samith-NM commented Jul 11, 2026

Copy link
Copy Markdown

…g buffer size

Fix metrics buffering logic in TCS publishMessages function

*Issue
The publishMessages function had several critical bugs that prevented proper retry logic for failed metrics publishing:

  1. Syntax error: Invalid variable declaration (var memory []Metric maxBuffersize:= 100)
  2. Type error: Metric type doesn't exist; should use ecstcs.TelemetryMessage
  3. Logic bug: Metrics were removed from the buffer unconditionally, even when publishing failed, causing data loss
  4. The retry loop would break on error but still proceed to remove the metric from the buffer

*Changes

  • Fixed variable declaration syntax and separated it from the maxBuffersize constant
  • Corrected type from []Metric to []ecstcs.TelemetryMessage
  • Changed maxBuffersize to a const for better code clarity
  • Moved memory = memory[1:] inside the retry loop so metrics are only removed after successful publishing
  • Improved code formatting for readability

**Impact

  • Metrics that fail to publish will now properly remain in the buffer and be retried on subsequent iterations
  • Prevents silent data loss when TCS backend publishing fails
  • Ensures reliability of telemetry metrics delivery to the backend

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
fixes #4105

@Samith-NM
Samith-NM requested a review from a team as a code owner July 11, 2026 14:54
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.

Add retries for publishing metrics & health checks

1 participant