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.
CATEGORY
Choose one
SUMMARY
Current incarnation of "event logger" is an "abstract base class", but in practice its usefulness is tightly coupled to the DBEventLogger implementation, which in turn is tightly coupled to a mandatory db migration ('logs' table). The base class itself has a completely untyped interface (args and kwargs), but the
DBEventLogger
impl relies on very specific (but not codified-via-interface) kwargs to be in the incoming messages. Those kwargs are put there by thelog_this
decorator which is scattered across the codebase, which means that if you have DBEventLogger configured you can't actually use this AbstractEventLogger outside of thelog_this
decorator unless you know the specific schema that the DBEventLogger expects to find in the untyped args and kwargs data it receives (which are very request-logging specific fields).This change is a first step to move logging towards a standard logging based approach with clearer data types with crisp responsibilities surrounding the logging of various event types, and brings the following changes:
superset_events
loggerlog_this
is renamed tolog_requests
to more clearly document what it is passing and persisting to theDBEventLogger
, and now is logging an event through event logger prior to sending toDBEventLogger
LoggingConfigurator
is added to allow local installations to configure a custom handler for eventsquery
event to to event logger prior to calling the configured query loggercsv_export
event to logsFuture work:
log_requests
out of AbstactEventLogger base and into its own decorator type which can use an event logger to log events, meaning we can also remove the existing call tolog
method (leaving onlylog_event
call)DBEventLogger
into alogging.Handler
impl that looks forendpoint_invocation
events and does the db persistence that it does todayAbstractEventLogger
toEventLogger
afterQUERY_LOGGER
, that can be handled by registering logging.Handler impls that act upon incomingquery
event types.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
ADDITIONAL INFORMATION
REVIEWERS
@mistercrunch @betodealmeida @john-bodley @graceguo-supercat @dpgaspar