Skip to content

Commit

Permalink
feat: unpack payload into log function
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mistercrunch committed May 15, 2024
1 parent 2defa10 commit e2182e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@

# By default will log events to the metadata database with `DBEventLogger`
# Note that you can use `StdOutEventLogger` for debugging
# Note that you can write your own event logger by extending `AbstractEventLogger`
# https://github.com/apache/superset/blob/master/superset/utils/log.py
EVENT_LOGGER = DBEventLogger()

SUPERSET_LOG_VIEW = True
Expand Down
1 change: 1 addition & 0 deletions superset/utils/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ def log_with_context( # pylint: disable=too-many-locals,too-many-arguments
slice_id=slice_id,
duration_ms=duration_ms,
referrer=referrer,
payload=payload,
**database_params,
)

Expand Down

0 comments on commit e2182e4

Please sign in to comment.