Skip to content
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

[#4337] Always create an invocation_id, even when not tracking #4340

Merged
merged 1 commit into from
Nov 24, 2021

Conversation

gshank
Copy link
Contributor

@gshank gshank commented Nov 24, 2021

resolves #4337

Description

For logging purposes we always want an invocation_id, even when we're not tracking. This pull request decouples the invocation_id from dbt.tracking.active_user.

I've added a 'get_invocation_id' class method to the base Event class, but I put the generic 'get_invocation_id' and the global variable invocation_id in dbt.events.functions, because that felt more appropriate and I don't think we want to import the base_types file everywhere that we're setting the invocation_id. That meant that I had to do the import of get_invocation_id in the Event.get_invocation_id function to avoid circular imports. Let me know if you see a better way of doing that.

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change

Copy link
Contributor

@nathaniel-may nathaniel-may left a comment

Choose a reason for hiding this comment

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

This looks great! The last step to get it into the json log messages would be to add invocation_id: e.get_invocation_id() to this dict

@nathaniel-may nathaniel-may mentioned this pull request Nov 24, 2021
26 tasks
@gshank gshank merged commit 36776b9 into main Nov 24, 2021
@gshank gshank deleted the 4337_always_invocation_id branch November 24, 2021 21:54
iknox-fa pushed a commit that referenced this pull request Feb 8, 2022
iknox-fa pushed a commit that referenced this pull request Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure that all dbt invocations have an invocation_id
2 participants