feat(analytics): added trace debug mode and enhanced daily analytics#8
Open
simon-accoil wants to merge 1 commit intoanalyticsfrom
Open
feat(analytics): added trace debug mode and enhanced daily analytics#8simon-accoil wants to merge 1 commit intoanalyticsfrom
simon-accoil wants to merge 1 commit intoanalyticsfrom
Conversation
Added a new trace debug mode (`ANALYTICS_TRACE_DEBUG`) for the analytics system, which makes real HTTP requests to Accoil APIs while logging detailed request and response information. This is helpful for debugging API integration issues. Enhanced the daily analytics job to include more information from the app context, including app version, environment type, and all available license attributes. This information is collected using the Forge API's `getAppContext` function. These changes provide more detailed analytics and debugging capabilities, assisting in the monitoring of request performance and the validation of successful data transmission.
accoilmj
reviewed
Aug 29, 2025
|
|
||
| if (isTraceDebugMode) { | ||
| console.log(`TRACE DEBUG: Making HTTP request to ${url}`); | ||
| console.log(`TRACE DEBUG: Request headers:`, JSON.stringify({"Content-Type": "application/json"}, null, 2)); |
Collaborator
There was a problem hiding this comment.
Better to either pre-emptively construct the fetch params object or move headers out somewhere so it's not statically redefined each time here and in the call to fetch below.
accoilmj
reviewed
Aug 29, 2025
| totalTodoCount: `${await getTodoCount()}`, | ||
|
|
||
| // App Context API - App Version | ||
| appVersion: appContext.appVersion, |
Collaborator
There was a problem hiding this comment.
I'm guessing appContext is always defined? This code intermixes use of null safe access ?. with direct access.
accoilmj
reviewed
Aug 29, 2025
|
|
||
| // Filter out undefined values to keep payload clean | ||
| const filteredTraits = Object.fromEntries( | ||
| Object.entries(traits).filter(([_, value]) => value !== undefined) |
Collaborator
There was a problem hiding this comment.
Probably overkill I think as the eventual JSON.stringify should drop these from the payload:
JSON.stringify({"test": undefined, "test2": {"test": undefined, "foo": "bar"}})
'{"test2":{"foo":"bar"}}'
If they're null though they will show up so maybe you want to remove those? I don't think it will break anything though:
JSON.stringify({"test": null})
'{"test":null}'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a new trace debug mode (
ANALYTICS_TRACE_DEBUG) for the analytics system, which makes real HTTP requests to Accoil APIs while logging detailed request and response information. This is helpful for debugging API integration issues.Enhanced the daily analytics job to include more information from the app context, including app version, environment type, and all available license attributes. This information is collected using the Forge API's
getAppContextfunction.These changes provide more detailed analytics and debugging capabilities, assisting in the monitoring of request performance and the validation of successful data transmission.