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

tfprotov5/tf5server+tfprotov6/tf6server: Add downstream RPC request duration and response diagnostics logging #203

Merged
merged 4 commits into from Jul 5, 2022

Conversation

bflad
Copy link
Member

@bflad bflad commented Jul 1, 2022

Closes #183

…uration and response diagnostics logging

Reference: #183
@bflad bflad added the enhancement New feature or request label Jul 1, 2022
@bflad bflad added this to the v0.10.0 milestone Jul 1, 2022
@bflad bflad requested a review from a team as a code owner July 1, 2022 11:45
@bflad
Copy link
Member Author

bflad commented Jul 1, 2022

This is now verified via unit testing and I also ensured it worked with a real provider:

2022-07-01T08:36:45.801-0400 [TRACE] sdk.proto: Received downstream response: tf_proto_version=6.0 tf_provider_addr=registry.terraform.io/hashicorp/tls tf_req_id=074ddc8e-8c18-13bc-269b-b58fcb30a223 tf_resource_type=tls_self_signed_cert tf_rpc=ApplyResourceChange diagnostic_error_count=1 diagnostic_warning_count=0 tf_req_duration_ms=1
2022-07-01T08:36:45.801-0400 [ERROR] sdk.proto: Response contains error diagnostic: tf_proto_version=6.0 tf_provider_addr=registry.terraform.io/hashicorp/tls tf_req_id=074ddc8e-8c18-13bc-269b-b58fcb30a223 tf_resource_type=tls_self_signed_cert tf_rpc=ApplyResourceChange diagnostic_detail="Could not determine Authority Key Identifier" diagnostic_severity=ERROR diagnostic_summary="Invalid Certificate Authority"
2022-07-01T08:36:45.801-0400 [TRACE] sdk.proto: Served request: tf_proto_version=6.0 tf_provider_addr=registry.terraform.io/hashicorp/tls tf_req_id=074ddc8e-8c18-13bc-269b-b58fcb30a223 tf_resource_type=tls_self_signed_cert tf_rpc=ApplyResourceChange
2022-07-01T08:36:45.866-0400 [TRACE] sdk.helper_resource: Called Terraform CLI apply command: test_name=TestResourceSelfSignedCert_InvalidConfigs test_step_number=5 test_terraform_path=/usr/local/bin/terraform test_working_directory=/var/folders/w8/05f3x02n27x72g0mc2jy6_180000gp/T/plugintest3614426453
2022-07-01T08:36:45.866-0400 [WARN]  sdk.helper_resource: Error running Terraform CLI command: test_name=TestResourceSelfSignedCert_InvalidConfigs test_step_number=5 test_terraform_path=/usr/local/bin/terraform test_working_directory=/var/folders/w8/05f3x02n27x72g0mc2jy6_180000gp/T/plugintest3614426453
  error=
  | exit status 1
  |
  | Error: Invalid Certificate Authority
  |
  |   with tls_self_signed_cert.test,
  |   on terraform_plugin_test.tf line 2, in resource "tls_self_signed_cert" "test":
  |    2: 					resource "tls_self_signed_cert" "test" {
  |
  | Could not determine Authority Key Identifier

Copy link
Contributor

@bendbennett bendbennett left a comment

Choose a reason for hiding this comment

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

LGTM

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.

LGTM, but I do have a question in regards to the use of struct instead of string for storing the requestStart time in the context.

I'm sure I'm missing something.

@bflad bflad merged commit e4b1fd9 into main Jul 5, 2022
@bflad bflad deleted the bflad-server-response-logging branch July 5, 2022 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider Logging Fields for RPC Duration and Diagnostic Counts/Messages
3 participants