mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
command: Meta.RunOperation takes a context.Context
This is part of an ongoing effort to plumb a properly-connected series of contexts through all of the layers where we might want to generate telemetry (or similar) in future. This is _just enough_ to connect the top-level context created by package main with the various child contexts created by the local backend, so that they could in principle access the root span that package main generates. This is not yet sufficient to propagate the context all the way into the language runtime. More plumbing to follow in later commits! This intentionally does not introduce any new OpenTelemetry-specific context: the goal is only to get the context chain in place so that we can use it for telemetry delivery in future. Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
This commit is contained in:
@@ -488,7 +488,7 @@ func (m *Meta) CommandContext() context.Context {
|
||||
// If the operation runs to completion then no error is returned even if the
|
||||
// operation itself is unsuccessful. Use the "Result" field of the
|
||||
// returned operation object to recognize operation-level failure.
|
||||
func (m *Meta) RunOperation(b backend.Enhanced, opReq *backend.Operation) (*backend.RunningOperation, tfdiags.Diagnostics) {
|
||||
func (m *Meta) RunOperation(ctx context.Context, b backend.Enhanced, opReq *backend.Operation) (*backend.RunningOperation, tfdiags.Diagnostics) {
|
||||
if opReq.View == nil {
|
||||
panic("RunOperation called with nil View")
|
||||
}
|
||||
@@ -505,7 +505,7 @@ func (m *Meta) RunOperation(b backend.Enhanced, opReq *backend.Operation) (*back
|
||||
return nil, diags
|
||||
}
|
||||
|
||||
op, err := b.Operation(context.Background(), opReq)
|
||||
op, err := b.Operation(ctx, opReq)
|
||||
if err != nil {
|
||||
return nil, diags.Append(fmt.Errorf("error starting operation: %w", err))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user