From 49ed6929928f327372b9b73fa811ab17a3f1627c Mon Sep 17 00:00:00 2001 From: Bowen Xiao Date: Thu, 1 Aug 2024 15:37:43 -0700 Subject: [PATCH 1/2] handle index name and table name to avoid nil pointer --- service/worker/esanalyzer/analyzer.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/service/worker/esanalyzer/analyzer.go b/service/worker/esanalyzer/analyzer.go index 6a11722b3ec..5e31a62db2b 100644 --- a/service/worker/esanalyzer/analyzer.go +++ b/service/worker/esanalyzer/analyzer.go @@ -119,10 +119,17 @@ func New( config *Config, ) *Analyzer { var mode readMode + var indexName string + var pinotTableName string + if esClient != nil { mode = ES + indexName = esConfig.Indices[common.VisibilityAppName] + pinotTableName = "" } else if pinotClient != nil { mode = Pinot + indexName = "" + pinotTableName = pinotConfig.Table } return &Analyzer{ @@ -134,8 +141,8 @@ func New( readMode: mode, logger: logger, tallyScope: tallyScope, - visibilityIndexName: esConfig.Indices[common.VisibilityAppName], - pinotTableName: pinotConfig.Table, + visibilityIndexName: indexName, + pinotTableName: pinotTableName, resource: resource, domainCache: domainCache, config: config, From f7b0573e92a6073ddde7abdda7cf19778ebddd21 Mon Sep 17 00:00:00 2001 From: Bowen Xiao Date: Thu, 1 Aug 2024 17:57:28 -0700 Subject: [PATCH 2/2] delete the offset clause --- service/worker/esanalyzer/domainWorkflowTypeCountWorkflow.go | 1 - service/worker/esanalyzer/workflow.go | 2 -- 2 files changed, 3 deletions(-) diff --git a/service/worker/esanalyzer/domainWorkflowTypeCountWorkflow.go b/service/worker/esanalyzer/domainWorkflowTypeCountWorkflow.go index cdd2cd6d6f6..9ccd173fb43 100644 --- a/service/worker/esanalyzer/domainWorkflowTypeCountWorkflow.go +++ b/service/worker/esanalyzer/domainWorkflowTypeCountWorkflow.go @@ -182,7 +182,6 @@ AND StartTime > 0 GROUP BY WorkflowType ORDER BY count LIMIT 10 -OFFSET 0 `, w.analyzer.pinotTableName, domain.GetInfo().ID), nil } diff --git a/service/worker/esanalyzer/workflow.go b/service/worker/esanalyzer/workflow.go index be1dcd80547..80e01ec5f07 100644 --- a/service/worker/esanalyzer/workflow.go +++ b/service/worker/esanalyzer/workflow.go @@ -164,7 +164,6 @@ WHERE DomainID = '%s' GROUP BY WorkflowType ORDER BY count DESC LIMIT 10 -OFFSET 0 `, w.analyzer.pinotTableName, domain.GetInfo().ID), nil } @@ -185,7 +184,6 @@ WHERE DomainID = '%s' GROUP BY JSON_EXTRACT_SCALAR(Attr, '$.CadenceChangeVersion', 'STRING_ARRAY') AS CadenceChangeVersion ORDER BY count DESC LIMIT 10 -OFFSET 0 `, w.analyzer.pinotTableName, domain.GetInfo().ID, wfType), nil }