File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
common/persistence/visibility/store/elasticsearch Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -619,6 +619,12 @@ func (s *visibilityStore) buildSearchParametersV2(
619619 return nil , err
620620 }
621621
622+ if len (fieldSorts ) > 0 {
623+ // If fieldSorts is not empty, then it's using custom order by.
624+ s .metricsHandler .WithTags (metrics .NamespaceTag (request .Namespace .String ())).
625+ Counter (metrics .ElasticsearchCustomOrderByClauseCount .GetMetricName ()).Record (1 )
626+ }
627+
622628 params := & client.SearchParameters {
623629 Index : s .index ,
624630 Query : boolQuery ,
@@ -734,7 +740,6 @@ func (s *visibilityStore) getListFieldSorter(fieldSorts []*elastic.FieldSort) ([
734740 if len (fieldSorts ) == 0 {
735741 return defaultSorter , nil
736742 }
737- s .metricsHandler .Counter (metrics .ElasticsearchCustomOrderByClauseCount .GetMetricName ()).Record (1 )
738743 res := make ([]elastic.Sorter , len (fieldSorts )+ 1 )
739744 for i , fs := range fieldSorts {
740745 res [i ] = fs
Original file line number Diff line number Diff line change @@ -425,7 +425,6 @@ func (s *ESVisibilitySuite) TestGetListFieldSorter() {
425425
426426 // test passing non-empty fieldSorts
427427 testFieldSorts := [2 ]* elastic.FieldSort {elastic .NewFieldSort ("_test" ), elastic .NewFieldSort ("_second_tes" )}
428- s .mockMetricsHandler .EXPECT ().Counter (metrics .ElasticsearchCustomOrderByClauseCount .GetMetricName ()).Return (metrics .NoopCounterMetricFunc )
429428 sorter , err = s .visibilityStore .getListFieldSorter (testFieldSorts [:])
430429 expectedSorter := make ([]elastic.Sorter , len (testFieldSorts )+ 1 )
431430 expectedSorter [0 ] = testFieldSorts [0 ]
@@ -494,6 +493,7 @@ func (s *ESVisibilitySuite) TestBuildSearchParametersV2() {
494493 // test custom sort
495494 request .Query = `Order bY WorkflowId`
496495 boolQuery = elastic .NewBoolQuery ().Filter (matchNamespaceQuery ).MustNot (namespaceDivisionExists )
496+ s .mockMetricsHandler .EXPECT ().WithTags (metrics .NamespaceTag (request .Namespace .String ())).Return (s .mockMetricsHandler )
497497 s .mockMetricsHandler .EXPECT ().Counter (metrics .ElasticsearchCustomOrderByClauseCount .GetMetricName ()).Return (metrics .NoopCounterMetricFunc )
498498 p , err = s .visibilityStore .buildSearchParametersV2 (request , s .visibilityStore .getListFieldSorter )
499499 s .NoError (err )
You can’t perform that action at this time.
0 commit comments