@@ -29,6 +29,8 @@ import (
2929
3030 "github.com/stretchr/testify/assert"
3131 "github.com/stretchr/testify/suite"
32+
33+ "go.temporal.io/server/common/primitives"
3234)
3335
3436type (
@@ -73,7 +75,7 @@ func (s *MetricTestSuiteBase) TestClientReportCounter() {
7375 TestScope1 ,
7476 TestCounterMetric1 , 66 )
7577 testDef := MetricDefs [UnitTestService ][TestCounterMetric1 ]
76- assert .NoError (s .T (), s .metricTestUtility .ContainsCounter (testDef .metricName , map [string ]string {namespace : namespaceAllValue , OperationTagName : ScopeDefs [UnitTestService ][TestScope1 ].operation }, 66 ))
78+ assert .NoError (s .T (), s .metricTestUtility .ContainsCounter (testDef .metricName , map [string ]string {namespace : namespaceAllValue , OperationTagName : ScopeDefs [UnitTestService ][TestScope1 ].operation , serviceName : primitives . UnitTestService }, 66 ))
7779 assert .Equal (s .T (), 1 , s .metricTestUtility .CollectionSize ())
7880}
7981
@@ -82,7 +84,7 @@ func (s *MetricTestSuiteBase) TestClientReportGauge() {
8284 TestScope1 ,
8385 TestGaugeMetric1 , 66 )
8486 testDef := MetricDefs [UnitTestService ][TestGaugeMetric1 ]
85- assert .NoError (s .T (), s .metricTestUtility .ContainsGauge (testDef .metricName , map [string ]string {namespace : namespaceAllValue , OperationTagName : ScopeDefs [UnitTestService ][TestScope1 ].operation }, 66 ))
87+ assert .NoError (s .T (), s .metricTestUtility .ContainsGauge (testDef .metricName , map [string ]string {namespace : namespaceAllValue , OperationTagName : ScopeDefs [UnitTestService ][TestScope1 ].operation , serviceName : primitives . UnitTestService }, 66 ))
8688 assert .Equal (s .T (), 1 , s .metricTestUtility .CollectionSize ())
8789}
8890
@@ -92,7 +94,7 @@ func (s *MetricTestSuiteBase) TestClientReportTimer() {
9294 TestScope1 ,
9395 TestTimerMetric1 , targetDuration )
9496 testDef := MetricDefs [UnitTestService ][TestTimerMetric1 ]
95- assert .NoError (s .T (), s .metricTestUtility .ContainsTimer (testDef .metricName , map [string ]string {namespace : namespaceAllValue , OperationTagName : ScopeDefs [UnitTestService ][TestScope1 ].operation }, targetDuration ))
97+ assert .NoError (s .T (), s .metricTestUtility .ContainsTimer (testDef .metricName , map [string ]string {namespace : namespaceAllValue , OperationTagName : ScopeDefs [UnitTestService ][TestScope1 ].operation , serviceName : primitives . UnitTestService }, targetDuration ))
9698 assert .Equal (s .T (), 1 , s .metricTestUtility .CollectionSize ())
9799}
98100
@@ -101,28 +103,28 @@ func (s *MetricTestSuiteBase) TestClientReportHistogram() {
101103 TestScope1 ,
102104 TestDimensionlessHistogramMetric1 , 66 )
103105 testDef := MetricDefs [UnitTestService ][TestDimensionlessHistogramMetric1 ]
104- assert .NoError (s .T (), s .metricTestUtility .ContainsHistogram (testDef .metricName , map [string ]string {namespace : namespaceAllValue , OperationTagName : ScopeDefs [UnitTestService ][TestScope1 ].operation }, 66 ))
106+ assert .NoError (s .T (), s .metricTestUtility .ContainsHistogram (testDef .metricName , map [string ]string {namespace : namespaceAllValue , OperationTagName : ScopeDefs [UnitTestService ][TestScope1 ].operation , serviceName : primitives . UnitTestService }, 66 ))
105107 assert .Equal (s .T (), 1 , s .metricTestUtility .CollectionSize ())
106108}
107109
108110func (s * MetricTestSuiteBase ) TestScopeReportCounter () {
109111 s .testClient .Scope (TestScope1 ).AddCounter (TestCounterMetric1 , 66 )
110112 testDef := MetricDefs [UnitTestService ][TestCounterMetric1 ]
111- assert .NoError (s .T (), s .metricTestUtility .ContainsCounter (testDef .metricName , map [string ]string {namespace : namespaceAllValue , OperationTagName : ScopeDefs [UnitTestService ][TestScope1 ].operation }, 66 ))
113+ assert .NoError (s .T (), s .metricTestUtility .ContainsCounter (testDef .metricName , map [string ]string {namespace : namespaceAllValue , OperationTagName : ScopeDefs [UnitTestService ][TestScope1 ].operation , serviceName : primitives . UnitTestService }, 66 ))
112114 assert .Equal (s .T (), 1 , s .metricTestUtility .CollectionSize ())
113115}
114116
115117func (s * MetricTestSuiteBase ) TestScopeReportGauge () {
116118 s .testClient .Scope (TestScope1 ).UpdateGauge (TestGaugeMetric1 , 66 )
117119 testDef := MetricDefs [UnitTestService ][TestGaugeMetric1 ]
118- assert .NoError (s .T (), s .metricTestUtility .ContainsGauge (testDef .metricName , map [string ]string {namespace : namespaceAllValue , OperationTagName : ScopeDefs [UnitTestService ][TestScope1 ].operation }, 66 ))
120+ assert .NoError (s .T (), s .metricTestUtility .ContainsGauge (testDef .metricName , map [string ]string {namespace : namespaceAllValue , OperationTagName : ScopeDefs [UnitTestService ][TestScope1 ].operation , serviceName : primitives . UnitTestService }, 66 ))
119121 assert .Equal (s .T (), 1 , s .metricTestUtility .CollectionSize ())
120122}
121123
122124func (s * MetricTestSuiteBase ) TestScopeReportTimer () {
123125 targetDuration := time .Second * 100
124126 s .testClient .Scope (TestScope1 ).RecordTimer (TestTimerMetric1 , targetDuration )
125127 testDef := MetricDefs [UnitTestService ][TestTimerMetric1 ]
126- assert .NoError (s .T (), s .metricTestUtility .ContainsTimer (testDef .metricName , map [string ]string {namespace : namespaceAllValue , OperationTagName : ScopeDefs [UnitTestService ][TestScope1 ].operation }, targetDuration ))
128+ assert .NoError (s .T (), s .metricTestUtility .ContainsTimer (testDef .metricName , map [string ]string {namespace : namespaceAllValue , OperationTagName : ScopeDefs [UnitTestService ][TestScope1 ].operation , serviceName : primitives . UnitTestService }, targetDuration ))
127129 assert .Equal (s .T (), 1 , s .metricTestUtility .CollectionSize ())
128130}
0 commit comments