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

tfsdk: Added logging for all framework handoffs to provider defined logic #300

Merged
merged 5 commits into from Apr 25, 2022

Conversation

bflad
Copy link
Member

@bflad bflad commented Apr 22, 2022

This will help practitioners and provider developers further understand when and where logic handoffs occur. In general, the framework and underlying terraform-plugin-go use the DEBUG log level for project code boundaries and major logic milestones while the TRACE log level is used for more lower level logic details.

@bflad bflad added the enhancement New feature or request label Apr 22, 2022
@bflad bflad added this to the v0.7.0 milestone Apr 22, 2022
@bflad bflad requested a review from a team as a code owner April 22, 2022 15:28
bflad added a commit that referenced this pull request Apr 22, 2022
…ogic

This will help practitioners and provider developers further understand when and where logic handoffs occur. In general, the framework and underlying terraform-plugin-go use the `DEBUG` log level for project code boundaries and major logic milestones while the `TRACE` log level is used for more lower level logic details.
Copy link
Contributor

@detro detro left a comment

Choose a reason for hiding this comment

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

I read your description about why using DEBUG for these new logs instead of TRACE: the reasoning makes sense, but I'm concerned how much more logging this is going to create.

Yes, the fact that user can filter by sub-system seems the way out of it, but... it's still a lot more logging.

I can't raise an argument against it more than "are you sure?", because codewise this LGTM.

@bflad
Copy link
Member Author

bflad commented Apr 25, 2022

Rebased on main and ensured that TypeWithValidate calls within the tfsdk package are also logged similarly. It felt like it'd be handy to have a quick helper to add attribute path context, so introduced FrameworkWithAttributePath() to simplify the implementation for places that needed it. Not sure if you want to review e5b70c3 as well.

it's still a lot more logging

It is! However, I'm expecting there to be a lot more TRACE logging, especially in the internal/reflect package, as there are still pieces of the framework which are hard to troubleshoot. I'd like to avoid the requirement for maintainers and provider developers to need a debugger tool where possible, since doing that with production usage is a large lift for everyone involved.

If the logging does wind up being too noisy, there are few options at any point (as I wouldn't expect too much of the log handling to be explicitly within any compatibility promises):

  • Ensuring folks know about the TF_LOG_SDK_FRAMEWORK environment variable
  • Splitting out additional logging subsystems, which can be disabled if desired
  • Working on our vision of building CLI tooling or recommendations to parse framework provider logging that are captured at high fidelity
  • (More last resort, IMO) Downgrading schema-induced logging as TRACE, as this will emit the most entries for most resources

@bflad bflad merged commit bbf6bdf into main Apr 25, 2022
@bflad bflad deleted the bflad-always-be-logging branch April 25, 2022 19:46
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants