This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch test/replication
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git

commit 7e283d5bb8827f0f3d8a0f67634ce18ca38acd48
Author: Hongtao Gao <[email protected]>
AuthorDate: Fri Mar 20 04:03:52 2026 +0000

    feat(replicated): add replicated measure schemas
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 pkg/test/replicated/measure/etcd.go                | 103 +++++++++++++++++++++
 .../measure/testdata/groups/exception.json         |  19 ++++
 .../measure/testdata/groups/index_mode.json        |  19 ++++
 .../measure/testdata/groups/sw_metric.json         |  19 ++++
 .../index_rule_bindings/endpoint_traffic.json      |  16 ++++
 .../index_rule_bindings/service_cpm_day.json       |  16 ++++
 .../index_rule_bindings/service_cpm_hour.json      |  16 ++++
 .../index_rule_bindings/service_cpm_minute.json    |  16 ++++
 .../service_cpm_minute_spec.json                   |  15 +++
 .../service_cpm_minute_spec2.json                  |  15 +++
 .../service_instance_cpm_day.json                  |  16 ++++
 .../service_instance_cpm_hour.json                 |  16 ++++
 .../service_instance_cpm_minute.json               |  16 ++++
 .../service_instance_endpoint_cpm_minute.json      |  16 ++++
 .../service_instance_latency_minute.json           |  16 ++++
 .../service_instance_traffic.json                  |  17 ++++
 .../index_rule_bindings/service_traffic.json       |  17 ++++
 .../testdata/index_rules/endpoint_name.json        |  13 +++
 .../measure/testdata/index_rules/id.json           |  12 +++
 .../measure/testdata/index_rules/id_spec.json      |  10 ++
 .../measure/testdata/index_rules/id_spec2.json     |  10 ++
 .../testdata/index_rules/im_service_id.json        |  12 +++
 .../measure/testdata/index_rules/layer.json        |  12 +++
 .../testdata/index_rules/searchable_name.json      |  13 +++
 .../measure/testdata/index_rules/service_id.json   |  12 +++
 .../measure/testdata/measures/duplicated.json      |  42 +++++++++
 .../measures/endpoint_resp_time_minute.json        |  37 ++++++++
 .../testdata/measures/endpoint_traffic.json        |  28 ++++++
 .../testdata/measures/instance_clr_cpu_minute.json |  48 ++++++++++
 .../measure/testdata/measures/service_cpm_day.json |  42 +++++++++
 .../testdata/measures/service_cpm_hour.json        |  42 +++++++++
 .../testdata/measures/service_cpm_minute.json      |  42 +++++++++
 .../testdata/measures/service_cpm_minute_spec.json |  40 ++++++++
 .../measures/service_cpm_minute_spec2.json         |  40 ++++++++
 .../measures/service_cpm_minute_updated.json       |  42 +++++++++
 .../measures/service_instance_cpm_day.json         |  47 ++++++++++
 .../measures/service_instance_cpm_hour.json        |  47 ++++++++++
 .../measures/service_instance_cpm_minute.json      |  52 +++++++++++
 .../service_instance_cpm_minute_updated.json       |  52 +++++++++++
 .../service_instance_endpoint_cpm_minute.json      |  56 +++++++++++
 .../measures/service_instance_latency_minute.json  |  36 +++++++
 .../measures/service_instance_traffic.json         |  39 ++++++++
 .../testdata/measures/service_latency_minute.json  |  47 ++++++++++
 .../measure/testdata/measures/service_traffic.json |  44 +++++++++
 .../measures/service_traffic_replicated.json       |  44 +++++++++
 45 files changed, 1329 insertions(+)

diff --git a/pkg/test/replicated/measure/etcd.go 
b/pkg/test/replicated/measure/etcd.go
new file mode 100644
index 000000000..7304d91ca
--- /dev/null
+++ b/pkg/test/replicated/measure/etcd.go
@@ -0,0 +1,103 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+// Package replicatedmeasure implements helpers to load replicated schemas for 
testing.
+package replicatedmeasure
+
+import (
+       "context"
+       "embed"
+       "path"
+
+       "github.com/pkg/errors"
+       "google.golang.org/protobuf/encoding/protojson"
+       "google.golang.org/protobuf/proto"
+
+       commonv1 
"github.com/apache/skywalking-banyandb/api/proto/banyandb/common/v1"
+       databasev1 
"github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1"
+       "github.com/apache/skywalking-banyandb/banyand/metadata/schema"
+)
+
+const (
+       groupDir            = "testdata/groups"
+       measureDir          = "testdata/measures"
+       indexRuleDir        = "testdata/index_rules"
+       indexRuleBindingDir = "testdata/index_rule_bindings"
+)
+
+//go:embed testdata/*
+var store embed.FS
+
+// PreloadSchema loads schemas from files in the booting process.
+func PreloadSchema(ctx context.Context, e schema.Registry) error {
+       return preloadSchemaWithFuncs(ctx, e,
+               func(ctx context.Context, e schema.Registry) error {
+                       return loadSchema(groupDir, &commonv1.Group{}, 
func(group *commonv1.Group) error {
+                               return e.CreateGroup(ctx, group)
+                       })
+               },
+               func(ctx context.Context, e schema.Registry) error {
+                       return loadSchema(measureDir, &databasev1.Measure{}, 
func(measure *databasev1.Measure) error {
+                               _, innerErr := e.CreateMeasure(ctx, measure)
+                               return innerErr
+                       })
+               },
+               func(ctx context.Context, e schema.Registry) error {
+                       return loadSchema(indexRuleDir, 
&databasev1.IndexRule{}, func(indexRule *databasev1.IndexRule) error {
+                               return e.CreateIndexRule(ctx, indexRule)
+                       })
+               },
+               func(ctx context.Context, e schema.Registry) error {
+                       return loadSchema(indexRuleBindingDir, 
&databasev1.IndexRuleBinding{}, func(indexRuleBinding 
*databasev1.IndexRuleBinding) error {
+                               return e.CreateIndexRuleBinding(ctx, 
indexRuleBinding)
+                       })
+               },
+       )
+}
+
+func preloadSchemaWithFuncs(ctx context.Context, e schema.Registry, loaders 
...func(context.Context, schema.Registry) error) error {
+       for _, loader := range loaders {
+               if err := loader(ctx, e); err != nil {
+                       return errors.WithStack(err)
+               }
+       }
+       return nil
+}
+
+func loadSchema[T proto.Message](dir string, resource T, loadFn func(resource 
T) error) error {
+       entries, err := store.ReadDir(dir)
+       if err != nil {
+               return err
+       }
+       for _, entry := range entries {
+               data, err := store.ReadFile(path.Join(dir, entry.Name()))
+               if err != nil {
+                       return err
+               }
+               resource.ProtoReflect().Descriptor().RequiredNumbers()
+               if err := protojson.Unmarshal(data, resource); err != nil {
+                       return err
+               }
+               if err := loadFn(resource); err != nil {
+                       if errors.Is(err, schema.ErrGRPCAlreadyExists) {
+                               return nil
+                       }
+                       return err
+               }
+       }
+       return nil
+}
\ No newline at end of file
diff --git a/pkg/test/replicated/measure/testdata/groups/exception.json 
b/pkg/test/replicated/measure/testdata/groups/exception.json
new file mode 100644
index 000000000..d57fbef64
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/groups/exception.json
@@ -0,0 +1,19 @@
+{
+  "metadata": {
+    "name": "exception"
+  },
+  "catalog": "CATALOG_MEASURE",
+  "resource_opts": {
+    "shard_num": 2,
+    "segment_interval": {
+      "unit": "UNIT_DAY",
+      "num": 1
+    },
+    "ttl": {
+      "unit": "UNIT_DAY",
+      "num": 7
+    },
+    "replicas": 2
+  },
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git a/pkg/test/replicated/measure/testdata/groups/index_mode.json 
b/pkg/test/replicated/measure/testdata/groups/index_mode.json
new file mode 100644
index 000000000..009222d30
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/groups/index_mode.json
@@ -0,0 +1,19 @@
+{
+  "metadata": {
+    "name": "index_mode"
+  },
+  "catalog": "CATALOG_MEASURE",
+  "resource_opts": {
+    "shard_num": 2,
+    "segment_interval": {
+      "unit": "UNIT_DAY",
+      "num": 1
+    },
+    "ttl": {
+      "unit": "UNIT_DAY",
+      "num": 7
+    },
+    "replicas": 2
+  },
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git a/pkg/test/replicated/measure/testdata/groups/sw_metric.json 
b/pkg/test/replicated/measure/testdata/groups/sw_metric.json
new file mode 100644
index 000000000..983adcf38
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/groups/sw_metric.json
@@ -0,0 +1,19 @@
+{
+  "metadata": {
+    "name": "sw_metric"
+  },
+  "catalog": "CATALOG_MEASURE",
+  "resource_opts": {
+    "shard_num": 2,
+    "segment_interval": {
+      "unit": "UNIT_DAY",
+      "num": 1
+    },
+    "ttl": {
+      "unit": "UNIT_DAY",
+      "num": 7
+    },
+    "replicas": 2
+  },
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git 
a/pkg/test/replicated/measure/testdata/index_rule_bindings/endpoint_traffic.json
 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/endpoint_traffic.json
new file mode 100644
index 000000000..2633d4a54
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/endpoint_traffic.json
@@ -0,0 +1,16 @@
+{
+  "metadata": {
+    "name": "endpoint_traffic",
+    "group": "sw_metric"
+  },
+  "rules": [
+    "endpoint_name"
+  ],
+  "subject": {
+    "catalog": "CATALOG_MEASURE",
+    "name": "endpoint_traffic"
+  },
+  "begin_at": "2021-04-15T01:30:15.01Z",
+  "expire_at": "2121-04-15T01:30:15.01Z",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git 
a/pkg/test/replicated/measure/testdata/index_rule_bindings/service_cpm_day.json 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_cpm_day.json
new file mode 100644
index 000000000..2115e3e13
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_cpm_day.json
@@ -0,0 +1,16 @@
+{
+  "metadata": {
+    "name": "service_cpm_day",
+    "group": "sw_metric"
+  },
+  "rules": [
+    "id"
+  ],
+  "subject":{
+    "catalog": "CATALOG_MEASURE",
+    "name": "service_cpm_day"
+  },
+  "begin_at": "2021-04-15T01:30:15.01Z",
+  "expire_at": "2121-04-15T01:30:15.01Z",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
diff --git 
a/pkg/test/replicated/measure/testdata/index_rule_bindings/service_cpm_hour.json
 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_cpm_hour.json
new file mode 100644
index 000000000..6c5ae3620
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_cpm_hour.json
@@ -0,0 +1,16 @@
+{
+  "metadata": {
+    "name": "service_cpm_hour",
+    "group": "sw_metric"
+  },
+  "rules": [
+    "id"
+  ],
+  "subject":{
+    "catalog": "CATALOG_MEASURE",
+    "name": "service_cpm_hour"
+  },
+  "begin_at": "2021-04-15T01:30:15.01Z",
+  "expire_at": "2121-04-15T01:30:15.01Z",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
diff --git 
a/pkg/test/replicated/measure/testdata/index_rule_bindings/service_cpm_minute.json
 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_cpm_minute.json
new file mode 100644
index 000000000..ad560c86e
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_cpm_minute.json
@@ -0,0 +1,16 @@
+{
+  "metadata": {
+    "name": "service_cpm_minute",
+    "group": "sw_metric"
+  },
+  "rules": [
+    "id"
+  ],
+  "subject":{
+    "catalog": "CATALOG_MEASURE",
+    "name": "service_cpm_minute"
+  },
+  "begin_at": "2021-04-15T01:30:15.01Z",
+  "expire_at": "2121-04-15T01:30:15.01Z",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
diff --git 
a/pkg/test/replicated/measure/testdata/index_rule_bindings/service_cpm_minute_spec.json
 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_cpm_minute_spec.json
new file mode 100644
index 000000000..3435c6451
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_cpm_minute_spec.json
@@ -0,0 +1,15 @@
+{
+  "metadata": {
+    "name": "service_cpm_minute",
+    "group": "sw_spec"
+  },
+  "rules": ["id"],
+  "subject": {
+    "catalog": "CATALOG_MEASURE",
+    "name": "service_cpm_minute"
+  },
+  "begin_at": "2021-04-15T01:30:15.01Z",
+  "expire_at": "2121-04-15T01:30:15.01Z",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
+
diff --git 
a/pkg/test/replicated/measure/testdata/index_rule_bindings/service_cpm_minute_spec2.json
 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_cpm_minute_spec2.json
new file mode 100644
index 000000000..24576d3f1
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_cpm_minute_spec2.json
@@ -0,0 +1,15 @@
+{
+  "metadata": {
+    "name": "service_cpm_minute",
+    "group": "sw_spec2"
+  },
+  "rules": ["id"],
+  "subject": {
+    "catalog": "CATALOG_MEASURE",
+    "name": "service_cpm_minute"
+  },
+  "begin_at": "2021-04-15T01:30:15.01Z",
+  "expire_at": "2121-04-15T01:30:15.01Z",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
+
diff --git 
a/pkg/test/replicated/measure/testdata/index_rule_bindings/service_instance_cpm_day.json
 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_instance_cpm_day.json
new file mode 100644
index 000000000..4fb9123e4
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_instance_cpm_day.json
@@ -0,0 +1,16 @@
+{
+  "metadata": {
+    "name": "service_instance_cpm_day",
+    "group": "sw_metric"
+  },
+  "rules": [
+    "id"
+  ],
+  "subject":{
+    "catalog": "CATALOG_MEASURE",
+    "name": "service_instance_cpm_day"
+  },
+  "begin_at": "2021-04-15T01:30:15.01Z",
+  "expire_at": "2121-04-15T01:30:15.01Z",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
diff --git 
a/pkg/test/replicated/measure/testdata/index_rule_bindings/service_instance_cpm_hour.json
 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_instance_cpm_hour.json
new file mode 100644
index 000000000..b9b40c3f4
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_instance_cpm_hour.json
@@ -0,0 +1,16 @@
+{
+  "metadata": {
+    "name": "service_instance_cpm_hour",
+    "group": "sw_metric"
+  },
+  "rules": [
+    "id"
+  ],
+  "subject":{
+    "catalog": "CATALOG_MEASURE",
+    "name": "service_instance_cpm_hour"
+  },
+  "begin_at": "2021-04-15T01:30:15.01Z",
+  "expire_at": "2121-04-15T01:30:15.01Z",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
diff --git 
a/pkg/test/replicated/measure/testdata/index_rule_bindings/service_instance_cpm_minute.json
 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_instance_cpm_minute.json
new file mode 100644
index 000000000..8aa4f2377
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_instance_cpm_minute.json
@@ -0,0 +1,16 @@
+{
+  "metadata": {
+    "name": "service_instance_cpm_minute",
+    "group": "sw_metric"
+  },
+  "rules": [
+    "id"
+  ],
+  "subject":{
+    "catalog": "CATALOG_MEASURE",
+    "name": "service_instance_cpm_minute"
+  },
+  "begin_at": "2021-04-15T01:30:15.01Z",
+  "expire_at": "2121-04-15T01:30:15.01Z",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
diff --git 
a/pkg/test/replicated/measure/testdata/index_rule_bindings/service_instance_endpoint_cpm_minute.json
 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_instance_endpoint_cpm_minute.json
new file mode 100644
index 000000000..54ff83e52
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_instance_endpoint_cpm_minute.json
@@ -0,0 +1,16 @@
+{
+  "metadata": {
+    "name": "service_instance_endpoint_cpm_minute",
+    "group": "sw_metric"
+  },
+  "rules": [
+    "id"
+  ],
+  "subject":{
+    "catalog": "CATALOG_MEASURE",
+    "name": "service_instance_endpoint_cpm_minute"
+  },
+  "begin_at": "2021-04-15T01:30:15.01Z",
+  "expire_at": "2121-04-15T01:30:15.01Z",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
diff --git 
a/pkg/test/replicated/measure/testdata/index_rule_bindings/service_instance_latency_minute.json
 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_instance_latency_minute.json
new file mode 100644
index 000000000..dfc621d21
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_instance_latency_minute.json
@@ -0,0 +1,16 @@
+{
+  "metadata": {
+    "name": "service_instance_latency_minute",
+    "group": "sw_metric"
+  },
+  "rules": [
+    "service_id"
+  ],
+  "subject":{
+    "catalog": "CATALOG_MEASURE",
+    "name": "service_instance_latency_minute"
+  },
+  "begin_at": "2021-04-15T01:30:15.01Z",
+  "expire_at": "2121-04-15T01:30:15.01Z",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
diff --git 
a/pkg/test/replicated/measure/testdata/index_rule_bindings/service_instance_traffic.json
 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_instance_traffic.json
new file mode 100644
index 000000000..249c1f8f4
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_instance_traffic.json
@@ -0,0 +1,17 @@
+{
+  "metadata": {
+    "name": "service_instance_traffic_rule_binding",
+    "group": "sw_metric"
+  },
+  "rules": [
+    "service_id",
+    "searchable_name"
+  ],
+  "subject":{
+    "catalog": "CATALOG_MEASURE",
+    "name": "service_instance_traffic"
+  },
+  "begin_at": "2021-04-15T01:30:15.01Z",
+  "expire_at": "2121-04-15T01:30:15.01Z",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
diff --git 
a/pkg/test/replicated/measure/testdata/index_rule_bindings/service_traffic.json 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_traffic.json
new file mode 100644
index 000000000..08b65e0d6
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/index_rule_bindings/service_traffic.json
@@ -0,0 +1,17 @@
+{
+  "metadata": {
+    "name": "service_traffic_rule_binding",
+    "group": "index_mode"
+  },
+  "rules": [
+    "service_id",
+    "layer"
+  ],
+  "subject":{
+    "catalog": "CATALOG_MEASURE",
+    "name": "service_traffic"
+  },
+  "begin_at": "2021-04-15T01:30:15.01Z",
+  "expire_at": "2121-04-15T01:30:15.01Z",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
diff --git 
a/pkg/test/replicated/measure/testdata/index_rules/endpoint_name.json 
b/pkg/test/replicated/measure/testdata/index_rules/endpoint_name.json
new file mode 100644
index 000000000..b75806a7e
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/index_rules/endpoint_name.json
@@ -0,0 +1,13 @@
+{
+  "metadata": {
+    "id": 5,
+    "name": "endpoint_name",
+    "group": "sw_metric"
+  },
+  "tags": [
+    "endpoint_name"
+  ],
+  "type": "TYPE_INVERTED",
+  "analyzer": "url",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git a/pkg/test/replicated/measure/testdata/index_rules/id.json 
b/pkg/test/replicated/measure/testdata/index_rules/id.json
new file mode 100644
index 000000000..c676824d6
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/index_rules/id.json
@@ -0,0 +1,12 @@
+{
+  "metadata": {
+    "id": 4,
+    "name": "id",
+    "group": "sw_metric"
+  },
+  "tags": [
+    "id"
+  ],
+  "type": "TYPE_INVERTED",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
diff --git a/pkg/test/replicated/measure/testdata/index_rules/id_spec.json 
b/pkg/test/replicated/measure/testdata/index_rules/id_spec.json
new file mode 100644
index 000000000..74743d9e2
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/index_rules/id_spec.json
@@ -0,0 +1,10 @@
+{
+  "metadata": {
+    "id": 4,
+    "name": "id",
+    "group": "sw_spec"
+  },
+  "tags": ["id"],
+  "type": "TYPE_INVERTED",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
diff --git a/pkg/test/replicated/measure/testdata/index_rules/id_spec2.json 
b/pkg/test/replicated/measure/testdata/index_rules/id_spec2.json
new file mode 100644
index 000000000..0a3211050
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/index_rules/id_spec2.json
@@ -0,0 +1,10 @@
+{
+  "metadata": {
+    "id": 4,
+    "name": "id",
+    "group": "sw_spec2"
+  },
+  "tags": ["id"],
+  "type": "TYPE_INVERTED",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
diff --git 
a/pkg/test/replicated/measure/testdata/index_rules/im_service_id.json 
b/pkg/test/replicated/measure/testdata/index_rules/im_service_id.json
new file mode 100644
index 000000000..549a4037d
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/index_rules/im_service_id.json
@@ -0,0 +1,12 @@
+{
+  "metadata": {
+    "id": 1,
+    "name": "service_id",
+    "group": "index_mode"
+  },
+  "tags": [
+    "service_id"
+  ],
+  "type": "TYPE_INVERTED",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
diff --git a/pkg/test/replicated/measure/testdata/index_rules/layer.json 
b/pkg/test/replicated/measure/testdata/index_rules/layer.json
new file mode 100644
index 000000000..dbf70d7ab
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/index_rules/layer.json
@@ -0,0 +1,12 @@
+{
+  "metadata": {
+    "id": 3,
+    "name": "layer",
+    "group": "index_mode"
+  },
+  "tags": [
+    "layer"
+  ],
+  "type": "TYPE_INVERTED",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
diff --git 
a/pkg/test/replicated/measure/testdata/index_rules/searchable_name.json 
b/pkg/test/replicated/measure/testdata/index_rules/searchable_name.json
new file mode 100644
index 000000000..73c3a2f26
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/index_rules/searchable_name.json
@@ -0,0 +1,13 @@
+{
+       "metadata": {
+               "id": 2,
+               "name": "searchable_name",
+               "group": "sw_metric"
+       },
+       "tags": [
+               "name"
+       ],
+       "type": "TYPE_INVERTED",
+       "analyzer": "url",
+       "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git a/pkg/test/replicated/measure/testdata/index_rules/service_id.json 
b/pkg/test/replicated/measure/testdata/index_rules/service_id.json
new file mode 100644
index 000000000..c8088dd24
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/index_rules/service_id.json
@@ -0,0 +1,12 @@
+{
+  "metadata": {
+    "id": 1,
+    "name": "service_id",
+    "group": "sw_metric"
+  },
+  "tags": [
+    "service_id"
+  ],
+  "type": "TYPE_INVERTED",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
diff --git a/pkg/test/replicated/measure/testdata/measures/duplicated.json 
b/pkg/test/replicated/measure/testdata/measures/duplicated.json
new file mode 100644
index 000000000..e25f0a372
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/measures/duplicated.json
@@ -0,0 +1,42 @@
+{
+  "metadata": {
+    "name": "duplicated",
+    "group": "exception"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "entity_id",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
+    }
+  ],
+  "fields": [
+    {
+      "name": "total",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    },
+    {
+      "name": "value",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    }
+  ],
+  "entity": {
+    "tag_names": [
+      "entity_id"
+    ]
+  },
+  "interval": "1m",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git 
a/pkg/test/replicated/measure/testdata/measures/endpoint_resp_time_minute.json 
b/pkg/test/replicated/measure/testdata/measures/endpoint_resp_time_minute.json
new file mode 100644
index 000000000..1de19aaee
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/measures/endpoint_resp_time_minute.json
@@ -0,0 +1,37 @@
+{
+  "metadata": {
+    "name": "endpoint_resp_time_minute",
+    "group": "sw_metric"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "entity_id",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
+    }
+  ],
+  "fields": [
+    {
+      "name": "value",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    }
+  ],
+  "entity": {
+    "tag_names": [
+      "entity_id"
+    ]
+  },
+  "sharding_key": {
+    "tag_names": [
+      "entity_id"
+    ]
+  },
+  "interval": "1m",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git 
a/pkg/test/replicated/measure/testdata/measures/endpoint_traffic.json 
b/pkg/test/replicated/measure/testdata/measures/endpoint_traffic.json
new file mode 100644
index 000000000..2c240557b
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/measures/endpoint_traffic.json
@@ -0,0 +1,28 @@
+{
+  "metadata": {
+    "name": "endpoint_traffic",
+    "group": "sw_metric"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "service_id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "endpoint_name",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
+    }
+  ],
+  "entity": {
+    "tag_names": [
+      "service_id",
+      "endpoint_name"
+    ]
+  },
+  "updated_at": "2024-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git 
a/pkg/test/replicated/measure/testdata/measures/instance_clr_cpu_minute.json 
b/pkg/test/replicated/measure/testdata/measures/instance_clr_cpu_minute.json
new file mode 100644
index 000000000..24b3c5a6b
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/measures/instance_clr_cpu_minute.json
@@ -0,0 +1,48 @@
+{
+  "entity": {
+    "tagNames": [
+      "entity_id"
+    ]
+  },
+  "fields": [
+    {
+      "compressionMethod": "COMPRESSION_METHOD_ZSTD",
+      "encodingMethod": "ENCODING_METHOD_GORILLA",
+      "fieldType": "FIELD_TYPE_FLOAT",
+      "name": "summation"
+    },
+    {
+      "compressionMethod": "COMPRESSION_METHOD_ZSTD",
+      "encodingMethod": "ENCODING_METHOD_GORILLA",
+      "fieldType": "FIELD_TYPE_INT",
+      "name": "count"
+    },
+    {
+      "compressionMethod": "COMPRESSION_METHOD_ZSTD",
+      "encodingMethod": "ENCODING_METHOD_GORILLA",
+      "fieldType": "FIELD_TYPE_FLOAT",
+      "name": "value"
+    }
+  ],
+  "interval": "1m",
+  "metadata": {
+    "group": "sw_metric",
+    "name": "instance_clr_cpu_minute"
+  },
+  "tagFamilies": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "service_id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "entity_id",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
+    }
+  ],
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git a/pkg/test/replicated/measure/testdata/measures/service_cpm_day.json 
b/pkg/test/replicated/measure/testdata/measures/service_cpm_day.json
new file mode 100644
index 000000000..1f3f82093
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/measures/service_cpm_day.json
@@ -0,0 +1,42 @@
+{
+  "metadata": {
+    "name": "service_cpm_day",
+    "group": "sw_metric"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "entity_id",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
+    }
+  ],
+  "fields": [
+    {
+      "name": "total",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    },
+    {
+      "name": "value",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    }
+  ],
+  "entity": {
+    "tag_names": [
+      "entity_id"
+    ]
+  },
+  "interval": "24h",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git 
a/pkg/test/replicated/measure/testdata/measures/service_cpm_hour.json 
b/pkg/test/replicated/measure/testdata/measures/service_cpm_hour.json
new file mode 100644
index 000000000..5e506ddf9
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/measures/service_cpm_hour.json
@@ -0,0 +1,42 @@
+{
+  "metadata": {
+    "name": "service_cpm_hour",
+    "group": "sw_metric"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "entity_id",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
+    }
+  ],
+  "fields": [
+    {
+      "name": "total",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    },
+    {
+      "name": "value",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    }
+  ],
+  "entity": {
+    "tag_names": [
+      "entity_id"
+    ]
+  },
+  "interval": "1h",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git 
a/pkg/test/replicated/measure/testdata/measures/service_cpm_minute.json 
b/pkg/test/replicated/measure/testdata/measures/service_cpm_minute.json
new file mode 100644
index 000000000..9ca254a1e
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/measures/service_cpm_minute.json
@@ -0,0 +1,42 @@
+{
+  "metadata": {
+    "name": "service_cpm_minute",
+    "group": "sw_metric"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "entity_id",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
+    }
+  ],
+  "fields": [
+    {
+      "name": "total",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    },
+    {
+      "name": "value",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    }
+  ],
+  "entity": {
+    "tag_names": [
+      "entity_id"
+    ]
+  },
+  "interval": "1m",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git 
a/pkg/test/replicated/measure/testdata/measures/service_cpm_minute_spec.json 
b/pkg/test/replicated/measure/testdata/measures/service_cpm_minute_spec.json
new file mode 100644
index 000000000..450990cf5
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/measures/service_cpm_minute_spec.json
@@ -0,0 +1,40 @@
+{
+  "metadata": {
+    "name": "service_cpm_minute",
+    "group": "sw_spec"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "entity_id",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
+    }
+  ],
+  "fields": [
+    {
+      "name": "total",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    },
+    {
+      "name": "value",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    }
+  ],
+  "entity": {
+    "tag_names": ["entity_id"]
+  },
+  "interval": "1m",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
diff --git 
a/pkg/test/replicated/measure/testdata/measures/service_cpm_minute_spec2.json 
b/pkg/test/replicated/measure/testdata/measures/service_cpm_minute_spec2.json
new file mode 100644
index 000000000..d5a8b4037
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/measures/service_cpm_minute_spec2.json
@@ -0,0 +1,40 @@
+{
+  "metadata": {
+    "name": "service_cpm_minute",
+    "group": "sw_spec2"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "entity_id",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
+    }
+  ],
+  "fields": [
+    {
+      "name": "total",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    },
+    {
+      "name": "value",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    }
+  ],
+  "entity": {
+    "tag_names": ["entity_id"]
+  },
+  "interval": "1m",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
diff --git 
a/pkg/test/replicated/measure/testdata/measures/service_cpm_minute_updated.json 
b/pkg/test/replicated/measure/testdata/measures/service_cpm_minute_updated.json
new file mode 100644
index 000000000..3d0d6cb95
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/measures/service_cpm_minute_updated.json
@@ -0,0 +1,42 @@
+{
+  "metadata": {
+    "name": "service_cpm_minute",
+    "group": "sw_updated"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "entity_id",
+          "type": "TAG_TYPE_INT"
+        },
+        {
+          "name": "extra_tag",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
+    }
+  ],
+  "fields": [
+    {
+      "name": "total",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    },
+    {
+      "name": "extra_field",
+      "field_type": "FIELD_TYPE_STRING",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    }
+  ],
+  "entity": {
+    "tag_names": [
+      "entity_id"
+    ]
+  },
+  "interval": "1m",
+  "updated_at": "2024-06-01T00:00:00Z"
+}
diff --git 
a/pkg/test/replicated/measure/testdata/measures/service_instance_cpm_day.json 
b/pkg/test/replicated/measure/testdata/measures/service_instance_cpm_day.json
new file mode 100644
index 000000000..f93380a33
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/measures/service_instance_cpm_day.json
@@ -0,0 +1,47 @@
+{
+  "metadata": {
+    "name": "service_instance_cpm_day",
+    "group": "sw_metric"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "entity_id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "service_id",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
+    }
+  ],
+  "fields": [
+    {
+      "name": "total",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    },
+    {
+      "name": "value",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    }
+  ],
+  "entity": {
+    "tag_names": [
+      "service_id",
+      "entity_id"
+    ]
+  },
+  "interval": "24h",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git 
a/pkg/test/replicated/measure/testdata/measures/service_instance_cpm_hour.json 
b/pkg/test/replicated/measure/testdata/measures/service_instance_cpm_hour.json
new file mode 100644
index 000000000..753d0a957
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/measures/service_instance_cpm_hour.json
@@ -0,0 +1,47 @@
+{
+  "metadata": {
+    "name": "service_instance_cpm_hour",
+    "group": "sw_metric"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "entity_id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "service_id",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
+    }
+  ],
+  "fields": [
+    {
+      "name": "total",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    },
+    {
+      "name": "value",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    }
+  ],
+  "entity": {
+    "tag_names": [
+      "service_id",
+      "entity_id"
+    ]
+  },
+  "interval": "1h",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git 
a/pkg/test/replicated/measure/testdata/measures/service_instance_cpm_minute.json
 
b/pkg/test/replicated/measure/testdata/measures/service_instance_cpm_minute.json
new file mode 100644
index 000000000..7c032704d
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/measures/service_instance_cpm_minute.json
@@ -0,0 +1,52 @@
+{
+  "metadata": {
+    "name": "service_instance_cpm_minute",
+    "group": "sw_metric"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "entity_id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "service_id",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
+    }
+  ],
+  "fields": [
+    {
+      "name": "total",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    },
+    {
+      "name": "value",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    }
+  ],
+  "entity": {
+    "tag_names": [
+      "service_id",
+      "entity_id"
+    ]
+  },
+  "sharding_key": {
+    "tag_names": [
+      "service_id"
+    ]
+  },
+  "interval": "1m",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git 
a/pkg/test/replicated/measure/testdata/measures/service_instance_cpm_minute_updated.json
 
b/pkg/test/replicated/measure/testdata/measures/service_instance_cpm_minute_updated.json
new file mode 100644
index 000000000..1bc84febe
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/measures/service_instance_cpm_minute_updated.json
@@ -0,0 +1,52 @@
+{
+  "metadata": {
+    "name": "service_instance_cpm_minute",
+    "group": "sw_updated"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "entity_id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "service_id",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
+    }
+  ],
+  "fields": [
+    {
+      "name": "total",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    },
+    {
+      "name": "value",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    }
+  ],
+  "entity": {
+    "tag_names": [
+      "service_id",
+      "entity_id"
+    ]
+  },
+  "sharding_key": {
+    "tag_names": [
+      "service_id"
+    ]
+  },
+  "interval": "1m",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git 
a/pkg/test/replicated/measure/testdata/measures/service_instance_endpoint_cpm_minute.json
 
b/pkg/test/replicated/measure/testdata/measures/service_instance_endpoint_cpm_minute.json
new file mode 100644
index 000000000..47eadcee4
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/measures/service_instance_endpoint_cpm_minute.json
@@ -0,0 +1,56 @@
+{
+  "metadata": {
+    "name": "service_instance_endpoint_cpm_minute",
+    "group": "sw_metric"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "entity_id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "service_id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "http.uri",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
+    }
+  ],
+  "fields": [
+    {
+      "name": "total",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    },
+    {
+      "name": "value",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    }
+  ],
+  "entity": {
+    "tag_names": [
+      "service_id",
+      "entity_id"
+    ]
+  },
+  "sharding_key": {
+    "tag_names": [
+      "service_id"
+    ]
+  },
+  "interval": "1m",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git 
a/pkg/test/replicated/measure/testdata/measures/service_instance_latency_minute.json
 
b/pkg/test/replicated/measure/testdata/measures/service_instance_latency_minute.json
new file mode 100644
index 000000000..59ce77bc8
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/measures/service_instance_latency_minute.json
@@ -0,0 +1,36 @@
+{
+  "metadata": {
+    "name": "service_instance_latency_minute",
+    "group": "sw_metric"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "entity_id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "service_id",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
+    }
+  ],
+  "fields": [
+    {
+      "name": "value",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    }
+  ],
+  "entity": {
+    "tag_names": [
+      "entity_id"
+    ]
+  },
+  "interval": "1m",
+  "updated_at": "2024-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git 
a/pkg/test/replicated/measure/testdata/measures/service_instance_traffic.json 
b/pkg/test/replicated/measure/testdata/measures/service_instance_traffic.json
new file mode 100644
index 000000000..1b8961173
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/measures/service_instance_traffic.json
@@ -0,0 +1,39 @@
+{
+  "metadata": {
+    "name": "service_instance_traffic",
+    "group": "sw_metric"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "service_id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "name",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "last_ping",
+          "type": "TAG_TYPE_INT"
+        },
+        {
+          "name": "layer",
+          "type": "TAG_TYPE_INT"
+        }
+      ]
+    }
+  ],
+  "entity": {
+    "tag_names": [
+      "id"
+    ]
+  },
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git 
a/pkg/test/replicated/measure/testdata/measures/service_latency_minute.json 
b/pkg/test/replicated/measure/testdata/measures/service_latency_minute.json
new file mode 100644
index 000000000..46ddf59cc
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/measures/service_latency_minute.json
@@ -0,0 +1,47 @@
+{
+  "metadata": {
+    "name": "service_latency_minute",
+    "group": "sw_metric"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "id",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
+    },
+    {
+      "name": "storage_only",
+      "tags": [
+        {
+          "name": "entity_id",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
+    }
+  ],
+  "fields": [
+    {
+      "name": "total",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    },
+    {
+      "name": "value",
+      "field_type": "FIELD_TYPE_INT",
+      "encoding_method": "ENCODING_METHOD_GORILLA",
+      "compression_method": "COMPRESSION_METHOD_ZSTD"
+    }
+  ],
+  "entity": {
+    "tag_names": [
+      "entity_id"
+    ]
+  },
+  "interval": "1m",
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git a/pkg/test/replicated/measure/testdata/measures/service_traffic.json 
b/pkg/test/replicated/measure/testdata/measures/service_traffic.json
new file mode 100644
index 000000000..1cf0608b3
--- /dev/null
+++ b/pkg/test/replicated/measure/testdata/measures/service_traffic.json
@@ -0,0 +1,44 @@
+{
+  "metadata": {
+    "name": "service_traffic",
+    "group": "index_mode"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "service_id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "name",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "short_name",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "service_group",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "layer",
+          "type": "TAG_TYPE_INT"
+        }
+      ]
+    }
+  ],
+  "entity": {
+    "tag_names": [
+      "id"
+    ]
+  },
+  "index_mode": true,
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}
\ No newline at end of file
diff --git 
a/pkg/test/replicated/measure/testdata/measures/service_traffic_replicated.json 
b/pkg/test/replicated/measure/testdata/measures/service_traffic_replicated.json
new file mode 100644
index 000000000..73082adba
--- /dev/null
+++ 
b/pkg/test/replicated/measure/testdata/measures/service_traffic_replicated.json
@@ -0,0 +1,44 @@
+{
+  "metadata": {
+    "name": "service_traffic",
+    "group": "replicated_group"
+  },
+  "tag_families": [
+    {
+      "name": "default",
+      "tags": [
+        {
+          "name": "id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "service_id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "name",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "short_name",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "service_group",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "layer",
+          "type": "TAG_TYPE_INT"
+        }
+      ]
+    }
+  ],
+  "entity": {
+    "tag_names": [
+      "id"
+    ]
+  },
+  "index_mode": true,
+  "updated_at": "2021-04-15T01:30:15.01Z"
+}


Reply via email to