fix: handle and log problematic records in data-sink-worker#3975
fix: handle and log problematic records in data-sink-worker#3975
Conversation
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
|
|
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
2 similar comments
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
There was a problem hiding this comment.
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...catchand logs telemetry emission failures. - Safely reads
channelfrom activity payloads and adds a warning log whendata.datais 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, |
There was a problem hiding this comment.
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.
| channel: activityData?.channel, | |
| channel: activityData?.channel ?? '<not-set>', |
This pull request improves error handling and logging in the
DataSinkServiceto 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:
try...catchblock to ensure any errors during telemetry reporting are caught and logged, preventing the process from crashing. [1] [2]data.datapayload, including relevant context such asresultId,integrationId, andplatform.channelfromactivityData, 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/catchto prevent worker crashes when result payloads are malformed.Overview
Makes
DataSinkService.processResultstelemetry reporting more robust by wrapping the per-typetelemetry.distributionloop in atry/catchand logging failures instead of crashing.For
IntegrationResultType.ACTIVITY, it now safely readsitem.data?.dataand logs a warning with result context when the activity payload is missing, while still emitting telemetry withchannelleft undefined.Written by Cursor Bugbot for commit ff01059. This will update automatically on new commits. Configure here.