Closed t0yv0 closed 1 year ago
I believe this is already supported, and the comment just refers to the fact that --tracing
should be passed through by the flag group in tfbridge/main.go
and is handled by the flag parser in pulumi/pulumi/pkg/resource/provider/main.go:Main
.
The server spans seem to show up in the tracing results. I also tested this with a custom span inside tfbridge, which also showed up in the correct place.
Hmm, thank you for double-checking this, looks like I didn't do due diligence here framing the problem. This is good news for the most part! I suspect we might be able to add spans inside the provider then and they will show up if they are on the gRPC invocation path.
Since we're looking at this, could you verify for me if adding spans before the server has started the gRPC conversation is also supported (showing up in the trace)?
https://github.com/pulumi/pulumi-terraform-bridge/blob/rc%2Fv3.63.0/pkg/tfbridge/serve.go#L29
Somewhere around here --^
We have costly calls such as NewProvider that could be interesting. Making a span around provider construction in Provider() such as here:
Could be interesting as well.
Do these spans show up? And if not could we look into making them show up?
Both of these spans can show up with some slight modifications to allow earlier handling of the --tracing
flag.
I've only managed to make them show up outside of the span tree though - not sure how we'd pass the context to the provider binary during startup.
I'll make PRs with these changes and we can further investigate passing the parent span to the provider binary at startup after.
show up outside of the span tree though
Yes they would need to show up outside of the span tree. To show them in context, we'd have to have an out-of-band channel for the Span ID, perhaps encoded in the --tracing
string. That'd be an enhancement for later though.
I'd really appreciate a PR with a test here to make sure we can add these spans even if they're uncorrelated. Going to be a great help!
https://github.com/pulumi/pulumi-gcp/pull/1289 has an example of setting up tracing in the provider in order to instrument the initialization. To fully support this for all providers, we'd need to address https://github.com/pulumi/pulumi-terraform-bridge/issues/1487.
Cannot close issue:
resolution/
Please fix these problems and try again.
Hello!
Issue details
Bridged providers should support
--tracing
flag when sent from Pulumi. Per this:https://github.com/pulumi/pulumi-terraform-bridge/blob/18166cfd12a4e458c9f269c15778fbe853acbd97/pkg/tfbridge/main.go#L38-#L38
this flag is not supported yet.
What it should do is introduce an OpenTracingServerInterceptor into the gRPC services of the bridged provider. An example of doing that can be found in:
https://github.com/pulumi/pulumi/blob/9f85e7a3dedbab67f8bc7f9f3ffa8d68cd29f65f/pkg/resource/deploy/source_eval.go#L610-#L610
Affected area/feature