Skip to content

Commit

Permalink
[rules] Set tags field of mapping rules history conversion (#2999)
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleyk authored Dec 10, 2020
1 parent 10dbad3 commit b7ea2e7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/metrics/rules/mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,5 +478,6 @@ func (mc *mappingRule) mappingRuleView(snapshotIdx int) (view.MappingRule, error
StoragePolicies: mrs.storagePolicies,
LastUpdatedBy: mrs.lastUpdatedBy,
LastUpdatedAtMillis: mrs.lastUpdatedAtNanos / nanosPerMilli,
Tags: mrs.tags,
}, nil
}
3 changes: 3 additions & 0 deletions src/metrics/rules/mapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ func TestMappingRuleMappingRuleView(t *testing.T) {
LastUpdatedAtMillis: 67890,
LastUpdatedBy: "someone-else",
DropPolicy: res.DropPolicy,
Tags: []models.Tag{},
}
require.Equal(t, expected, res)
}
Expand Down Expand Up @@ -698,6 +699,7 @@ func TestNewMappingRuleHistory(t *testing.T) {
},
LastUpdatedAtMillis: 67890,
LastUpdatedBy: "someone-else",
Tags: []models.Tag{},
},
{
ID: "12669817-13ae-40e6-ba2f-33087b262c68",
Expand All @@ -713,6 +715,7 @@ func TestNewMappingRuleHistory(t *testing.T) {
},
LastUpdatedAtMillis: 12345,
LastUpdatedBy: "someone",
Tags: []models.Tag{},
},
}
require.Equal(t, expected, history)
Expand Down
5 changes: 5 additions & 0 deletions src/metrics/rules/ruleset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (
"github.com/m3db/m3/src/metrics/rules/view"
"github.com/m3db/m3/src/metrics/rules/view/changes"
xbytes "github.com/m3db/m3/src/metrics/x/bytes"
"github.com/m3db/m3/src/query/models"
xerrors "github.com/m3db/m3/src/x/errors"
xtime "github.com/m3db/m3/src/x/time"

Expand Down Expand Up @@ -288,6 +289,7 @@ func TestRuleSetLatest(t *testing.T) {
StoragePolicies: policy.StoragePolicies{
policy.NewStoragePolicy(30*time.Second, xtime.Second, 6*time.Hour),
},
Tags: []models.Tag{},
},
{
ID: "mappingRule3",
Expand All @@ -299,6 +301,7 @@ func TestRuleSetLatest(t *testing.T) {
policy.NewStoragePolicy(10*time.Second, xtime.Second, 2*time.Hour),
policy.NewStoragePolicy(time.Minute, xtime.Minute, time.Hour),
},
Tags: []models.Tag{},
},
{
ID: "mappingRule4",
Expand All @@ -309,6 +312,7 @@ func TestRuleSetLatest(t *testing.T) {
StoragePolicies: policy.StoragePolicies{
policy.NewStoragePolicy(10*time.Second, xtime.Second, 24*time.Hour),
},
Tags: []models.Tag{},
},
{
ID: "mappingRule5",
Expand All @@ -320,6 +324,7 @@ func TestRuleSetLatest(t *testing.T) {
StoragePolicies: policy.StoragePolicies{
policy.NewStoragePolicy(10*time.Second, xtime.Second, 24*time.Hour),
},
Tags: []models.Tag{},
},
},
RollupRules: []view.RollupRule{
Expand Down

0 comments on commit b7ea2e7

Please sign in to comment.