Skip to content

JSON serialize Log extras#9452

Closed
joshowen wants to merge 1 commit intoapache:masterfrom
joshowen:json-serialize-extras
Closed

JSON serialize Log extras#9452
joshowen wants to merge 1 commit intoapache:masterfrom
joshowen:json-serialize-extras

Conversation

@joshowen
Copy link
Contributor

It would be very useful to be able to query the the logged extras, to determine if a trigger has a configuration, or a clear operation is confirmed.


Make sure to mark the boxes below before creating PR: [x]

  • Description above provides context of the change
  • Unit tests coverage for changes (not needed for documentation changes)
  • Target Github ISSUE in description if exists
  • Commits follow "How to write a good git commit message"
  • Relevant documentation is updated including usage instructions.
  • I will engage committers as explained in Contribution Workflow Example.

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.
Read the Pull Request Guidelines for more information.

@boring-cyborg boring-cyborg bot added the area:webserver Webserver related Issues label Jun 20, 2020
@boring-cyborg
Copy link

boring-cyborg bot commented Jun 20, 2020

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst)
Here are some useful points:

  • Pay attention to the quality of your code (flake8, pylint and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it’s a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Be sure to read the Airflow Coding style.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://apache-airflow-slack.herokuapp.com/

task_instance=None,
owner=user,
extra=str(list(request.values.items())),
extra=json.dumps(request.values),
Copy link
Member

Choose a reason for hiding this comment

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

Why not fetch str and handle serialization on the client-side?

Copy link
Contributor Author

@joshowen joshowen Jun 20, 2020

Choose a reason for hiding this comment

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

The current setup doesn't produce valid json, because it is a list of tuples. It would also be very helpful to be able to query this information in the database, since important context lives in the extra, eg whether or not a clear was confirmed, or a trigger had a conf.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kaxil to give more color, we've built an "Airflow Snitch" which alerts based on some user actions (eg user cleared a production DAG). This relies on parsing the extra field to determine if the job was actually cleared since there are two trigger events, and only the confirmed event causes an action.

We've hacked together some extra field parsing, but it isn't very elegant, and this could be done a lot more efficiently in the database if the column was valid json.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the explanation, can you add a test, please

@joshowen joshowen changed the title JSON serialize logged extras JSON serialize Log extras Jun 20, 2020
@stale
Copy link

stale bot commented Aug 22, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Aug 22, 2020
@stale stale bot closed this Aug 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:webserver Webserver related Issues stale Stale PRs per the .github/workflows/stale.yml policy file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants