Skip to content

Commit

Permalink
fix metric check
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandros Filios <alexandros.filios@ibm.com>
  • Loading branch information
alexandrosfilios authored and arner committed Aug 26, 2024
1 parent 15d7660 commit 2e556dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions integration/token/fungible/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ func CheckLocalMetrics(ii *integration.Infrastructure, user string, viewName str
Expect(metrics).NotTo(BeEmpty())

var sum float64
for _, m := range metrics[user+"_fsc_view_operations"].GetMetric() {
for _, m := range metrics["fsc_view_operations"].GetMetric() {
for _, labelPair := range m.Label {
if labelPair.GetName() == "view" && labelPair.GetValue() == viewName {
sum += m.Counter.GetValue()
Expand All @@ -1142,11 +1142,11 @@ func CheckLocalMetrics(ii *integration.Infrastructure, user string, viewName str
Expect(sum).NotTo(BeZero())
}

func CheckPrometheusMetrics(ii *integration.Infrastructure, user, viewName string) {
func CheckPrometheusMetrics(ii *integration.Infrastructure, viewName string) {
cli, err := ii.NWO.PrometheusAPI()
Expect(err).To(BeNil())
metric := model.Metric{
"__name__": model.LabelValue(user + "_fsc_view_operations"),
"__name__": model.LabelValue("fsc_view_operations"),
"view": model.LabelValue(viewName),
}
val, warnings, err := cli.Query(context.Background(), metric.String(), time.Now())
Expand Down
2 changes: 1 addition & 1 deletion integration/token/fungible/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ func TestStressSuite(network *integration.Infrastructure, auditorId string, sele
}}))

CheckLocalMetrics(network, "alice", "github.com/hyperledger-labs/fabric-token-sdk/integration/token/fungible/views/BalanceView")
CheckPrometheusMetrics(network, "alice", "github.com/hyperledger-labs/fabric-token-sdk/integration/token/fungible/views/BalanceView")
CheckPrometheusMetrics(network, "github.com/hyperledger-labs/fabric-token-sdk/integration/token/fungible/views/BalanceView")
}

func TestStress(network *integration.Infrastructure, auditorId string, selector *token3.ReplicaSelector) {
Expand Down

0 comments on commit 2e556dd

Please sign in to comment.