-
Notifications
You must be signed in to change notification settings - Fork 15
LLMO-1023: add trace ID propagation for SQS messages and HTTP headers #1097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add getTraceId() function to extract AWS X-Ray trace IDs - Enhance logWrapper to include both jobId and traceId in logs - Add comprehensive test coverage for trace ID functionality - Update TypeScript definitions - Update README with trace ID documentation
|
This PR will trigger a minor release when merged. |
- Handle explicit traceId: null to opt-out of trace propagation - Jobs Dispatcher can send individual job messages without shared traceId - Each downstream Lambda will generate its own X-Ray trace - Add test case for opt-out behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See adobe/spacecat-audit-worker#1506 (review)
What if the traceId marker is added directly to log and contextualLog is left as it was before (since we don't know the reasoning behind why it was introduced like this by the Import as a Service team)?
@solaris007 any veto against this approach?
…logging - Modify logWrapper to enhance context.log in place instead of creating contextualLog - No code changes needed in consuming services - existing context.log calls automatically include trace IDs - Set context.contextualLog as an alias for backward compatibility check - Update tests to verify context.log is enhanced directly - Update README to clarify no code changes are needed This addresses reviewer feedback to make trace ID inclusion transparent without requiring code changes throughout the codebase.
|
I've been hasty and already did the changes 😃 |
|
looking good now i think :) i'd go a step further:
|
|
Add the above for iteration 2: https://wiki.corp.adobe.com/display/AEMSites/AEM+Sites+Optimizer+-+Tracing#AEMSitesOptimizerTracing-Iteration2 |
This PR triggers the semantic-release for the trace ID propagation feature that was merged in #1097 but didn't get released due to incorrect commit message format. ## Changes - Empty commit with proper `feat:` prefix to trigger release ## Related - Implements: #1097 - Needed for: adobe/spacecat-audit-worker#1520 Once merged, this will release: - `@adobe/spacecat-shared-utils@1.76.0` (currently 1.75.0) - `@adobe/spacecat-shared-http-utils@1.19.0` (currently 1.18.2)
This commit triggers the release for trace ID propagation feature from PR #1097. Changes include: - Enhanced logWrapper to automatically include traceId in log messages - SQS message trace ID propagation via sendMessage/sqsEventAdapter - HTTP header trace ID extraction via x-trace-id header - New addTraceIdHeader utility function This enables end-to-end distributed tracing across SpaceCat services. Related: #1097, #1152
## Problem PR #1152 was merged with a proper `feat:` commit message, but semantic-release did not trigger a release. This happened because: - **Empty commits are ignored by `semantic-release-monorepo`** - The monorepo plugin filters commits to only include those that modify files within each package directory - Since #1152 was an empty commit with no file changes, it wasn't associated with any package - Result: Both `spacecat-shared-utils` and `spacecat-shared-http-utils` were not released despite having new features from #1097 ## Solution This PR adds documentation updates to both affected packages: - **`spacecat-shared-utils`**: Added release note for trace ID propagation - **`spacecat-shared-http-utils`**: Added release note for trace ID extraction The commit includes: - Proper `feat(utils,http-utils):` prefix following conventional commits - Actual file modifications in both package directories - Will be correctly recognized by `semantic-release-monorepo` ## Changes from PR #1097 The original trace ID propagation feature includes: - Enhanced `logWrapper` to automatically include `traceId` in log messages - SQS message trace ID propagation via `sendMessage()`/`sqsEventAdapter()` - HTTP header trace ID extraction via `x-trace-id` header - New `addTraceIdHeader()` utility function This enables end-to-end distributed tracing across SpaceCat services. ## Expected Releases Once merged, semantic-release will publish: - `@adobe/spacecat-shared-utils@1.76.0` (currently 1.75.0) - `@adobe/spacecat-shared-http-utils@1.19.0` (currently 1.18.2) ## Related - Implements: #1097 - Supersedes: #1152 - Needed for: adobe/spacecat-audit-worker#1520
# [@adobe/spacecat-shared-http-utils-v1.19.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-http-utils-v1.18.2...@adobe/spacecat-shared-http-utils-v1.19.0) (2025-11-20) ### Features * **utils,http-utils:** trigger release for trace ID propagation ([#1154](#1154)) ([fb48149](fb48149)), closes [#1152](#1152) [#1152](#1152) [#1097](#1097) [#1097](#1097) [#1097](#1097) [#1152](#1152) [adobe/spacecat-audit-worker#1520](adobe/spacecat-audit-worker#1520)
|
🎉 This PR is included in version @adobe/spacecat-shared-http-utils-v1.19.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [@adobe/spacecat-shared-utils-v1.76.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.75.0...@adobe/spacecat-shared-utils-v1.76.0) (2025-11-20) ### Features * **utils,http-utils:** trigger release for trace ID propagation ([#1154](#1154)) ([fb48149](fb48149)), closes [#1152](#1152) [#1152](#1152) [#1097](#1097) [#1097](#1097) [#1097](#1097) [#1152](#1152) [adobe/spacecat-audit-worker#1520](adobe/spacecat-audit-worker#1520)
|
🎉 This PR is included in version @adobe/spacecat-shared-utils-v1.76.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Overview
Adds end-to-end trace ID propagation across SpaceCat services, enabling distributed tracing for debugging and monitoring.
Changes
1. Log Wrapper Enhancement (
spacecat-shared-utils)logWrapperto automatically includetraceIdin log messages2. SQS Message Propagation (
spacecat-shared-utils)sendMessage()automatically includestraceIdin message payloadsqsEventAdapter()extractstraceIdfrom incoming messages and stores incontext.traceId3. HTTP Header Support (
spacecat-shared-http-utils)enrichPathInfo()extractsx-trace-idheader from incoming HTTP requestscontext.traceIdfor propagation4. New Utility Function (
spacecat-shared-utils)addTraceIdHeader(headers, context)- Helper to addx-trace-idto outgoing HTTP requests@adobe/spacecat-shared-utils