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

Forward retryablehttp logs to tflog #374

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FabioBatSilva
Copy link

This PR is Introducing a adapter that sends retryablehttp logs to tflogs.

Current retryablehttp logs get double formatted by it's logger

{time} [DEBUG] provider.terraform-provider-confluent: {time} [DEBUG] {message}

Inspired by https://github.com/hashicorp/terraform-provider-http/blob/2982166a23c297b6e934c74539cc5e66c5eca056/internal/provider/data_source_http.go#L413-L444

See:
pulumi/pulumi-confluentcloud#48.
#372

@FabioBatSilva FabioBatSilva requested a review from a team as a code owner March 21, 2024 16:51
Copy link

cla-assistant bot commented Mar 21, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Fabio Silva seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
Copy link

cla-assistant bot commented Mar 21, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Fabio Silva seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@linouk23
Copy link
Collaborator

@FabioBatSilva thanks for creating the PR!

What would be the best way to test these changes locally? One option I see is checking whether HTTP call logs are no longer double-formatted:

{time} [DEBUG] provider.terraform-provider-confluent: {time} [DEBUG] {message}:

(for example, like the 2nd and the 3rd lines here)

2024-03-18T19:30:33.710-0400 [DEBUG] provider.terraform-provider-confluent: Reading Schema "xxxx-xxxxx/chesscom/xxxx.proto/latest": @module=provider tf_req_id=674347de-096d-5287-519d-d7afc4fbcb45 tf_resource_type=confluent_schema tf_rpc=ReadResource @caller=/terraform/terraform-provider-confluent/internal/provider/resource_schema.go:597 schema_id=xxxx-xxxxx/chesscom/xxxx.proto/latest tf_provider_addr=provider timestamp=2024-03-18T19:30:33.710-0400
2024-03-18T19:30:33.710-0400 [DEBUG] provider.terraform-provider-confluent: 2024/03/18 19:30:33 [DEBUG] GET https://xxxx.gcp.confluent.cloud/subjects/chesscom%2Fxxxx.proto/versions/latest
2024-03-18T19:30:33.941-0400 [DEBUG] provider.terraform-provider-confluent: 2024/03/18 19:30:33 [DEBUG] GET https://xxxx.gcp.confluent.cloud/schemas?subjectPrefix=chesscom%2Fxxxx.proto
2024-03-18T19:30:33.970-0400 [DEBUG] provider.terraform-provider-confluent: Fetched Schemas "xxxx-xxxxx/chesscom/xxxx.proto/latest": [...]: @caller=/terraform/terraform-provider-confluent/internal/provider/resource_schema.go:781 @module=provider schema_id=xxxx-xxxxx/chesscom/xxxx.proto/latest tf_resource_type=confluent_schema tf_rpc=ReadResource tf_provider_addr=provider tf_req_id=674347de-096d-5287-519d-d7afc4fbcb45 timestamp=2024-03-18T19:30:33.970-0400
2024-03-18T19:30:33.970-0400 [DEBUG] provider.terraform-provider-confluent: Fetched Schema "xxxx-xxxxx/chesscom/xxxx.proto/latest": {...}: schema_id=xxxx-xxxxx/chesscom/xxxx.proto/latest tf_provider_addr=provider tf_req_id=674347de-096d-5287-519d-d7afc4fbcb45 tf_rpc=ReadResource @caller=/terraform/terraform-provider-confluent/internal/provider/resource_schema.go:805 @module=provider tf_resource_type=confluent_schema timestamp=2024-03-18T19:30:33.970-0400
2024-03-18T19:30:33.970-0400 [DEBUG] provider.terraform-provider-confluent: Finished reading Schema "xxxx-xxxxx/chesscom/xxxx.proto/latest": tf_req_id=674347de-096d-5287-519d-d7afc4fbcb45 tf_rpc=ReadResource @caller=/terraform/terraform-provider-confluent/internal/provider/resource_schema.go:629 @module=provider schema_id=xxxx-xxxxx/chesscom/xxxx.proto/latest tf_provider_addr=provider tf_resource_type=confluent_schema timestamp=2024-03-18T19:30:33.970-0400

@FabioBatSilva
Copy link
Author

Hi,
Sorry forgot to include a example

When you run terraform with TF_LOG=DEBUG you should now see something like this :

2024-03-21T13:19:03.178-0400 [DEBUG] provider.terraform-provider-confluent: Reading Schema "xxxx-xxxxx/chesscom/xxxx.proto/latest": tf_provider_addr=provider @module=provider schema_id=xxxx-xxxxx/chesscom/xxxx.proto/latest tf_req_id=09ea3126-9554-ae6b-eb0a-e1972fbc0988 tf_resource_type=confluent_schema tf_rpc=ReadResource @caller=/workspace/terraform/terraform-provider-confluent/internal/provider/resource_schema.go:597 timestamp=2024-03-21T13:19:03.178-0400
2024-03-21T13:19:03.178-0400 [DEBUG] provider.terraform-provider-confluent: performing request: method=GET tf_req_id=c47bb9f6-4de8-0118-2dd0-fb7bbc4861d6 tf_rpc=Configure @caller=/workspace/terraform/terraform-provider-confluent/internal/provider/factory_utils.go:191 @module=provider tf_provider_addr=provider url="map[ForceQuery:false Fragment: Host:xxxx.gcp.confluent.cloud OmitHost:false Opaque: Path:/subjects/chesscom/xxxx.proto/versions/latest RawFragment: RawPath:/subjects/chesscom%2Fxxx.proto/versions/latest RawQuery: Scheme:https User:<nil>]" timestamp=2024-03-21T13:19:03.178-0400
2024-03-21T13:19:03.386-0400 [DEBUG] provider.terraform-provider-confluent: performing request: url="map[ForceQuery:false Fragment: Host:xxxx.gcp.confluent.cloud OmitHost:false Opaque: Path:/schemas RawFragment: RawPath: RawQuery:subjectPrefix=chesscom%2Fxxx.proto Scheme:https User:<nil>]" @module=provider tf_rpc=Configure tf_req_id=c47bb9f6-4de8-0118-2dd0-fb7bbc4861d6 @caller=/workspace/terraform/terraform-provider-confluent/internal/provider/factory_utils.go:191 method=GET tf_provider_addr=provider timestamp=2024-03-21T13:19:03.386-0400

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants