File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
common/persistence/visibility/store/elasticsearch Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -683,6 +683,12 @@ func (s *visibilityStore) buildSearchParametersV2(
683683 return nil , serviceerror .NewInvalidArgument ("ORDER BY clause is not supported" )
684684 }
685685
686+ if len (fieldSorts ) > 0 {
687+ // If fieldSorts is not empty, then it's using custom order by.
688+ s .metricsHandler .WithTags (metrics .NamespaceTag (request .Namespace .String ())).
689+ Counter (metrics .ElasticsearchCustomOrderByClauseCount .GetMetricName ()).Record (1 )
690+ }
691+
686692 params := & client.SearchParameters {
687693 Index : s .index ,
688694 Query : boolQuery ,
@@ -735,7 +741,6 @@ func (s *visibilityStore) setDefaultFieldSort(fieldSorts []*elastic.FieldSort) [
735741 return defaultSorter
736742 }
737743
738- s .metricsHandler .Counter (metrics .ElasticsearchCustomOrderByClauseCount .GetMetricName ()).Record (1 )
739744 res := make ([]elastic.Sorter , len (fieldSorts )+ 1 )
740745 for i , fs := range fieldSorts {
741746 res [i ] = fs
Original file line number Diff line number Diff line change @@ -460,6 +460,7 @@ func (s *ESVisibilitySuite) TestBuildSearchParametersV2() {
460460 // test custom sort
461461 request .Query = `Order bY WorkflowId`
462462 boolQuery = elastic .NewBoolQuery ().Filter (matchNamespaceQuery ).MustNot (namespaceDivisionExists )
463+ s .mockMetricsHandler .EXPECT ().WithTags (metrics .NamespaceTag (request .Namespace .String ())).Return (s .mockMetricsHandler )
463464 s .mockMetricsHandler .EXPECT ().Counter (metrics .ElasticsearchCustomOrderByClauseCount .GetMetricName ()).Return (metrics .NoopCounterMetricFunc )
464465 p , err = s .visibilityStore .buildSearchParametersV2 (request )
465466 s .NoError (err )
You can’t perform that action at this time.
0 commit comments