Skip to content
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

feat: unpack payload into log function #28521

Merged
merged 5 commits into from
May 23, 2024
Merged

feat: unpack payload into log function #28521

merged 5 commits into from
May 23, 2024

Conversation

mistercrunch
Copy link
Member

@mistercrunch mistercrunch commented May 15, 2024

Unpack the payload (merged from the ? querystring and POST data, depending on context) and pass it to the log function. In my specific case, I was looking to do analysis on around how much of the calls to ChartDataRestApi.data are using "force=true", and realize while this is in context, it doesn't flow through my current logger. By adding this one line of code, it should allow for many more (in fact ALL querystring and POST payload) parameters to flow through the logger. From there custom loggers can have access to much more context. Note that by default, the loggers we have won't do anything with the new arguments passed, and essentially flush it.

@request-info request-info bot added the need:more-info Requires more information from author label May 15, 2024
@dosubot dosubot bot added the logging Creates a UI or API endpoint that could benefit from logging. label May 15, 2024
Pass down the payload dict (merged from the ? querystring and POST data, depending on context) and pass it to the log function. In my specific case, I was looking to do analysis on around how much of the calls to `ChartDataRestApi.data` are using "force=true", and realize while this is in context, it doesn't flow through my current logger. By adding this one line of code, it should allow for many more (in fact ALL querystring and POST payload) parameters to flow through the logger. From there custom loggers can have access to much more context. Note that by default, the loggers we have won't do anything with the new arguments passed, and essentially flush it.
@dpgaspar
Copy link
Member

POST payload can have sensitive data

@apache apache deleted a comment from request-info bot May 15, 2024
@mistercrunch
Copy link
Member Author

POST payload can have sensitive data

Totally - though that variable is just passed to the logger, not logged. Actually let me improve this a bit. I'll pass more explicitely a curated_payload and have a class-level attribute with an allow-list of curated_payload_params

@mistercrunch
Copy link
Member Author

@dpgaspar I took a different approach, let me know what you think

"database_id": None,
"user_id": 2,
"duration": 5558756000,
"curated_payload": {},
Copy link
Member

Choose a reason for hiding this comment

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

would be nice to actually have tests with the curated payload

@mistercrunch mistercrunch merged commit 3528458 into master May 23, 2024
30 of 31 checks passed
@rusackas rusackas deleted the log_payload branch May 23, 2024 21:10
Vitor-Avila pushed a commit to Vitor-Avila/superset that referenced this pull request May 28, 2024
john-bodley pushed a commit to john-bodley/superset that referenced this pull request May 29, 2024
john-bodley pushed a commit to john-bodley/superset that referenced this pull request May 29, 2024
EnxDev pushed a commit to EnxDev/superset that referenced this pull request May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logging Creates a UI or API endpoint that could benefit from logging. need:more-info Requires more information from author preset-io size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants