From d906f216463732f38b9a2e033a51a17cce2701f7 Mon Sep 17 00:00:00 2001 From: Geoffrey Wilson Date: Mon, 6 May 2024 15:18:21 -0400 Subject: [PATCH] Release 0.6 rc5a (#1187) * Bump Aim UI version (#1186) bump ui version Co-authored-by: fabio vincenzi * Fix issues related to context serialisation for `/metrics/search` endpoint. (#1185) --------- Co-authored-by: fabiovincenzi <93596376+fabiovincenzi@users.noreply.github.com> Co-authored-by: fabio vincenzi Co-authored-by: Software Developer <7852635+dsuhinin@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 +- pkg/api/aim2/api/request/run.go | 4 +- pkg/api/aim2/dao/repositories/metric.go | 7 +- .../golang/aim/metric/search_test.go | 297 +++++++++--------- .../golang/aim/namespace/flows/metric_test.go | 5 +- 6 files changed, 163 insertions(+), 156 deletions(-) diff --git a/go.mod b/go.mod index 87a9dd24a..f324e8329 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( dagger.io/dagger v0.11.2 dario.cat/mergo v1.0.0 github.com/DATA-DOG/go-sqlmock v1.5.2 - github.com/G-Research/fasttrackml-ui-aim v0.31705.41 + github.com/G-Research/fasttrackml-ui-aim v0.31705.43 github.com/G-Research/fasttrackml-ui-mlflow v0.20902.7 github.com/PuerkitoBio/goquery v1.9.2 github.com/apache/arrow/go/v14 v14.0.2 diff --git a/go.sum b/go.sum index 7f5fd6166..595093709 100644 --- a/go.sum +++ b/go.sum @@ -20,8 +20,8 @@ github.com/99designs/gqlgen v0.17.44/go.mod h1:UTCu3xpK2mLI5qcMNw+HKDiEL77it/1Xt github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU= github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= -github.com/G-Research/fasttrackml-ui-aim v0.31705.41 h1:7t6pGfrvraKBtWtCNzQ7cofkpAAKJnXJ9ZFvYOYaTkA= -github.com/G-Research/fasttrackml-ui-aim v0.31705.41/go.mod h1:1ydj5zgJgklq4gf3jkKMh+OrBXRz/5hZtx+1aROuWaM= +github.com/G-Research/fasttrackml-ui-aim v0.31705.43 h1:c/kcjIU7WnqCc+Xejg+Wf1uiroh82ft5R5WzAo119mk= +github.com/G-Research/fasttrackml-ui-aim v0.31705.43/go.mod h1:1ydj5zgJgklq4gf3jkKMh+OrBXRz/5hZtx+1aROuWaM= github.com/G-Research/fasttrackml-ui-mlflow v0.20902.7 h1:GPNCKPkUBBx54JYCRX8r06WvBa7sep5ppm1VQiPYZKY= github.com/G-Research/fasttrackml-ui-mlflow v0.20902.7/go.mod h1:Bg/xSCP6KzFDVDBSfJfrGmXuU6H8lFtboy+bTiHK6c4= github.com/Khan/genqlient v0.7.0 h1:GZ1meyRnzcDTK48EjqB8t3bcfYvHArCUUvgOwpz1D4w= diff --git a/pkg/api/aim2/api/request/run.go b/pkg/api/aim2/api/request/run.go index de1679812..405bd6894 100644 --- a/pkg/api/aim2/api/request/run.go +++ b/pkg/api/aim2/api/request/run.go @@ -52,8 +52,8 @@ type SearchRunsRequest struct { // MetricTuple represents a metric with key and context. type MetricTuple struct { - Key string `json:"key"` - Context string `json:"context"` + Key string `json:"key"` + Context fiber.Map `json:"context"` } // SearchMetricsRequest is a request struct for `GET /runs/search/metric` endpoint. diff --git a/pkg/api/aim2/dao/repositories/metric.go b/pkg/api/aim2/dao/repositories/metric.go index 76adc9fdb..109e5d019 100644 --- a/pkg/api/aim2/dao/repositories/metric.go +++ b/pkg/api/aim2/dao/repositories/metric.go @@ -3,6 +3,7 @@ package repositories import ( "context" "database/sql" + "encoding/json" "fmt" "strings" @@ -14,6 +15,7 @@ import ( "github.com/G-Research/fasttrackml/pkg/api/aim2/common" "github.com/G-Research/fasttrackml/pkg/api/aim2/dao/models" "github.com/G-Research/fasttrackml/pkg/api/aim2/query" + "github.com/G-Research/fasttrackml/pkg/common/api" "github.com/G-Research/fasttrackml/pkg/common/dao/repositories" "github.com/G-Research/fasttrackml/pkg/common/dao/types" ) @@ -257,7 +259,10 @@ func (r MetricRepository) findContextIDs(ctx context.Context, req *request.Searc contextList := []types.JSONB{} contextsMap := map[string]types.JSONB{} for _, r := range req.Metrics { - data := types.JSONB(r.Context) + data, err := json.Marshal(r.Context) + if err != nil { + return nil, api.NewInternalError("error serializing context: %s", err) + } contextList = append(contextList, data) contextsMap[string(data)] = data } diff --git a/tests/integration/golang/aim/metric/search_test.go b/tests/integration/golang/aim/metric/search_test.go index e84d035f7..0ad86f534 100644 --- a/tests/integration/golang/aim/metric/search_test.go +++ b/tests/integration/golang/aim/metric/search_test.go @@ -8,6 +8,7 @@ import ( "net/http" "testing" + "github.com/gofiber/fiber/v2" "github.com/google/uuid" "github.com/stretchr/testify/suite" @@ -308,7 +309,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { s.Require().Nil(err) runs := []*models.Run{run1, run2, run3} - contextValue := "{\"testkey\":\"testvalue\"}" + contextValue := fiber.Map{"testkey": "testvalue"} tests := []struct { name string request request.SearchMetricsRequest @@ -320,7 +321,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -340,15 +341,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `run.archived == True`, @@ -360,15 +361,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -394,15 +395,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `run.active == True`, @@ -419,15 +420,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -450,15 +451,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -481,15 +482,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -515,15 +516,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: fmt.Sprintf( @@ -543,15 +544,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: fmt.Sprintf( @@ -573,15 +574,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `run.duration == 0`, @@ -598,15 +599,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -629,15 +630,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `run.created_at > 123456789`, @@ -653,15 +654,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `run.created_at >= 123456789`, @@ -680,15 +681,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -711,15 +712,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `run.created_at == 123456789`, @@ -736,15 +737,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -768,15 +769,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -802,15 +803,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -833,15 +834,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -867,15 +868,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -898,15 +899,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `run.finalized_at == 123456789`, @@ -923,15 +924,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `run.finalized_at < 444444444`, @@ -948,15 +949,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -982,15 +983,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: fmt.Sprintf(`run.hash == "%s"`, run1.ID), @@ -1007,15 +1008,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1038,15 +1039,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1069,15 +1070,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `run.name == "TestRun1"`, @@ -1094,15 +1095,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `"Run3" in run.name`, @@ -1118,15 +1119,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1150,15 +1151,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1184,15 +1185,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `run.name.endswith('3')`, @@ -1208,15 +1209,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1243,15 +1244,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: fmt.Sprintf( @@ -1270,15 +1271,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `run.tags['mlflow.runName'] == "TestRunTag1"`, @@ -1295,15 +1296,15 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1326,7 +1327,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `re.match("TestRun1", run.name)`, @@ -1341,7 +1342,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `re.search("TestRun1", run.name)`, @@ -1356,7 +1357,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `run.name == "TestRun1"`, @@ -1371,7 +1372,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1391,7 +1392,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1412,7 +1413,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1431,11 +1432,11 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `re.match("TestRun1", run.name)`, @@ -1451,11 +1452,11 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `re.search("TestRun1", run.name)`, @@ -1471,11 +1472,11 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `run.name == "TestRun1"`, @@ -1491,11 +1492,11 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `run.name != "TestRun1"`, @@ -1512,11 +1513,11 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `run.name.startswith("Test")`, @@ -1535,11 +1536,11 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `run.name.endswith("Run2")`, @@ -1555,7 +1556,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `run.duration == 222222`, @@ -1570,7 +1571,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1590,7 +1591,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1610,7 +1611,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1631,7 +1632,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `(run.duration < 333333)`, @@ -1647,7 +1648,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1668,7 +1669,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, }, Query: fmt.Sprintf(`(run.hash == "%s")`, run1.ID), @@ -1683,7 +1684,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1703,7 +1704,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1723,7 +1724,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1744,7 +1745,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `(run.finalized_at < 444444444)`, @@ -1759,7 +1760,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1780,7 +1781,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `(run.finalized_at == 123456789)`, @@ -1795,7 +1796,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1815,11 +1816,11 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `(run.finalized_at > 123456789)`, @@ -1836,11 +1837,11 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric3", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `(run.finalized_at >= 123456789)`, @@ -1859,7 +1860,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `(run.created_at > 123456789)`, @@ -1874,7 +1875,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `(run.created_at >= 123456789)`, @@ -1890,7 +1891,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1910,7 +1911,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1931,7 +1932,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, }, Query: `(run.created_at == 123456789)`, @@ -1946,7 +1947,7 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", @@ -1966,11 +1967,11 @@ func (s *SearchMetricsTestSuite) Test_Ok() { Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric2", - Context: "{}", + Context: fiber.Map{}, }, { Key: "TestMetric1", diff --git a/tests/integration/golang/aim/namespace/flows/metric_test.go b/tests/integration/golang/aim/namespace/flows/metric_test.go index a3e080a61..ff75859af 100644 --- a/tests/integration/golang/aim/namespace/flows/metric_test.go +++ b/tests/integration/golang/aim/namespace/flows/metric_test.go @@ -9,6 +9,7 @@ import ( "os" "testing" + "github.com/gofiber/fiber/v2" "github.com/stretchr/testify/suite" "github.com/G-Research/fasttrackml/pkg/api/aim/encoding" @@ -245,7 +246,7 @@ func (s *MetricFlowTestSuite) testRunFlow( Metrics: []request.MetricTuple{ { Key: "TestMetric1", - Context: `{"key":"value"}`, + Context: fiber.Map{"key": "value"}, }, }, }, []*models.Run{run1}, []*models.LatestMetric{ @@ -255,7 +256,7 @@ func (s *MetricFlowTestSuite) testRunFlow( Metrics: []request.MetricTuple{ { Key: "TestMetric2", - Context: `{"key":"value"}`, + Context: fiber.Map{"key": "value"}, }, }, }, []*models.Run{run2}, []*models.LatestMetric{