Skip to content

Add Audit Log View to Dag View - #20733

Merged
potiuk merged 27 commits into
apache:mainfrom
Acehaidrey:main
Feb 12, 2022
Merged

potiuk merged 27 commits into
apache:mainfrom
Acehaidrey:main

Conversation

@Acehaidrey

@Acehaidrey Acehaidrey commented Jan 6, 2022 •

Copy link
Copy Markdown
Contributor

A common use case for our users is that they want to know exactly what actions pertain to their dags. This is partially available because Airflow as a system allows for event logging, but these event logs have a ton of noise. Each organization may only care about certain events only - maybe some want only POST events, some could want all events minus system generated events, others could want to see them all. The fact is, this is all available but to present this data could be useful if we have it just on the dag view level. In this case, we filter the view to just display events for the specific dag of course, and we provide in the airflow.cfg a way to only filter based on events they care for. The screenshots below capture this, and how can interact with this.
In this view too, there is a link back to the Log View which will have all events. We simply put the events of the last X days (default it to 31 in the cfg) but we can change this behavior if the open source community doesn't like it. It is primarily meant to allow users to know who cleared the dag, or marked a date or anything of that sort recently. Actions that would directly affect the run of the workflow.

First screenshots are just of all the records, but later on we use the below settigns to remove the excluded events to show they will not be displayed either.

# Number of dags to look back for dag audit log view
audit_trail_query_days = 31

# Types of events to ignore for dag audit log view
# E.g. excluded_events = dagrun_success,landing_times
audit_view_excluded_events = tree,running

# Types of events to include for dag audit log view
# e.g. included_events = dagrun_cleared,failed
audit_view_included_events =

Screen Shot 2022-02-04 at 1 18 10 AM

Screen Shot 2022-01-06 at 1 00 28 PM

Screen Shot 2022-01-06 at 1 02 10 PM

Screen Shot 2022-01-06 at 2 06 53 PM

Screen Shot 2022-01-06 at 12 57 43 PM

This PR is ready for merging as it doesn't touch any new major components, but any concerns can be discussed and altered.


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

@boring-cyborg boring-cyborg Bot added area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues labels Jan 6, 2022
Comment thread airflow/www/views.py Resolved
Comment thread airflow/www/templates/airflow/dag.html Resolved

@bbovenzi bbovenzi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work! I left a few comments on some improvements to make here and there.

Also, could you provide an example of an event that has comments in the screenshots?

@Acehaidrey

Copy link
Copy Markdown
Contributor Author

Thank you both for your review @SamWheating and @bbovenzi . Addressed the comments . Waiting on the build to run, testing to see and will reach out again after for a last review!

Comment thread airflow/www/views.py Resolved
@bbovenzi

Copy link
Copy Markdown
Contributor

I was thinking, should we even have any of this in the config? I think a better UX would be to show all possible events on the page and allow a user to check/uncheck each as they wish. Therefore on the page, a user immediately knows which types of events they can see instead of having to look at the config.

@wolfier

wolfier commented Jan 19, 2022

Copy link
Copy Markdown
Contributor

I wonder if something like the All Instances button in the task instance modal can be added as well. The button would link to the audit log browse view with pre-applied filters for the dag / task.

Screen Shot 2022-01-19 at 2 56 00 PM

@Acehaidrey

Copy link
Copy Markdown
Contributor Author

Hey @SamWheating @bbovenzi I think this PR is officially complete for what it set out to complete. If you don't mind taking a look I fixed the tests/checks.
I added new screenshot too.

Next steps will be described in followup. Is slack or email best to do that conversation?

Comment thread airflow/www/templates/airflow/dag.html Resolved
Comment thread airflow/config_templates/config.yml Resolved

@bbovenzi bbovenzi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great work!

@github-actions

github-actions Bot commented Feb 7, 2022

Copy link
Copy Markdown
Contributor

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

@github-actions github-actions Bot added the full tests needed We need to run full set of tests for this PR to merge label Feb 7, 2022
@Acehaidrey

Copy link
Copy Markdown
Contributor Author

I have tried everything I can to get the docker-compose quick start test to complete successfully. I see other PRs also failing similarly.

@potiuk

potiuk commented Feb 8, 2022

Copy link
Copy Markdown
Member

I have tried everything I can to get the docker-compose quick start test to complete successfully. I see other PRs also failing similarly.

Yeah. Smth wrong with it - I will take a look today to see if I can fix it.

@Acehaidrey

Copy link
Copy Markdown
Contributor Author

thank you @potiuk ! Let me know if I can help too. Would be interested but need to learn about git actions a bit more to help here

@Acehaidrey

Copy link
Copy Markdown
Contributor Author

Finally thank you @potiuk it is good :) Do I need to do anything else for this to be merged?

@potiuk
potiuk merged commit 5590e98 into apache:main Feb 12, 2022
@potiuk

potiuk commented Feb 12, 2022

Copy link
Copy Markdown
Member

Finally thank you @potiuk it is good :) Do I need to do anything else for this to be merged?

Nope. Just merged! Great job. Audit log view has been a highly requested feature !

@Acehaidrey

Copy link
Copy Markdown
Contributor Author

Thank you so much! Glad can help and had a lot of help from Sam + Brent here. I'll start the discussion in the slack about the improvements discussed.

@jedcunningham jedcunningham added the type:new-feature Changelog: New Features label Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues full tests needed We need to run full set of tests for this PR to merge type:new-feature Changelog: New Features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants