-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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(alerts & reports): Easier to read execution logs #13752
feat(alerts & reports): Easier to read execution logs #13752
Conversation
Codecov Report
@@ Coverage Diff @@
## master #13752 +/- ##
==========================================
+ Coverage 75.56% 77.56% +1.99%
==========================================
Files 935 935
Lines 47275 47286 +11
Branches 5883 5883
==========================================
+ Hits 35725 36679 +954
+ Misses 11375 10463 -912
+ Partials 175 144 -31
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Why do we have duplicate execution IDs in the screenshot? Is it because of testing? |
def upgrade(): | ||
op.add_column( | ||
'report_execution_log', | ||
sa.Column('execution_id', sa.VARCHAR(length=50), nullable=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we simply call it uuid
and use sa.Column('uuid', UUIDType(binary=True))
just to be consistent with other entities in Superset?
sa.Column( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! I wasn't aware there was a column type specifically for UUID's.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we'll be having multiple log entries with the same UUID, would it be confusing to name the column uuid
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can call it UUID internally and just change the display name.
@ktmud The screenshot is of the execution log, so multiple entries for each alert/report execution is expected. The id is tied to a single execution/run, for which there will be multiple log entries. The id makes it easier to visually group the logs for each run. @jfrag1 Do we have designs for this? Wondering if adding the "Execution ID" after "State" makes more sense |
@nytai No, I'm not aware of any designs. It would be good to get some designer eyes on this. |
What does the log page as a whole look like? I think a simple way to improve the visual grouping is to maybe set |
I think it's also possible for runs to overlap. Eg, if one execution is taking a while (slow query, capturing screenshot) and the next execution begins. |
Hey, just catching up with context here! Is this PR referring to the log that appears after clicking the I worked on designs for alerts & reports a while ago. There weren't any designs produced for the log at the time since the team wasn't sure columns would need to be included. If this is what i think it is, some thoughts -
|
@mihir174 Yes, this is the log shown after clicking the |
❗ Please consider rebasing your branch to avoid db migration conflicts. |
fb7283e
to
2bdc232
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, left a couple of comments. We should also update tests and make sure we get these exact columns there, here: https://github.com/apache/superset/blob/master/tests/reports/api_tests.py#L1074
@@ -171,6 +172,7 @@ class ReportExecutionLog(Model): # pylint: disable=too-few-public-methods | |||
|
|||
__tablename__ = "report_execution_log" | |||
id = Column(Integer, primary_key=True) | |||
uuid = Column(UUIDType(binary=True)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should think about moving out of sqlalchemy_utils...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're already pretty tied to it - this doesn't tie us any deeper. I think it's OK for now.
superset/reports/commands/execute.py
Outdated
@@ -403,6 +407,7 @@ def __init__( | |||
self._session = session | |||
self._report_schedule = report_schedule | |||
self._scheduled_dttm = scheduled_dttm | |||
self._execution_id = uuid4() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you checked if we can use celery's UUID, and pass it into the AsyncExecuteReportScheduleCommand
constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The closest thing I found to this is this Github issue, but it only described how it could be done when triggering tasks with delay
or apply_async
, and I wasn't sure how to do it for a task triggered by a beat schedule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually scratch that, I tweaked my Google search and found this, let me see if I can get it to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The delay
is invoked by the caller.
use <job_name>.request.id
to get the id, then use it here:
https://github.com/apache/superset/blob/master/superset/tasks/scheduler.py#L67
on this case should be execute.request.id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if you need to use the bind=True
and then self.request.id
to bind the function to the task class.
https://docs.celeryproject.org/en/latest/userguide/tasks.html?highlight=requestcontext#basics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, execute.request.id
worked!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@jfrag1 I think this needs a rebase. |
On it! |
aa48d1a
to
039f056
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* master: (56 commits) test: Adds tests and storybook to CertifiedIcon component (#13457) chore: Moves CheckboxIcons to Checkbox folder (#13459) chore: Removes Popover duplication (#13462) build(deps): bump elliptic from 6.5.3 to 6.5.4 in /docs (#13527) fix: allow spaces in DB names (#13800) chore: Update PR template for SIP-59 DB migrations process (#13855) Add CODEOWNERS (#13759) feat(alerts & reports): Easier to read execution logs (#13752) fix: Disallows negative options remaining (#13749) Fix broken link (#13861) fix(native-filters): add global async query support to native filters (#13837) Displays row limit warning with Alert component (#13854) fix(errors): Downgrade error on stop query to a warning (#13826) fix(alerts and reports): Unify timestamp format on execution log view (#13718) fix(sqllab): warning message when rows limited (#13841) chore: add success log whenever a connection is working (#13811) fix(native-filters): improve loading styles for filter component (#13794) chore: update change log with cherry-picks for release 1.1 (#13824) feat: added support to configure the default explorer viz (#13610) fix(#13734): Properly escape special characters in CSV output (#13735) ...
* Prep for migration * Migration for execution id column * Generate execution ids for alerts and reports * Change execution id range * Add execution id to API endpoint * Add execution id to execution log view * Change execution id range * Change execution id to a uuid * Fix execution id type * Switch state and exec. id columns * Change db column to UUIDType * Python lint * Fix failing frontend tests * execution_id -> uuid * Fix migration head * lint * Use celery task id as the execution id * lint * lint for real * Fix tests
|
||
|
||
def downgrade(): | ||
op.drop_column("report_execution_log", "execution_id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The column execution_id
doesn't exist.
SUMMARY
Currently, reading execution logs for alerts and reports can be confusing. Several log entries can be created by a single execution run, but nothing indicates that they are part of the same execution, except that they have the same timestamp.
This PR gives each execution a UUID which is truncated to 6 characters on the execution log view. This way, it will be much easier to tell which log entries belong to which execution.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
After:
TEST PLAN
I've only tested manually.
ADDITIONAL INFORMATION