Files
opentf/internal/tofu/node_provider_test.go
Martin Atkins 914f51ed5f tofu: Initial OTel tracing of individual graph nodes
This commit begins the introduction of OpenTelemetry tracing into the
implementations of individual graph node types in the language runtime.

It's tempting to just plumb this in centrally in ContextGraphWalker for all
graph nodes, but our intention is for the trace output to correspond as
much as possible to the OpenTofu user experience rather than its
implementation details, and the execution graph is _very much_ an
implementation detail with many aspects that have no direct manifestation
in the UI.

With that in mind, this focuses only on capturing traces for graph node
types that fit into one or more of the following categories:
 - Corresponds to something we already announce in the UI output today.
 - Can cause at least one provider gRPC (or other similar) request to occur
   and so makes a good parent for later-added traces of those requests.
 - Has an execution time that depends on something outside of OpenTofu's
   direct control, such as interactive input which takes as long as the
   user takes to answer the prompts. (Including these helps account for
   this time separately from the time when OpenTofu was doing useful work.)

As long as our focus continues to be on echoing concepts we expect users
will already be familiar with from their use of OpenTofu, this probably
represents the deepest level of detail we ought to represent for the
purposes of describing OpenTofu's conceptual process. In a future commit
we'll add one extra level of nested spans beneath this one representing
directly the gRPC requests we're making to providers, since those spans
will represent the handoff to a potential sub-trace generated by the
provider plugin itself once we've established a mechanism for providers to
discover their trace parent.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-05-07 08:12:13 -07:00

16 KiB