Skip to content

fix: handle and log problematic records in data-sink-worker#3975

Merged
mbani01 merged 1 commit intomainfrom
fix/undefined-channel-in-data-sink-worker
Mar 30, 2026
Merged

fix: handle and log problematic records in data-sink-worker#3975
mbani01 merged 1 commit intomainfrom
fix/undefined-channel-in-data-sink-worker

Conversation

@mbani01
Copy link
Copy Markdown
Contributor

@mbani01 mbani01 commented Mar 30, 2026

This pull request improves error handling and logging in the DataSinkService to make telemetry reporting more robust. The main changes focus on preventing crashes when activity data is missing and ensuring that any errors during telemetry reporting are logged.

Error handling and logging improvements:

  • Wrapped the telemetry reporting logic in a try...catch block to ensure any errors during telemetry reporting are caught and logged, preventing the process from crashing. [1] [2]
  • Added a warning log when an activity result has a missing data.data payload, including relevant context such as resultId, integrationId, and platform.
  • Updated the code to safely access channel from activityData, preventing runtime errors if the data is missing.

Note

Low Risk
Low risk: changes are limited to telemetry reporting and logging, adding guards and a try/catch to prevent worker crashes when result payloads are malformed.

Overview
Makes DataSinkService.processResults telemetry reporting more robust by wrapping the per-type telemetry.distribution loop in a try/catch and logging failures instead of crashing.

For IntegrationResultType.ACTIVITY, it now safely reads item.data?.data and logs a warning with result context when the activity payload is missing, while still emitting telemetry with channel left undefined.

Written by Cursor Bugbot for commit ff01059. This will update automatically on new commits. Configure here.

Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
@mbani01 mbani01 requested a review from themarolt March 30, 2026 11:08
@mbani01 mbani01 self-assigned this Mar 30, 2026
Copilot AI review requested due to automatic review settings March 30, 2026 11:08
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

2 similar comments
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@mbani01 mbani01 merged commit f7ad9b6 into main Mar 30, 2026
21 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves robustness of telemetry reporting in DataSinkService by preventing runtime errors when activity result payloads are missing and ensuring telemetry failures are logged instead of crashing the worker.

Changes:

  • Wraps per-batch telemetry reporting in a try...catch and logs telemetry emission failures.
  • Safely reads channel from activity payloads and adds a warning log when data.data is missing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

item.onboarding === null || item.onboarding === undefined
? '<not-set>'
: item.onboarding.toString(),
channel: activityData?.channel,
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

activityArgs sets channel to activityData?.channel, which can be undefined. The telemetry client’s normalizeTags passes tag values through without filtering undefined, and DogStatsD expects tag values to be strings/numbers; this can throw and cause the whole telemetry loop to abort (only caught at the outer try/catch). Consider omitting the channel tag when missing or mapping it to a sentinel string like '<not-set>' to avoid telemetry errors/noise.

Suggested change
channel: activityData?.channel,
channel: activityData?.channel ?? '<not-set>',

Copilot uses AI. Check for mistakes.
@mbani01 mbani01 deleted the fix/undefined-channel-in-data-sink-worker branch March 30, 2026 11:11
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.

4 participants