Consume TRACEPARENT and TRACESTATE to construct the OTel trace context (#2763)

Signed-off-by: James Humphries <james@james-humphries.co.uk>
This commit is contained in:
James Humphries
2025-05-07 16:20:11 +01:00
committed by GitHub
parent 914f51ed5f
commit 19afe5ffbb
3 changed files with 45 additions and 10 deletions

View File

@@ -70,7 +70,7 @@ func main() {
func realMain() int {
defer logging.PanicHandler()
err := tracing.OpenTelemetryInit()
ctx, err := tracing.OpenTelemetryInit(context.Background())
if err != nil {
// openTelemetryInit can only fail if OpenTofu was run with an
// explicit environment variable to enable telemetry collection,
@@ -81,7 +81,6 @@ func realMain() int {
return 1
}
defer tracing.ForceFlush(5 * time.Second)
ctx := context.Background()
// At minimum, we emit a span covering the entire command execution.
ctx, span := tracing.Tracer().Start(ctx, "tofu")