From 11d846486645ec6309c1d9f3d258e096264d4793 Mon Sep 17 00:00:00 2001 From: sankari gopalakrishnan Date: Wed, 19 Feb 2025 10:31:11 +0100 Subject: [PATCH 1/2] [Wf-Diagnostics] use current clustername for emission of usage logs --- service/worker/diagnostics/module.go | 4 ++++ service/worker/diagnostics/parent_workflow.go | 1 + service/worker/service.go | 1 + 3 files changed, 6 insertions(+) diff --git a/service/worker/diagnostics/module.go b/service/worker/diagnostics/module.go index 8f8b2c48a55..273fc1a4458 100644 --- a/service/worker/diagnostics/module.go +++ b/service/worker/diagnostics/module.go @@ -24,6 +24,7 @@ package diagnostics import ( "context" + "github.com/uber/cadence/common/cluster" "github.com/opentracing/opentracing-go" "github.com/uber-go/tally" @@ -54,6 +55,7 @@ type dw struct { tallyScope tally.Scope worker worker.Worker invariants []invariant.Invariant + clusterMetadata cluster.Metadata } type Params struct { @@ -64,6 +66,7 @@ type Params struct { Logger log.Logger TallyScope tally.Scope Invariants []invariant.Invariant + ClusterMetadata cluster.Metadata } // New creates a new diagnostics workflow. @@ -76,6 +79,7 @@ func New(params Params) DiagnosticsWorkflow { clientBean: params.ClientBean, logger: params.Logger, invariants: params.Invariants, + clusterMetadata: params.ClusterMetadata, } } diff --git a/service/worker/diagnostics/parent_workflow.go b/service/worker/diagnostics/parent_workflow.go index 70156bd67b1..5d53924f9ee 100644 --- a/service/worker/diagnostics/parent_workflow.go +++ b/service/worker/diagnostics/parent_workflow.go @@ -99,6 +99,7 @@ func (w *dw) DiagnosticsStarterWorkflow(ctx workflow.Context, params Diagnostics RunID: params.RunID, Identity: params.Identity, IssueType: getIssueType(diagWfResult), + Environment: w.clusterMetadata.GetCurrentClusterName(), DiagnosticsWorkflowID: childWfExec.ID, DiagnosticsRunID: childWfExec.RunID, DiagnosticsStartTime: childWfStart, diff --git a/service/worker/service.go b/service/worker/service.go index dfeb6e97ad8..42b92d80f97 100644 --- a/service/worker/service.go +++ b/service/worker/service.go @@ -350,6 +350,7 @@ func (s *Service) startDiagnostics() { ClientBean: s.GetClientBean(), Logger: s.GetLogger(), Invariants: s.params.DiagnosticsInvariants, + ClusterMetadata: s.GetClusterMetadata(), } if err := diagnostics.New(params).Start(); err != nil { s.Stop() From ffb32bb034455dfd4dda87df9f2906a246d0e92f Mon Sep 17 00:00:00 2001 From: sankari gopalakrishnan Date: Wed, 19 Feb 2025 11:00:46 +0100 Subject: [PATCH 2/2] Update module.go --- service/worker/diagnostics/module.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/worker/diagnostics/module.go b/service/worker/diagnostics/module.go index 273fc1a4458..947f60c5fe2 100644 --- a/service/worker/diagnostics/module.go +++ b/service/worker/diagnostics/module.go @@ -24,7 +24,6 @@ package diagnostics import ( "context" - "github.com/uber/cadence/common/cluster" "github.com/opentracing/opentracing-go" "github.com/uber-go/tally" @@ -35,6 +34,7 @@ import ( "github.com/uber/cadence/client" "github.com/uber/cadence/common" + "github.com/uber/cadence/common/cluster" "github.com/uber/cadence/common/log" "github.com/uber/cadence/common/messaging" "github.com/uber/cadence/common/metrics"