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

Provider spits out [DEBUG] messages in logs #48

Open
jkodroff opened this issue Nov 22, 2022 · 8 comments
Open

Provider spits out [DEBUG] messages in logs #48

jkodroff opened this issue Nov 22, 2022 · 8 comments
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec

Comments

@jkodroff
Copy link
Member

What happened?

In v1.5.0 of the provider, spinning up resources creates debug log output:

Diagnostics:
  pulumi:pulumi:Stack (workshop-confluent-dev):
    2022/11/22 15:33:33 [DEBUG] POST https://api.confluent.cloud/org/v2/environments
    2022/11/22 15:33:33 [DEBUG] GET https://api.confluent.cloud/org/v2/environments/env-xqprvk
    2022/11/22 15:33:34 [DEBUG] POST https://api.confluent.cloud/cmk/v2/clusters
    2022/11/22 15:33:40 [DEBUG] GET https://api.confluent.cloud/cmk/v2/clusters/lkc-j3ojrq?environment=env-xqprvk
    2022/11/22 15:33:40 [DEBUG] GET https://api.confluent.cloud/cmk/v2/clusters/lkc-j3ojrq?environment=env-xqprvk

Steps to reproduce

n/a

Expected Behavior

n/a

Actual Behavior

n/a

Output of pulumi about

No response

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@jkodroff jkodroff added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Nov 22, 2022
@guineveresaenger guineveresaenger self-assigned this Nov 22, 2022
@guineveresaenger guineveresaenger removed the needs-triage Needs attention from the triage team label Nov 22, 2022
@AaronFriel
Copy link

@jkodroff could you drop a github repro or gist with a program creating resources to repro?

@jkodroff
Copy link
Member Author

jkodroff commented Apr 4, 2023

@ebertn
Copy link

ebertn commented Aug 18, 2023

This is happening with us as well 👍. Would love it if this became optional, as it is occasionally useful for debugging.

@FabioBatSilva
Copy link

We have hundreds of topics/schema in terraform currently and trying migrate into Pulumi,
The amount of noise this generates makes the pulumi output unusable..

Can someone please help describe what needs to happen here ?
If no one is looking into it i'm happy to give it a try.

@praneetloke
Copy link
Contributor

@FabioBatSilva the debug messages appear to be from the upstream provider's use of go-retryablehttp. Specifically, if you look at https://github.com/hashicorp/go-retryablehttp/blob/main/client.go#L609-L616 in that library, it seems to use the default logger instance which logs via stderr. So yeah the upstream provider either needs to provides its own logger or should set it to nil when constructing an instance of the HTTP client from go-retryablehttp.

@FabioBatSilva
Copy link

Thanks @praneetloke.

I was able to get some log entries on the tf provider.

When running terraform with debug enabled i get :

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 

Is the parsing here breaking the on pulumi side bc of the double [DEBUG] ?

@praneetloke
Copy link
Contributor

praneetloke commented Mar 19, 2024

@FabioBatSilva Ah I wasn't aware of that part in the bridge repo honestly.

Is the parsing here breaking the on pulumi side bc of the double [DEBUG] ?

Maybe this line since there are two ]s: https://github.com/pulumi/pulumi-terraform-bridge/blob/master/pkg/tfbridge/log.go#L94, so the end index of ] would be incorrect and therefore the extracted substring would be incorrect and not match any of the expected prefixes. (This wouldn't be the case since IndexRune returns the first match.) You could try to reproduce that with a test in log_test.go and maybe propose a fix.

EDIT: Note that the double [DEBUG] situation is only when you enable the TF debug mode. Under normal conditions, that's not the case. So maybe the log redirector is seeing it as [INFO] [DEBUG] and is therefore routing the debug message from go-retryablehttp as though it were an info message. I still think your best bet is to make a fix in the upstream provider at the location I linked in my previous comment.

@FabioBatSilva
Copy link

I tried to reproduce the issue with log_test but it seems ok, Maybe that is happening somewhere else..

I'v opened a PR to provide a logger for retryablehttp
confluentinc/terraform-provider-confluent#374

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

6 participants