Skip to content

fix: error extractor to handle nested JSON responses - #6209

Merged
koladilip merged 1 commit into
masterfrom
fix/error-extractor-nested-json-response
Aug 13, 2025
Merged

koladilip merged 1 commit into
masterfrom
fix/error-extractor-nested-json-response

Conversation

@koladilip

@koladilip koladilip commented Aug 2, 2025 •

Copy link
Copy Markdown
Contributor

Description

This PR enhances the error extractor in the enterprise reporting module to properly handle nested JSON responses. The fix addresses cases where error messages are embedded within nested JSON structures, particularly when the outer JSON contains a 'response' field with a JSON string that includes error information.

Changes Made

  • Enhanced Error Extractor Logic: Added a fallback mechanism in the function to handle direct message keys in parsed JSON
  • Improved Nested JSON Parsing: Better handling of nested JSON response structures for more accurate error message extraction
  • Comprehensive Test Coverage: Added extensive test cases covering various nested JSON scenarios, edge cases, and real-world examples
  • Backward Compatibility: Maintained all existing functionality while adding new capabilities

Linear Ticket

Resolves https://linear.app/rudderstack/issue/INT-3995/fix-error-extractor-not-handling-nested-json-response-correctly

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

Testing

  • All existing tests pass
  • New comprehensive test coverage added for nested JSON scenarios
  • Edge cases and error conditions tested
  • No user data included in test cases (all data sanitized)

Files Changed

    • Enhanced error extraction logic
    • Added comprehensive test coverage

@koladilip koladilip changed the title fix: enhance error extractor to handle nested JSON responses correctly fix: error extractor to handle nested JSON responses correctly Aug 2, 2025
@koladilip koladilip changed the title fix: error extractor to handle nested JSON responses correctly fix: error extractor to handle nested JSON responses Aug 2, 2025
@codecov

codecov Bot commented Aug 2, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.68%. Comparing base (0773168) to head (6301960).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6209      +/-   ##
==========================================
- Coverage   76.68%   76.68%   -0.01%     
==========================================
  Files         520      520              
  Lines       70872    70883      +11     
==========================================
+ Hits        54348    54355       +7     
- Misses      13631    13632       +1     
- Partials     2893     2896       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@koladilip
koladilip force-pushed the fix/error-extractor-nested-json-response branch from 675fb67 to b1c3f1a Compare August 4, 2025 05:24
@koladilip
koladilip requested a review from achettyiitr August 4, 2025 09:25
Comment thread enterprise/reporting/error_extractor.go Resolved
- Add fallback mechanism in getSimpleMessage to handle direct message keys
- Improve nested JSON response parsing for better error message extraction
- Add comprehensive test coverage for nested JSON scenarios
- Ensure backward compatibility with existing functionality

Fixes INT-3995

test: update test expectations to match actual error extractor behavior

test: remove redundant TestGetErrorMessage_RealSampleData test
@koladilip
koladilip force-pushed the fix/error-extractor-nested-json-response branch from 5c3cc6f to 6301960 Compare August 13, 2025 09:04
@koladilip
koladilip enabled auto-merge (squash) August 13, 2025 09:04
@koladilip
koladilip merged commit ffc0d7a into master Aug 13, 2025
@koladilip
koladilip deleted the fix/error-extractor-nested-json-response branch August 13, 2025 10:23
This was referenced Aug 18, 2025
mihir20 pushed a commit that referenced this pull request Aug 18, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.57.0-rc.1](v1.56.0...v1.57.0-rc.1)
(2025-08-18)


### Features

* add support for manual sync mode in warehouse
([#6199](#6199))
([6f87119](6f87119))
* **router:** support different throttler per event type
([#6181](#6181))
([12254bb](12254bb))
* warehouse grpc API to get namespace mappings of a destination
([#6200](#6200))
([9613236](9613236))


### Bug Fixes

* adaptive throttling not applying dynamic throttling limits
consistently
([#6219](#6219))
([478b2e1](478b2e1))
* error extractor to handle nested JSON responses
([#6209](#6209))
([ffc0d7a](ffc0d7a))
* getting occasional unauthenticated errors from googlepubsub
([#6228](#6228))
([cc39306](cc39306))
* handle snowpipe service restarts in destination polling logic
([#6236](#6236))
([b76bc7f](b76bc7f))
* handling empty schema for table level schemas
([#6233](#6233))
([cc39306](cc39306))
* histogram buckets for schema snapshots
([#6234](#6234))
([cc39306](cc39306))
* warehouse source empty jobs
([#6204](#6204))
([42f5ae4](42f5ae4))


### Miscellaneous

* bump the go-dependencies group with 12 updates
([#6189](#6189))
([e6e2bcd](e6e2bcd))
* enforcing non-sugared logger
([#6066](#6066))
([b24ded8](b24ded8))
* force new MTU metrics from 1st September 2025 onwards
([#6227](#6227))
([154d2c3](154d2c3))
* implement configurable deduplication mirror mode
([#6224](#6224))
([c97ad7a](c97ad7a))
* refactor Google Pub/Sub to add retry logic for auth errors
([#6229](#6229))
([cc39306](cc39306))
* remove enableV2NotifierJob flag support
([#6196](#6196))
([8be54bf](8be54bf))
* remove event blocking flag
([#6240](#6240))
([e668e14](e668e14))
* remove queryWithUploadId flag support for load files
([#6192](#6192))
([e6e2bcd](e6e2bcd))
* revert "fix: snowpipe events getting duplicated if status API fails"
([#6211](#6211))
([777b08e](777b08e))
* skip warehouse destinations from version deprecation error extraction
([#6226](#6226))
([87c3320](87c3320))
* stop collecting errors in proc_error jobsdb
([#6232](#6232))
([c600968](c600968))
* throttler should emit no warning if not enabled
([#6223](#6223))
([0773168](0773168))
* update keydb dependency
([#6222](#6222))
([d1d64bc](d1d64bc))
* use harbor to pull docker images
([#6210](#6210))
([6c324cf](6c324cf))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
ItsSudip pushed a commit that referenced this pull request Aug 19, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.57.0-rc.2](v1.56.0...v1.57.0-rc.2)
(2025-08-19)


### Features

* add support for manual sync mode in warehouse
([#6199](#6199))
([6f87119](6f87119))
* enable oauthV2 by removing oauthV2enabled variable
([#6175](#6175))
([caad8f0](caad8f0))
* **router:** support different throttler per event type
([#6181](#6181))
([12254bb](12254bb))
* warehouse grpc API to get namespace mappings of a destination
([#6200](#6200))
([9613236](9613236))


### Bug Fixes

* adaptive throttling not applying dynamic throttling limits
consistently
([#6219](#6219))
([478b2e1](478b2e1))
* error extractor to handle nested JSON responses
([#6209](#6209))
([ffc0d7a](ffc0d7a))
* getting occasional unauthenticated errors from googlepubsub
([#6228](#6228))
([cc39306](cc39306))
* handle snowpipe service restarts in destination polling logic
([#6236](#6236))
([b76bc7f](b76bc7f))
* handling empty schema for table level schemas
([#6233](#6233))
([cc39306](cc39306))
* histogram buckets for schema snapshots
([#6234](#6234))
([cc39306](cc39306))
* warehouse source empty jobs
([#6204](#6204))
([42f5ae4](42f5ae4))


### Miscellaneous

* bump the go-dependencies group with 12 updates
([#6189](#6189))
([e6e2bcd](e6e2bcd))
* enforcing non-sugared logger
([#6066](#6066))
([b24ded8](b24ded8))
* force new MTU metrics from 1st September 2025 onwards
([#6227](#6227))
([154d2c3](154d2c3))
* implement configurable deduplication mirror mode
([#6224](#6224))
([c97ad7a](c97ad7a))
* refactor Google Pub/Sub to add retry logic for auth errors
([#6229](#6229))
([cc39306](cc39306))
* remove enableV2NotifierJob flag support
([#6196](#6196))
([8be54bf](8be54bf))
* remove event blocking flag
([#6240](#6240))
([e668e14](e668e14))
* remove queryWithUploadId flag support for load files
([#6192](#6192))
([e6e2bcd](e6e2bcd))
* revert "fix: snowpipe events getting duplicated if status API fails"
([#6211](#6211))
([777b08e](777b08e))
* skip warehouse destinations from version deprecation error extraction
([#6226](#6226))
([87c3320](87c3320))
* stop collecting errors in proc_error jobsdb
([#6232](#6232))
([c600968](c600968))
* throttler should emit no warning if not enabled
([#6223](#6223))
([0773168](0773168))
* update keydb dependency
([#6222](#6222))
([d1d64bc](d1d64bc))
* use harbor to pull docker images
([#6210](#6210))
([6c324cf](6c324cf))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
mihir20 pushed a commit that referenced this pull request Aug 19, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.57.0](v1.56.0...v1.57.0)
(2025-08-19)


### Features

* add support for manual sync mode in warehouse
([#6199](#6199))
([6f87119](6f87119))
* enable oauthV2 by removing oauthV2enabled variable
([#6175](#6175))
([caad8f0](caad8f0))
* **router:** support different throttler per event type
([#6181](#6181))
([12254bb](12254bb))
* warehouse grpc API to get namespace mappings of a destination
([#6200](#6200))
([9613236](9613236))


### Bug Fixes

* adaptive throttling not applying dynamic throttling limits
consistently
([#6219](#6219))
([478b2e1](478b2e1))
* error extractor to handle nested JSON responses
([#6209](#6209))
([ffc0d7a](ffc0d7a))
* getting occasional unauthenticated errors from googlepubsub
([#6228](#6228))
([cc39306](cc39306))
* handle snowpipe service restarts in destination polling logic
([#6236](#6236))
([b76bc7f](b76bc7f))
* handling empty schema for table level schemas
([#6233](#6233))
([cc39306](cc39306))
* histogram buckets for schema snapshots
([#6234](#6234))
([cc39306](cc39306))
* warehouse source empty jobs
([#6204](#6204))
([42f5ae4](42f5ae4))


### Miscellaneous

* bump the go-dependencies group with 12 updates
([#6189](#6189))
([e6e2bcd](e6e2bcd))
* enforcing non-sugared logger
([#6066](#6066))
([b24ded8](b24ded8))
* force new MTU metrics from 1st September 2025 onwards
([#6227](#6227))
([154d2c3](154d2c3))
* implement configurable deduplication mirror mode
([#6224](#6224))
([c97ad7a](c97ad7a))
* refactor Google Pub/Sub to add retry logic for auth errors
([#6229](#6229))
([cc39306](cc39306))
* remove enableV2NotifierJob flag support
([#6196](#6196))
([8be54bf](8be54bf))
* remove event blocking flag
([#6240](#6240))
([e668e14](e668e14))
* remove queryWithUploadId flag support for load files
([#6192](#6192))
([e6e2bcd](e6e2bcd))
* revert "fix: snowpipe events getting duplicated if status API fails"
([#6211](#6211))
([777b08e](777b08e))
* skip warehouse destinations from version deprecation error extraction
([#6226](#6226))
([87c3320](87c3320))
* stop collecting errors in proc_error jobsdb
([#6232](#6232))
([c600968](c600968))
* throttler should emit no warning if not enabled
([#6223](#6223))
([0773168](0773168))
* update keydb dependency
([#6222](#6222))
([d1d64bc](d1d64bc))
* use harbor to pull docker images
([#6210](#6210))
([6c324cf](6c324cf))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

3 participants