From 97635ec9d8356ffcb88ae3a788f4ba9c51e4d46b Mon Sep 17 00:00:00 2001 From: Garrett Date: Wed, 18 May 2022 17:20:46 +0000 Subject: [PATCH] Add stages to all proto.Logs --- provisionerd/provisionerd.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/provisionerd/provisionerd.go b/provisionerd/provisionerd.go index 28475455182ed..56f2707a1bf18 100644 --- a/provisionerd/provisionerd.go +++ b/provisionerd/provisionerd.go @@ -630,6 +630,7 @@ func (p *Server) runTemplateImportParse(ctx context.Context, provisioner sdkprot Level: msgType.Log.Level, CreatedAt: time.Now().UTC().UnixMilli(), Output: msgType.Log.Output, + Stage: "Parse parameters", }}, }) if err != nil { @@ -651,6 +652,13 @@ func (p *Server) runTemplateImportParse(ctx context.Context, provisioner sdkprot // This is used to detect resources that would be provisioned // for a workspace in various states. func (p *Server) runTemplateImportProvision(ctx, shutdown context.Context, provisioner sdkproto.DRPCProvisionerClient, job *proto.AcquiredJob, values []*sdkproto.ParameterValue, metadata *sdkproto.Provision_Metadata) ([]*sdkproto.Resource, error) { + var stage string + switch metadata.WorkspaceTransition { + case sdkproto.WorkspaceTransition_START: + stage = "Detecting persistent resources" + case sdkproto.WorkspaceTransition_STOP: + stage = "Detecting ephemeral resources" + } stream, err := provisioner.Provision(ctx) if err != nil { return nil, xerrors.Errorf("provision: %w", err) @@ -704,6 +712,7 @@ func (p *Server) runTemplateImportProvision(ctx, shutdown context.Context, provi Level: msgType.Log.Level, CreatedAt: time.Now().UTC().UnixMilli(), Output: msgType.Log.Output, + Stage: stage, }}, }) if err != nil { @@ -808,6 +817,7 @@ func (p *Server) runWorkspaceBuild(ctx, shutdown context.Context, provisioner sd Level: msgType.Log.Level, CreatedAt: time.Now().UTC().UnixMilli(), Output: msgType.Log.Output, + Stage: stage, }}, }) if err != nil {