You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/02/26 17:14:07 UTC

[GitHub] [superset] mistercrunch commented on a change in pull request #13346: feat: db connection analytics

mistercrunch commented on a change in pull request #13346:
URL: https://github.com/apache/superset/pull/13346#discussion_r583790887



##########
File path: superset/databases/commands/create.py
##########
@@ -69,8 +64,9 @@ def run(self) -> Model:
             security_manager.add_permission_view_menu("database_access", database.perm)
             db.session.commit()
         except DAOCreateFailedError as ex:
-            logger.exception(ex.exception)
-            raise DatabaseCreateFailedError()
+            with event_logger.log_context(action=f"db_creation_failed.{ex.exception}"):

Review comment:
       We may want to either 1) refactor `log` to do some of the magic in `log_context` maybe add a bool flag `enrich_with_request_context=False`, or 2) can we just call the context manager with the `with` block? Would that just work? or 3) refactor `log_context` to NOT be be context manager and create a new one say `log_context_manager` (or better name) that's used only when we want duration / with block




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org