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 8cafee85835248b229a69416ab562483079b593c Author: Hongtao Gao <[email protected]> AuthorDate: Fri Mar 20 04:08:42 2026 +0000 feat(replicated): add replicated stream schemas Co-Authored-By: Claude Opus 4.6 <[email protected]> --- pkg/test/replicated/stream/etcd.go | 106 ++++++++++++++++ pkg/test/replicated/stream/testdata/group.json | 78 ++++++++++++ .../stream/testdata/group_with_stages.json | 138 +++++++++++++++++++++ .../index_rule_bindings/deduplication_test.json | 17 +++ .../testdata/index_rule_bindings/duplicated.json | 17 +++ .../stream/testdata/index_rule_bindings/sw.json | 26 ++++ .../testdata/index_rule_bindings/sw_spec.json | 27 ++++ .../testdata/index_rule_bindings/sw_spec2.json | 26 ++++ .../testdata/index_rule_bindings/updated.json | 16 +++ .../stream/testdata/index_rules/db.instance.json | 13 ++ .../stream/testdata/index_rules/db.type.json | 12 ++ .../stream/testdata/index_rules/duration.json | 12 ++ .../testdata/index_rules/duration_updated.json | 12 ++ .../stream/testdata/index_rules/endpoint_id.json | 12 ++ .../stream/testdata/index_rules/extended_tags.json | 12 ++ .../stream/testdata/index_rules/http.method.json | 12 ++ .../stream/testdata/index_rules/mq.broker.json | 12 ++ .../stream/testdata/index_rules/mq.queue.json | 12 ++ .../stream/testdata/index_rules/mq.topic.json | 12 ++ .../stream/testdata/index_rules/status_code.json | 12 ++ .../stream/testdata/index_rules/trace_id.json | 12 ++ .../testdata/streams/deduplication_test.json | 50 ++++++++ .../stream/testdata/streams/duplicated.json | 50 ++++++++ .../replicated/stream/testdata/streams/sw.json | 98 +++++++++++++++ .../stream/testdata/streams/sw_spec.json | 95 ++++++++++++++ .../stream/testdata/streams/sw_spec2.json | 94 ++++++++++++++ .../stream/testdata/streams/sw_updated.json | 90 ++++++++++++++ 27 files changed, 1073 insertions(+) diff --git a/pkg/test/replicated/stream/etcd.go b/pkg/test/replicated/stream/etcd.go new file mode 100644 index 000000000..5eabc0ee5 --- /dev/null +++ b/pkg/test/replicated/stream/etcd.go @@ -0,0 +1,106 @@ +// 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 replicatedstream implements helpers to load replicated schemas for testing. +package replicatedstream + +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" + streamDir = "testdata/streams" + 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(streamDir, &databasev1.Stream{}, func(stream *databasev1.Stream) error { + _, innerErr := e.CreateStream(ctx, stream) + 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 { + if entry.IsDir() { + continue + } + 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 +} diff --git a/pkg/test/replicated/stream/testdata/group.json b/pkg/test/replicated/stream/testdata/group.json new file mode 100644 index 000000000..6c3ed9586 --- /dev/null +++ b/pkg/test/replicated/stream/testdata/group.json @@ -0,0 +1,78 @@ +[ + { + "metadata": { + "name": "default" + }, + "catalog": "CATALOG_STREAM", + "resource_opts": { + "shard_num": 2, + "replicas": 2, + "segment_interval": { + "unit": "UNIT_DAY", + "num": 1 + }, + "ttl": { + "unit": "UNIT_DAY", + "num": 3 + } + }, + "updated_at": "2021-04-15T01:30:15.01Z" + }, + { + "metadata": { + "name": "default-spec" + }, + "catalog": "CATALOG_STREAM", + "resource_opts": { + "shard_num": 2, + "replicas": 2, + "segment_interval": { + "unit": "UNIT_DAY", + "num": 1 + }, + "ttl": { + "unit": "UNIT_DAY", + "num": 3 + } + }, + "updated_at": "2021-04-15T01:30:15.01Z" + }, + { + "metadata": { + "name": "default-spec2" + }, + "catalog": "CATALOG_STREAM", + "resource_opts": { + "shard_num": 2, + "replicas": 2, + "segment_interval": { + "unit": "UNIT_DAY", + "num": 1 + }, + "ttl": { + "unit": "UNIT_DAY", + "num": 3 + } + }, + "updated_at": "2021-04-15T01:30:15.01Z" + }, + { + "metadata": { + "name": "updated" + }, + "catalog": "CATALOG_STREAM", + "resource_opts": { + "shard_num": 2, + "replicas": 2, + "segment_interval": { + "unit": "UNIT_DAY", + "num": 1 + }, + "ttl": { + "unit": "UNIT_DAY", + "num": 3 + } + }, + "updated_at": "2021-04-15T01:30:15.01Z" + } +] diff --git a/pkg/test/replicated/stream/testdata/group_with_stages.json b/pkg/test/replicated/stream/testdata/group_with_stages.json new file mode 100644 index 000000000..71cefdfe8 --- /dev/null +++ b/pkg/test/replicated/stream/testdata/group_with_stages.json @@ -0,0 +1,138 @@ +[ + { + "metadata": { + "name": "default" + }, + "catalog": "CATALOG_STREAM", + "resource_opts": { + "shard_num": 2, + "replicas": 2, + "segment_interval": { + "unit": "UNIT_DAY", + "num": 1 + }, + "ttl": { + "unit": "UNIT_DAY", + "num": 3 + }, + "stages": [ + { + "name": "warm", + "shard_num": 1, + "segment_interval": { + "unit": "UNIT_DAY", + "num": 3 + }, + "ttl": { + "unit": "UNIT_DAY", + "num": 7 + }, + "node_selector": "type=warm" + } + ] + }, + "updated_at": "2021-04-15T01:30:15.01Z" + }, + { + "metadata": { + "name": "updated" + }, + "catalog": "CATALOG_STREAM", + "resource_opts": { + "shard_num": 2, + "replicas": 2, + "segment_interval": { + "unit": "UNIT_DAY", + "num": 1 + }, + "ttl": { + "unit": "UNIT_DAY", + "num": 3 + }, + "stages": [ + { + "name": "warm", + "shard_num": 1, + "segment_interval": { + "unit": "UNIT_DAY", + "num": 3 + }, + "ttl": { + "unit": "UNIT_DAY", + "num": 7 + }, + "node_selector": "type=warm" + } + ] + }, + "updated_at": "2021-04-15T01:30:15.01Z" + }, + { + "metadata": { + "name": "default-spec" + }, + "catalog": "CATALOG_STREAM", + "resource_opts": { + "shard_num": 2, + "replicas": 2, + "segment_interval": { + "unit": "UNIT_DAY", + "num": 1 + }, + "ttl": { + "unit": "UNIT_DAY", + "num": 3 + }, + "stages": [ + { + "name": "warm", + "shard_num": 1, + "segment_interval": { + "unit": "UNIT_DAY", + "num": 3 + }, + "ttl": { + "unit": "UNIT_DAY", + "num": 7 + }, + "node_selector": "type=warm" + } + ] + }, + "updated_at": "2021-04-15T01:30:15.01Z" + }, + { + "metadata": { + "name": "default-spec2" + }, + "catalog": "CATALOG_STREAM", + "resource_opts": { + "shard_num": 2, + "replicas": 2, + "segment_interval": { + "unit": "UNIT_DAY", + "num": 1 + }, + "ttl": { + "unit": "UNIT_DAY", + "num": 3 + }, + "stages": [ + { + "name": "warm", + "shard_num": 1, + "segment_interval": { + "unit": "UNIT_DAY", + "num": 3 + }, + "ttl": { + "unit": "UNIT_DAY", + "num": 7 + }, + "node_selector": "type=warm" + } + ] + }, + "updated_at": "2021-04-15T01:30:15.01Z" + } +] diff --git a/pkg/test/replicated/stream/testdata/index_rule_bindings/deduplication_test.json b/pkg/test/replicated/stream/testdata/index_rule_bindings/deduplication_test.json new file mode 100644 index 000000000..3953595c6 --- /dev/null +++ b/pkg/test/replicated/stream/testdata/index_rule_bindings/deduplication_test.json @@ -0,0 +1,17 @@ +{ + "metadata": { + "name": "deduplication_test-rule-binding", + "group": "default" + }, + "rules": [ + "trace_id", + "duration" + ], + "subject": { + "catalog": "CATALOG_STREAM", + "name": "deduplication_test" + }, + "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/stream/testdata/index_rule_bindings/duplicated.json b/pkg/test/replicated/stream/testdata/index_rule_bindings/duplicated.json new file mode 100644 index 000000000..bc741e5ae --- /dev/null +++ b/pkg/test/replicated/stream/testdata/index_rule_bindings/duplicated.json @@ -0,0 +1,17 @@ +{ + "metadata": { + "name": "duplicated-rule-binding", + "group": "default" + }, + "rules": [ + "trace_id", + "duration" + ], + "subject":{ + "catalog": "CATALOG_STREAM", + "name": "duplicated" + }, + "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/stream/testdata/index_rule_bindings/sw.json b/pkg/test/replicated/stream/testdata/index_rule_bindings/sw.json new file mode 100644 index 000000000..e0d21b535 --- /dev/null +++ b/pkg/test/replicated/stream/testdata/index_rule_bindings/sw.json @@ -0,0 +1,26 @@ +{ + "metadata": { + "name": "sw-index-rule-binding", + "group": "default" + }, + "rules": [ + "trace_id", + "duration", + "endpoint_id", + "status_code", + "http.method", + "db.instance", + "db.type", + "mq.broker", + "mq.queue", + "mq.topic", + "extended_tags" + ], + "subject":{ + "catalog": "CATALOG_STREAM", + "name": "sw" + }, + "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/stream/testdata/index_rule_bindings/sw_spec.json b/pkg/test/replicated/stream/testdata/index_rule_bindings/sw_spec.json new file mode 100644 index 000000000..ba14f6933 --- /dev/null +++ b/pkg/test/replicated/stream/testdata/index_rule_bindings/sw_spec.json @@ -0,0 +1,27 @@ +{ + "metadata": { + "name": "sw-spec-index-rule-binding", + "group": "default-spec" + }, + "rules": [ + "trace_id", + "duration", + "endpoint_id", + "status_code", + "http.method", + "db.instance", + "db.type", + "mq.broker", + "mq.queue", + "mq.topic", + "extended_tags" + ], + "subject": { + "catalog": "CATALOG_STREAM", + "name": "sw" + }, + "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/stream/testdata/index_rule_bindings/sw_spec2.json b/pkg/test/replicated/stream/testdata/index_rule_bindings/sw_spec2.json new file mode 100644 index 000000000..c645efc96 --- /dev/null +++ b/pkg/test/replicated/stream/testdata/index_rule_bindings/sw_spec2.json @@ -0,0 +1,26 @@ +{ + "metadata": { + "name": "sw-spec2-index-rule-binding", + "group": "default-spec2" + }, + "rules": [ + "trace_id", + "duration", + "endpoint_id", + "status_code", + "http.method", + "db.instance", + "db.type", + "mq.broker", + "mq.queue", + "mq.topic", + "extended_tags" + ], + "subject": { + "catalog": "CATALOG_STREAM", + "name": "sw" + }, + "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/stream/testdata/index_rule_bindings/updated.json b/pkg/test/replicated/stream/testdata/index_rule_bindings/updated.json new file mode 100644 index 000000000..9eb12e762 --- /dev/null +++ b/pkg/test/replicated/stream/testdata/index_rule_bindings/updated.json @@ -0,0 +1,16 @@ +{ + "metadata": { + "name": "sw-index-rule-binding", + "group": "updated" + }, + "rules": [ + "duration" + ], + "subject":{ + "catalog": "CATALOG_STREAM", + "name": "sw" + }, + "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/stream/testdata/index_rules/db.instance.json b/pkg/test/replicated/stream/testdata/index_rules/db.instance.json new file mode 100644 index 000000000..85c3c6ada --- /dev/null +++ b/pkg/test/replicated/stream/testdata/index_rules/db.instance.json @@ -0,0 +1,13 @@ +{ + "metadata": { + "id": 1, + "name": "db.instance", + "group": "default" + }, + "tags": [ + "db.instance" + ], + "type": "TYPE_INVERTED", + "analyzer": "url", + "updated_at": "2021-04-15T01:30:15.01Z" +} diff --git a/pkg/test/replicated/stream/testdata/index_rules/db.type.json b/pkg/test/replicated/stream/testdata/index_rules/db.type.json new file mode 100644 index 000000000..8e39ca3ba --- /dev/null +++ b/pkg/test/replicated/stream/testdata/index_rules/db.type.json @@ -0,0 +1,12 @@ +{ + "metadata": { + "id": 2, + "name": "db.type", + "group": "default" + }, + "tags": [ + "db.type" + ], + "type": "TYPE_SKIPPING", + "updated_at": "2021-04-15T01:30:15.01Z" +} diff --git a/pkg/test/replicated/stream/testdata/index_rules/duration.json b/pkg/test/replicated/stream/testdata/index_rules/duration.json new file mode 100644 index 000000000..baae3592c --- /dev/null +++ b/pkg/test/replicated/stream/testdata/index_rules/duration.json @@ -0,0 +1,12 @@ +{ + "metadata": { + "id": 3, + "name": "duration", + "group": "default" + }, + "tags": [ + "duration" + ], + "type": "TYPE_INVERTED", + "updated_at": "2021-04-15T01:30:15.01Z" +} diff --git a/pkg/test/replicated/stream/testdata/index_rules/duration_updated.json b/pkg/test/replicated/stream/testdata/index_rules/duration_updated.json new file mode 100644 index 000000000..d9980a3ce --- /dev/null +++ b/pkg/test/replicated/stream/testdata/index_rules/duration_updated.json @@ -0,0 +1,12 @@ +{ + "metadata": { + "id": 3, + "name": "duration", + "group": "updated" + }, + "tags": [ + "duration" + ], + "type": "TYPE_INVERTED", + "updated_at": "2021-04-15T01:30:15.01Z" +} diff --git a/pkg/test/replicated/stream/testdata/index_rules/endpoint_id.json b/pkg/test/replicated/stream/testdata/index_rules/endpoint_id.json new file mode 100644 index 000000000..a82ec86a5 --- /dev/null +++ b/pkg/test/replicated/stream/testdata/index_rules/endpoint_id.json @@ -0,0 +1,12 @@ +{ + "metadata": { + "id": 4, + "name": "endpoint_id", + "group": "default" + }, + "tags": [ + "endpoint_id" + ], + "type": "TYPE_SKIPPING", + "updated_at": "2021-04-15T01:30:15.01Z" +} diff --git a/pkg/test/replicated/stream/testdata/index_rules/extended_tags.json b/pkg/test/replicated/stream/testdata/index_rules/extended_tags.json new file mode 100644 index 000000000..e0ee4f66e --- /dev/null +++ b/pkg/test/replicated/stream/testdata/index_rules/extended_tags.json @@ -0,0 +1,12 @@ +{ + "metadata": { + "id": 11, + "name": "extended_tags", + "group": "default" + }, + "tags": [ + "extended_tags" + ], + "type": "TYPE_INVERTED", + "updated_at": "2021-04-15T01:30:15.01Z" +} diff --git a/pkg/test/replicated/stream/testdata/index_rules/http.method.json b/pkg/test/replicated/stream/testdata/index_rules/http.method.json new file mode 100644 index 000000000..23bc230e9 --- /dev/null +++ b/pkg/test/replicated/stream/testdata/index_rules/http.method.json @@ -0,0 +1,12 @@ +{ + "metadata": { + "id": 6, + "name": "http.method", + "group": "default" + }, + "tags": [ + "http.method" + ], + "type": "TYPE_SKIPPING", + "updated_at": "2021-04-15T01:30:15.01Z" +} diff --git a/pkg/test/replicated/stream/testdata/index_rules/mq.broker.json b/pkg/test/replicated/stream/testdata/index_rules/mq.broker.json new file mode 100644 index 000000000..1fd748d6b --- /dev/null +++ b/pkg/test/replicated/stream/testdata/index_rules/mq.broker.json @@ -0,0 +1,12 @@ +{ + "metadata": { + "id": 7, + "name": "mq.broker", + "group": "default" + }, + "tags": [ + "mq.broker" + ], + "type": "TYPE_SKIPPING", + "updated_at": "2021-04-15T01:30:15.01Z" +} diff --git a/pkg/test/replicated/stream/testdata/index_rules/mq.queue.json b/pkg/test/replicated/stream/testdata/index_rules/mq.queue.json new file mode 100644 index 000000000..beb77bb49 --- /dev/null +++ b/pkg/test/replicated/stream/testdata/index_rules/mq.queue.json @@ -0,0 +1,12 @@ +{ + "metadata": { + "id": 8, + "name": "mq.queue", + "group": "default" + }, + "tags": [ + "mq.queue" + ], + "type": "TYPE_SKIPPING", + "updated_at": "2021-04-15T01:30:15.01Z" +} diff --git a/pkg/test/replicated/stream/testdata/index_rules/mq.topic.json b/pkg/test/replicated/stream/testdata/index_rules/mq.topic.json new file mode 100644 index 000000000..cc5544ddf --- /dev/null +++ b/pkg/test/replicated/stream/testdata/index_rules/mq.topic.json @@ -0,0 +1,12 @@ +{ + "metadata": { + "id": 9, + "name": "mq.topic", + "group": "default" + }, + "tags": [ + "mq.topic" + ], + "type": "TYPE_SKIPPING", + "updated_at": "2021-04-15T01:30:15.01Z" +} diff --git a/pkg/test/replicated/stream/testdata/index_rules/status_code.json b/pkg/test/replicated/stream/testdata/index_rules/status_code.json new file mode 100644 index 000000000..ccaa9f8de --- /dev/null +++ b/pkg/test/replicated/stream/testdata/index_rules/status_code.json @@ -0,0 +1,12 @@ +{ + "metadata": { + "id": 5, + "name": "status_code", + "group": "default" + }, + "tags": [ + "status_code" + ], + "type": "TYPE_SKIPPING", + "updated_at": "2021-04-15T01:30:15.01Z" +} diff --git a/pkg/test/replicated/stream/testdata/index_rules/trace_id.json b/pkg/test/replicated/stream/testdata/index_rules/trace_id.json new file mode 100644 index 000000000..df92f0f94 --- /dev/null +++ b/pkg/test/replicated/stream/testdata/index_rules/trace_id.json @@ -0,0 +1,12 @@ +{ + "metadata": { + "id": 10, + "name": "trace_id", + "group": "default" + }, + "tags": [ + "trace_id" + ], + "type": "TYPE_SKIPPING", + "updated_at": "2021-04-15T01:30:15.01Z" +} diff --git a/pkg/test/replicated/stream/testdata/streams/deduplication_test.json b/pkg/test/replicated/stream/testdata/streams/deduplication_test.json new file mode 100644 index 000000000..81ff1fb04 --- /dev/null +++ b/pkg/test/replicated/stream/testdata/streams/deduplication_test.json @@ -0,0 +1,50 @@ +{ + "metadata": { + "name": "deduplication_test", + "group": "default" + }, + "tag_families": [ + { + "name": "data", + "tags": [ + { + "name": "data_binary", + "type": "TAG_TYPE_DATA_BINARY" + } + ] + }, + { + "name": "searchable", + "tags": [ + { + "name": "trace_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "state", + "type": "TAG_TYPE_INT" + }, + { + "name": "service_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "service_instance_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "duration", + "type": "TAG_TYPE_INT" + } + ] + } + ], + "entity": { + "tag_names": [ + "service_id", + "service_instance_id", + "state" + ] + }, + "updated_at": "2021-04-15T01:30:15.01Z" +} diff --git a/pkg/test/replicated/stream/testdata/streams/duplicated.json b/pkg/test/replicated/stream/testdata/streams/duplicated.json new file mode 100644 index 000000000..90ac019b5 --- /dev/null +++ b/pkg/test/replicated/stream/testdata/streams/duplicated.json @@ -0,0 +1,50 @@ +{ + "metadata": { + "name": "duplicated", + "group": "default" + }, + "tag_families": [ + { + "name": "data", + "tags": [ + { + "name": "data_binary", + "type": "TAG_TYPE_DATA_BINARY" + } + ] + }, + { + "name": "searchable", + "tags": [ + { + "name": "trace_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "state", + "type": "TAG_TYPE_INT" + }, + { + "name": "service_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "service_instance_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "duration", + "type": "TAG_TYPE_INT" + } + ] + } + ], + "entity": { + "tag_names": [ + "service_id", + "service_instance_id", + "state" + ] + }, + "updated_at": "2021-04-15T01:30:15.01Z" +} \ No newline at end of file diff --git a/pkg/test/replicated/stream/testdata/streams/sw.json b/pkg/test/replicated/stream/testdata/streams/sw.json new file mode 100644 index 000000000..e590e7821 --- /dev/null +++ b/pkg/test/replicated/stream/testdata/streams/sw.json @@ -0,0 +1,98 @@ +{ + "metadata": { + "name": "sw", + "group": "default" + }, + "tag_families": [ + { + "name": "data", + "tags": [ + { + "name": "data_binary", + "type": "TAG_TYPE_DATA_BINARY" + } + ] + }, + { + "name": "searchable", + "tags": [ + { + "name": "trace_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "state", + "type": "TAG_TYPE_INT" + }, + { + "name": "service_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "service_instance_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "endpoint_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "duration", + "type": "TAG_TYPE_INT" + }, + { + "name": "start_time", + "type": "TAG_TYPE_INT" + }, + { + "name": "http.method", + "type": "TAG_TYPE_STRING" + }, + { + "name": "status_code", + "type": "TAG_TYPE_INT" + }, + { + "name": "span_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "db.type", + "type": "TAG_TYPE_STRING" + }, + { + "name": "db.instance", + "type": "TAG_TYPE_STRING" + }, + { + "name": "mq.queue", + "type": "TAG_TYPE_STRING" + }, + { + "name": "mq.topic", + "type": "TAG_TYPE_STRING" + }, + { + "name": "mq.broker", + "type": "TAG_TYPE_STRING" + }, + { + "name": "extended_tags", + "type": "TAG_TYPE_STRING_ARRAY" + }, + { + "name": "non_indexed_tags", + "type": "TAG_TYPE_STRING_ARRAY" + } + ] + } + ], + "entity": { + "tag_names": [ + "service_id", + "service_instance_id", + "state" + ] + }, + "updated_at": "2021-04-15T01:30:15.01Z" +} \ No newline at end of file diff --git a/pkg/test/replicated/stream/testdata/streams/sw_spec.json b/pkg/test/replicated/stream/testdata/streams/sw_spec.json new file mode 100644 index 000000000..31b7b58f5 --- /dev/null +++ b/pkg/test/replicated/stream/testdata/streams/sw_spec.json @@ -0,0 +1,95 @@ +{ + "metadata": { + "name": "sw", + "group": "default-spec" + }, + "tag_families": [ + { + "name": "data", + "tags": [ + { + "name": "data_binary", + "type": "TAG_TYPE_DATA_BINARY" + } + ] + }, + { + "name": "searchable", + "tags": [ + { + "name": "trace_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "state", + "type": "TAG_TYPE_INT" + }, + { + "name": "service_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "service_instance_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "endpoint_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "duration", + "type": "TAG_TYPE_INT" + }, + { + "name": "start_time", + "type": "TAG_TYPE_INT" + }, + { + "name": "http.method", + "type": "TAG_TYPE_STRING" + }, + { + "name": "status_code", + "type": "TAG_TYPE_STRING" + }, + { + "name": "span_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "db.type", + "type": "TAG_TYPE_STRING" + }, + { + "name": "db.instance", + "type": "TAG_TYPE_STRING" + }, + { + "name": "mq.queue", + "type": "TAG_TYPE_STRING" + }, + { + "name": "mq.topic", + "type": "TAG_TYPE_STRING" + }, + { + "name": "mq.broker", + "type": "TAG_TYPE_STRING" + }, + { + "name": "extended_tags", + "type": "TAG_TYPE_STRING_ARRAY" + }, + { + "name": "non_indexed_tags", + "type": "TAG_TYPE_STRING_ARRAY" + } + ] + } + ], + "entity": { + "tag_names": ["service_id", "service_instance_id", "state"] + }, + "updated_at": "2021-04-15T01:30:15.01Z" +} + diff --git a/pkg/test/replicated/stream/testdata/streams/sw_spec2.json b/pkg/test/replicated/stream/testdata/streams/sw_spec2.json new file mode 100644 index 000000000..6f4fd30cd --- /dev/null +++ b/pkg/test/replicated/stream/testdata/streams/sw_spec2.json @@ -0,0 +1,94 @@ +{ + "metadata": { + "name": "sw", + "group": "default-spec2" + }, + "tag_families": [ + { + "name": "data", + "tags": [ + { + "name": "data_binary", + "type": "TAG_TYPE_DATA_BINARY" + } + ] + }, + { + "name": "searchable", + "tags": [ + { + "name": "trace_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "state", + "type": "TAG_TYPE_INT" + }, + { + "name": "service_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "service_instance_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "endpoint_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "duration", + "type": "TAG_TYPE_INT" + }, + { + "name": "start_time", + "type": "TAG_TYPE_INT" + }, + { + "name": "http.method", + "type": "TAG_TYPE_STRING" + }, + { + "name": "status_code", + "type": "TAG_TYPE_STRING" + }, + { + "name": "span_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "db.type", + "type": "TAG_TYPE_STRING" + }, + { + "name": "db.instance", + "type": "TAG_TYPE_STRING" + }, + { + "name": "mq.queue", + "type": "TAG_TYPE_STRING" + }, + { + "name": "mq.topic", + "type": "TAG_TYPE_STRING" + }, + { + "name": "mq.broker", + "type": "TAG_TYPE_STRING" + }, + { + "name": "extended_tags", + "type": "TAG_TYPE_STRING_ARRAY" + }, + { + "name": "non_indexed_tags", + "type": "TAG_TYPE_STRING_ARRAY" + } + ] + } + ], + "entity": { + "tag_names": ["service_id", "service_instance_id", "state"] + }, + "updated_at": "2021-04-15T01:30:15.01Z" +} diff --git a/pkg/test/replicated/stream/testdata/streams/sw_updated.json b/pkg/test/replicated/stream/testdata/streams/sw_updated.json new file mode 100644 index 000000000..46731df94 --- /dev/null +++ b/pkg/test/replicated/stream/testdata/streams/sw_updated.json @@ -0,0 +1,90 @@ +{ + "metadata": { + "name": "sw", + "group": "updated" + }, + "tag_families": [ + { + "name": "data", + "tags": [ + { + "name": "data_binary", + "type": "TAG_TYPE_DATA_BINARY" + } + ] + }, + { + "name": "searchable", + "tags": [ + { + "name": "service_instance_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "trace_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "duration", + "type": "TAG_TYPE_INT" + }, + { + "name": "state", + "type": "TAG_TYPE_INT" + }, + { + "name": "service_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "endpoint_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "http.method", + "type": "TAG_TYPE_STRING" + }, + { + "name": "span_id", + "type": "TAG_TYPE_STRING" + }, + { + "name": "db.type", + "type": "TAG_TYPE_STRING" + }, + { + "name": "db.instance", + "type": "TAG_TYPE_STRING" + }, + { + "name": "mq.topic", + "type": "TAG_TYPE_STRING" + }, + { + "name": "mq.broker", + "type": "TAG_TYPE_STRING" + }, + { + "name": "extended_tags", + "type": "TAG_TYPE_STRING_ARRAY" + }, + { + "name": "new_tag", + "type": "TAG_TYPE_STRING" + }, + { + "name": "status_code", + "type": "TAG_TYPE_STRING" + } + ] + } + ], + "entity": { + "tag_names": [ + "service_id", + "service_instance_id", + "state" + ] + }, + "updated_at": "2024-06-10T12:00:00Z" +}
