From ca65f26f57b0e67c3df891ccb6ee9aed1b8b5db5 Mon Sep 17 00:00:00 2001 From: Annanay Date: Wed, 29 Jan 2020 18:26:08 +0530 Subject: [PATCH 1/8] Add regex tag filter for ES backend Signed-off-by: Annanay --- .../es/spanstore/fixtures/query_01.json | 20 +++++++++---------- plugin/storage/es/spanstore/reader.go | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/plugin/storage/es/spanstore/fixtures/query_01.json b/plugin/storage/es/spanstore/fixtures/query_01.json index e38c1e84ac4..a433bb44062 100644 --- a/plugin/storage/es/spanstore/fixtures/query_01.json +++ b/plugin/storage/es/spanstore/fixtures/query_01.json @@ -4,9 +4,9 @@ { "bool":{ "must":{ - "match":{ + "regexp":{ "tag.bat@foo":{ - "query":"spook" + "value":"spook" } } } @@ -15,9 +15,9 @@ { "bool":{ "must":{ - "match":{ + "regexp":{ "process.tag.bat@foo":{ - "query":"spook" + "value":"spook" } } } @@ -37,9 +37,9 @@ } }, { - "match":{ + "regexp":{ "tags.value":{ - "query":"spook" + "value":"spook" } } } @@ -62,9 +62,9 @@ } }, { - "match":{ + "regexp":{ "process.tags.value":{ - "query":"spook" + "value":"spook" } } } @@ -87,9 +87,9 @@ } }, { - "match":{ + "regexp":{ "logs.fields.value":{ - "query":"spook" + "value":"spook" } } } diff --git a/plugin/storage/es/spanstore/reader.go b/plugin/storage/es/spanstore/reader.go index 29124eda749..046ad192068 100644 --- a/plugin/storage/es/spanstore/reader.go +++ b/plugin/storage/es/spanstore/reader.go @@ -622,14 +622,14 @@ func (s *SpanReader) buildNestedQuery(field string, k string, v string) elastic. keyField := fmt.Sprintf("%s.%s", field, tagKeyField) valueField := fmt.Sprintf("%s.%s", field, tagValueField) keyQuery := elastic.NewMatchQuery(keyField, k) - valueQuery := elastic.NewMatchQuery(valueField, v) + valueQuery := elastic.NewRegexpQuery(valueField, v) tagBoolQuery := elastic.NewBoolQuery().Must(keyQuery, valueQuery) return elastic.NewNestedQuery(field, tagBoolQuery) } func (s *SpanReader) buildObjectQuery(field string, k string, v string) elastic.Query { keyField := fmt.Sprintf("%s.%s", field, k) - keyQuery := elastic.NewMatchQuery(keyField, v) + keyQuery := elastic.NewRegexpQuery(keyField, v) return elastic.NewBoolQuery().Must(keyQuery) } From f94c2209b12df0abd3c4c27284fd647d1faa5501 Mon Sep 17 00:00:00 2001 From: Annanay Date: Thu, 30 Jan 2020 14:41:54 +0530 Subject: [PATCH 2/8] [ES] Add support to check for presence of a tag Signed-off-by: Annanay --- cmd/query/app/grpc_handler.go | 17 +- model/proto/api_v2/query.proto | 1 + plugin/storage/es/spanstore/reader.go | 14 ++ plugin/storage/es/spanstore/reader_test.go | 4 + proto-gen/api_v2/query.pb.go | 193 ++++++++++++++------- storage/spanstore/interface.go | 17 +- 6 files changed, 165 insertions(+), 81 deletions(-) diff --git a/cmd/query/app/grpc_handler.go b/cmd/query/app/grpc_handler.go index 9e832739023..3cfd620e021 100644 --- a/cmd/query/app/grpc_handler.go +++ b/cmd/query/app/grpc_handler.go @@ -79,14 +79,15 @@ func (g *GRPCHandler) ArchiveTrace(ctx context.Context, r *api_v2.ArchiveTraceRe func (g *GRPCHandler) FindTraces(r *api_v2.FindTracesRequest, stream api_v2.QueryService_FindTracesServer) error { query := r.GetQuery() queryParams := spanstore.TraceQueryParameters{ - ServiceName: query.ServiceName, - OperationName: query.OperationName, - Tags: query.Tags, - StartTimeMin: query.StartTimeMin, - StartTimeMax: query.StartTimeMax, - DurationMin: query.DurationMin, - DurationMax: query.DurationMax, - NumTraces: int(query.SearchDepth), + ServiceName: query.ServiceName, + OperationName: query.OperationName, + Tags: query.Tags, + StartTimeMin: query.StartTimeMin, + StartTimeMax: query.StartTimeMax, + DurationMin: query.DurationMin, + DurationMax: query.DurationMax, + NumTraces: int(query.SearchDepth), + CheckTagsPresent: query.CheckTagsPresent, } traces, err := g.queryService.FindTraces(stream.Context(), &queryParams) if err != nil { diff --git a/model/proto/api_v2/query.proto b/model/proto/api_v2/query.proto index 98e1a74af46..ce36f33a4e1 100644 --- a/model/proto/api_v2/query.proto +++ b/model/proto/api_v2/query.proto @@ -95,6 +95,7 @@ message TraceQueryParameters { (gogoproto.nullable) = false ]; int32 search_depth = 8; + repeated string check_tags_present = 9; } message FindTracesRequest { diff --git a/plugin/storage/es/spanstore/reader.go b/plugin/storage/es/spanstore/reader.go index 046ad192068..3d83da4928f 100644 --- a/plugin/storage/es/spanstore/reader.go +++ b/plugin/storage/es/spanstore/reader.go @@ -20,6 +20,7 @@ import ( "context" "encoding/json" "fmt" + "strings" "time" "github.com/olivere/elastic" @@ -577,6 +578,12 @@ func (s *SpanReader) buildFindTraceIDsQuery(traceQuery *spanstore.TraceQueryPara tagQuery := s.buildTagQuery(k, v) boolQuery.Must(tagQuery) } + + for _, v := range traceQuery.CheckTagsPresent { + checkTagPresentQuery := s.buildCheckTagPresentQuery(v) + boolQuery.Must(checkTagPresentQuery) + } + return boolQuery } @@ -633,6 +640,13 @@ func (s *SpanReader) buildObjectQuery(field string, k string, v string) elastic. return elastic.NewBoolQuery().Must(keyQuery) } +func (s *SpanReader) buildCheckTagPresentQuery(field string) elastic.Query { + // Check in tags as well as process tags + checkTagQuery := elastic.NewExistsQuery(strings.Join([]string{"tag", field}, ".")) + checkProcesTagQuery := elastic.NewExistsQuery(strings.Join([]string{"process", "tag", field}, ".")) + return elastic.NewBoolQuery().Should(checkTagQuery, checkProcesTagQuery) +} + func logErrorToSpan(span opentracing.Span, err error) { ottag.Error.Set(span, true) span.LogFields(otlog.Error(err)) diff --git a/plugin/storage/es/spanstore/reader_test.go b/plugin/storage/es/spanstore/reader_test.go index 62f7e63eb58..530ba25ee28 100644 --- a/plugin/storage/es/spanstore/reader_test.go +++ b/plugin/storage/es/spanstore/reader_test.go @@ -915,6 +915,9 @@ func TestSpanReader_buildFindTraceIDsQuery(t *testing.T) { Tags: map[string]string{ "hello": "world", }, + CheckTagsPresent: []string{ + "hello", + }, } actualQuery := r.reader.buildFindTraceIDsQuery(traceQuery) @@ -927,6 +930,7 @@ func TestSpanReader_buildFindTraceIDsQuery(t *testing.T) { r.reader.buildServiceNameQuery("s"), r.reader.buildOperationNameQuery("o"), r.reader.buildTagQuery("hello", "world"), + r.reader.buildCheckTagPresentQuery("hello"), ) expected, err := expectedQuery.Source() require.NoError(t, err) diff --git a/proto-gen/api_v2/query.pb.go b/proto-gen/api_v2/query.pb.go index 16e45ac881a..f843ec7fda1 100644 --- a/proto-gen/api_v2/query.pb.go +++ b/proto-gen/api_v2/query.pb.go @@ -209,6 +209,7 @@ type TraceQueryParameters struct { DurationMin time.Duration `protobuf:"bytes,6,opt,name=duration_min,json=durationMin,proto3,stdduration" json:"duration_min"` DurationMax time.Duration `protobuf:"bytes,7,opt,name=duration_max,json=durationMax,proto3,stdduration" json:"duration_max"` SearchDepth int32 `protobuf:"varint,8,opt,name=search_depth,json=searchDepth,proto3" json:"search_depth,omitempty"` + CheckTagsPresent []string `protobuf:"bytes,9,rep,name=check_tags_present,json=checkTagsPresent,proto3" json:"check_tags_present,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -303,6 +304,13 @@ func (m *TraceQueryParameters) GetSearchDepth() int32 { return 0 } +func (m *TraceQueryParameters) GetCheckTagsPresent() []string { + if m != nil { + return m.CheckTagsPresent + } + return nil +} + type FindTracesRequest struct { Query *TraceQueryParameters `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -738,71 +746,73 @@ func init() { proto.RegisterFile("api_v2/query.proto", fileDescriptor_26651706f9 func init() { golang_proto.RegisterFile("api_v2/query.proto", fileDescriptor_26651706f9f8a4f0) } var fileDescriptor_26651706f9f8a4f0 = []byte{ - // 1017 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0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 0x90, 0x17, 0xfb, 0x44, 0x40, 0x94, 0xdb, 0xeb, 0x17, 0x68, 0xae, 0x23, 0x2d, 0xcc, 0x3a, - 0xa0, 0x2e, 0x61, 0x4f, 0x24, 0x9f, 0x12, 0x40, 0xf3, 0x36, 0xd4, 0xe6, 0xa4, 0x92, 0xa6, 0xc8, - 0x80, 0xa2, 0x62, 0x9e, 0x1c, 0xb3, 0x92, 0x33, 0xbb, 0x9b, 0x0f, 0xa1, 0xde, 0x25, 0xec, 0xd3, - 0x84, 0x73, 0xb3, 0xd8, 0x74, 0x28, 0x28, 0x1d, 0x95, 0x60, 0x72, 0x45, 0xd7, 0xa1, 0xc4, 0x27, - 0xb1, 0x37, 0xf4, 0xa9, 0xab, 0x12, 0x2d, 0x72, 0xc1, 0xc7, 0x3e, 0x75, 0xcd, 0x0f, 0xa0, 0x34, - 0xc3, 0x42, 0x08, 0x96, 0x53, 0xec, 0x17, 0xe7, 0xf3, 0xad, 0xa7, 0xb0, 0x9a, 0x09, 0x46, 0x65, - 0x70, 0x33, 0x35, 0x2c, 0x7c, 0x2c, 0x92, 0x3c, 0x32, 0x52, 0x74, 0x07, 0x60, 0x26, 0x89, 0xf5, - 0x9c, 0x98, 0x19, 0x3d, 0x53, 0xd6, 0x19, 0xbc, 0x93, 0xd2, 0x35, 0x7f, 0xd2, 0xe0, 0x6a, 0x97, - 0xb0, 0x5d, 0x12, 0x12, 0xea, 0x12, 0xda, 0xf7, 0x4f, 0xdb, 0x74, 0x17, 0xe0, 0x94, 0xf3, 0xaa, - 0x57, 0x17, 0xe3, 0x7b, 0x69, 0xc6, 0x77, 0xf4, 0x21, 0x14, 0x09, 0x75, 0x25, 0x44, 0xee, 0x3f, - 0x40, 0x14, 0x08, 0x75, 0xb9, 0xdc, 0x3c, 0x80, 0x6b, 0x0b, 0xf1, 0xa9, 0xea, 0x74, 0xa1, 0xe2, - 0xa6, 0xe4, 0x6a, 0x95, 0xbe, 0x91, 0xc9, 0x7b, 0x66, 0x3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x97, 0x51, 0xd5, 0x4e, 0xf3, 0xb5, 0x33, 0xf9, 0x7e, 0xa7, 0x83, 0xf2, 0xed, 0xa5, 0xdb, - 0xd6, 0xd6, 0xad, 0x9c, 0x96, 0x8b, 0xde, 0x05, 0x78, 0x20, 0xf0, 0x5a, 0x3b, 0x8f, 0xf7, 0xd0, - 0x5b, 0x03, 0xc6, 0xc2, 0x78, 0xdb, 0xb6, 0x5f, 0xf0, 0x01, 0xf0, 0xfc, 0xa4, 0xa1, 0xfd, 0x76, - 0xd2, 0xd0, 0xfe, 0x3a, 0x69, 0x68, 0xbf, 0xfe, 0xdd, 0xd0, 0xe0, 0x9a, 0x1f, 0x58, 0x73, 0x8a, - 0x2a, 0xbc, 0xcf, 0x57, 0xe4, 0xef, 0xc1, 0x8a, 0x18, 0xd9, 0x77, 0xfe, 0x0d, 0x00, 0x00, 0xff, - 0xff, 0x26, 0xf0, 0x4d, 0x32, 0x16, 0x0a, 0x00, 0x00, + // 1048 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0x67, 0x9d, 0x38, 0xb6, 0x9f, 0x9d, 0xfe, 0x79, 0x71, 0xda, 0x65, 0x0b, 0x8e, 0xb3, 0xa1, + 0x25, 0xaa, 0x9a, 0xdd, 0xd4, 0x08, 0x51, 0x22, 0x24, 0x48, 0x9a, 0x36, 0x4a, 0xa1, 0x25, 0x6c, + 0x73, 0x82, 0x83, 0x35, 0xf1, 0x0e, 0xeb, 0xc5, 0xf1, 0xec, 0x76, 0x77, 0x9c, 0x26, 0x42, 0x5c, + 0xf8, 0x04, 0x08, 0x2e, 0x9c, 0xf8, 0x06, 0x7c, 0x07, 0x8e, 0x3d, 0x22, 0x21, 0x2e, 0x1c, 0x02, + 0x0a, 0x7c, 0x10, 0x34, 0x7f, 0xd6, 0xb1, 0xd7, 0x51, 0x1a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, 0x5d, 0x78, 0x71, 0xd2, 0x30, 0x7e, 0x3d, 0x69, + 0x18, 0x7f, 0x9d, 0x34, 0x8c, 0x5f, 0xfe, 0x6e, 0x18, 0x70, 0x3d, 0x8c, 0x9c, 0x31, 0x47, 0x9d, + 0xde, 0xe7, 0x33, 0xea, 0x77, 0x6f, 0x46, 0x4a, 0xf6, 0x9d, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, + 0x5f, 0x76, 0xb6, 0x14, 0x44, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1290,6 +1300,21 @@ func (m *TraceQueryParameters) MarshalTo(dAtA []byte) (int, error) { i++ i = encodeVarintQuery(dAtA, i, uint64(m.SearchDepth)) } + if len(m.CheckTagsPresent) > 0 { + for _, s := range m.CheckTagsPresent { + dAtA[i] = 0x4a + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -1668,6 +1693,12 @@ func (m *TraceQueryParameters) Size() (n int) { if m.SearchDepth != 0 { n += 1 + sovQuery(uint64(m.SearchDepth)) } + if len(m.CheckTagsPresent) > 0 { + for _, s := range m.CheckTagsPresent { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2518,6 +2549,38 @@ func (m *TraceQueryParameters) Unmarshal(dAtA []byte) error { break } } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CheckTagsPresent", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CheckTagsPresent = append(m.CheckTagsPresent, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/storage/spanstore/interface.go b/storage/spanstore/interface.go index 207bc6c64f2..feeb0f245fb 100644 --- a/storage/spanstore/interface.go +++ b/storage/spanstore/interface.go @@ -44,14 +44,15 @@ type Reader interface { // TraceQueryParameters contains parameters of a trace query. type TraceQueryParameters struct { - ServiceName string - OperationName string - Tags map[string]string - StartTimeMin time.Time - StartTimeMax time.Time - DurationMin time.Duration - DurationMax time.Duration - NumTraces int + ServiceName string + OperationName string + Tags map[string]string + StartTimeMin time.Time + StartTimeMax time.Time + DurationMin time.Duration + DurationMax time.Duration + NumTraces int + CheckTagsPresent []string } // OperationQueryParameters contains parameters of query operations, empty spanKind means get operations for all kinds of span. From d9afd3749354ce0c710ec2687ff0a8fed2dc5f14 Mon Sep 17 00:00:00 2001 From: Annanay Date: Mon, 3 Feb 2020 12:54:43 +0530 Subject: [PATCH 3/8] Revert "[ES] Add support to check for presence of a tag" This reverts commit f94c2209b12df0abd3c4c27284fd647d1faa5501. Signed-off-by: Annanay --- cmd/query/app/grpc_handler.go | 17 +- model/proto/api_v2/query.proto | 1 - plugin/storage/es/spanstore/reader.go | 14 -- plugin/storage/es/spanstore/reader_test.go | 4 - proto-gen/api_v2/query.pb.go | 193 +++++++-------------- storage/spanstore/interface.go | 17 +- 6 files changed, 81 insertions(+), 165 deletions(-) diff --git a/cmd/query/app/grpc_handler.go b/cmd/query/app/grpc_handler.go index 3cfd620e021..9e832739023 100644 --- a/cmd/query/app/grpc_handler.go +++ b/cmd/query/app/grpc_handler.go @@ -79,15 +79,14 @@ func (g *GRPCHandler) ArchiveTrace(ctx context.Context, r *api_v2.ArchiveTraceRe func (g *GRPCHandler) FindTraces(r *api_v2.FindTracesRequest, stream api_v2.QueryService_FindTracesServer) error { query := r.GetQuery() queryParams := spanstore.TraceQueryParameters{ - ServiceName: query.ServiceName, - OperationName: query.OperationName, - Tags: query.Tags, - StartTimeMin: query.StartTimeMin, - StartTimeMax: query.StartTimeMax, - DurationMin: query.DurationMin, - DurationMax: query.DurationMax, - NumTraces: int(query.SearchDepth), - CheckTagsPresent: query.CheckTagsPresent, + ServiceName: query.ServiceName, + OperationName: query.OperationName, + Tags: query.Tags, + StartTimeMin: query.StartTimeMin, + StartTimeMax: query.StartTimeMax, + DurationMin: query.DurationMin, + DurationMax: query.DurationMax, + NumTraces: int(query.SearchDepth), } traces, err := g.queryService.FindTraces(stream.Context(), &queryParams) if err != nil { diff --git a/model/proto/api_v2/query.proto b/model/proto/api_v2/query.proto index ce36f33a4e1..98e1a74af46 100644 --- a/model/proto/api_v2/query.proto +++ b/model/proto/api_v2/query.proto @@ -95,7 +95,6 @@ message TraceQueryParameters { (gogoproto.nullable) = false ]; int32 search_depth = 8; - repeated string check_tags_present = 9; } message FindTracesRequest { diff --git a/plugin/storage/es/spanstore/reader.go b/plugin/storage/es/spanstore/reader.go index 3d83da4928f..046ad192068 100644 --- a/plugin/storage/es/spanstore/reader.go +++ b/plugin/storage/es/spanstore/reader.go @@ -20,7 +20,6 @@ import ( "context" "encoding/json" "fmt" - "strings" "time" "github.com/olivere/elastic" @@ -578,12 +577,6 @@ func (s *SpanReader) buildFindTraceIDsQuery(traceQuery *spanstore.TraceQueryPara tagQuery := s.buildTagQuery(k, v) boolQuery.Must(tagQuery) } - - for _, v := range traceQuery.CheckTagsPresent { - checkTagPresentQuery := s.buildCheckTagPresentQuery(v) - boolQuery.Must(checkTagPresentQuery) - } - return boolQuery } @@ -640,13 +633,6 @@ func (s *SpanReader) buildObjectQuery(field string, k string, v string) elastic. return elastic.NewBoolQuery().Must(keyQuery) } -func (s *SpanReader) buildCheckTagPresentQuery(field string) elastic.Query { - // Check in tags as well as process tags - checkTagQuery := elastic.NewExistsQuery(strings.Join([]string{"tag", field}, ".")) - checkProcesTagQuery := elastic.NewExistsQuery(strings.Join([]string{"process", "tag", field}, ".")) - return elastic.NewBoolQuery().Should(checkTagQuery, checkProcesTagQuery) -} - func logErrorToSpan(span opentracing.Span, err error) { ottag.Error.Set(span, true) span.LogFields(otlog.Error(err)) diff --git a/plugin/storage/es/spanstore/reader_test.go b/plugin/storage/es/spanstore/reader_test.go index 530ba25ee28..62f7e63eb58 100644 --- a/plugin/storage/es/spanstore/reader_test.go +++ b/plugin/storage/es/spanstore/reader_test.go @@ -915,9 +915,6 @@ func TestSpanReader_buildFindTraceIDsQuery(t *testing.T) { Tags: map[string]string{ "hello": "world", }, - CheckTagsPresent: []string{ - "hello", - }, } actualQuery := r.reader.buildFindTraceIDsQuery(traceQuery) @@ -930,7 +927,6 @@ func TestSpanReader_buildFindTraceIDsQuery(t *testing.T) { r.reader.buildServiceNameQuery("s"), r.reader.buildOperationNameQuery("o"), r.reader.buildTagQuery("hello", "world"), - r.reader.buildCheckTagPresentQuery("hello"), ) expected, err := expectedQuery.Source() require.NoError(t, err) diff --git a/proto-gen/api_v2/query.pb.go b/proto-gen/api_v2/query.pb.go index f843ec7fda1..16e45ac881a 100644 --- a/proto-gen/api_v2/query.pb.go +++ b/proto-gen/api_v2/query.pb.go @@ -209,7 +209,6 @@ type TraceQueryParameters struct { DurationMin time.Duration `protobuf:"bytes,6,opt,name=duration_min,json=durationMin,proto3,stdduration" json:"duration_min"` DurationMax time.Duration `protobuf:"bytes,7,opt,name=duration_max,json=durationMax,proto3,stdduration" json:"duration_max"` SearchDepth int32 `protobuf:"varint,8,opt,name=search_depth,json=searchDepth,proto3" json:"search_depth,omitempty"` - CheckTagsPresent []string `protobuf:"bytes,9,rep,name=check_tags_present,json=checkTagsPresent,proto3" json:"check_tags_present,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -304,13 +303,6 @@ func (m *TraceQueryParameters) GetSearchDepth() int32 { return 0 } -func (m *TraceQueryParameters) GetCheckTagsPresent() []string { - if m != nil { - return m.CheckTagsPresent - } - return nil -} - type FindTracesRequest struct { Query *TraceQueryParameters `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -746,73 +738,71 @@ func init() { proto.RegisterFile("api_v2/query.proto", fileDescriptor_26651706f9 func init() { golang_proto.RegisterFile("api_v2/query.proto", fileDescriptor_26651706f9f8a4f0) } var fileDescriptor_26651706f9f8a4f0 = []byte{ - // 1048 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0x67, 0x9d, 0x38, 0xb6, 0x9f, 0x9d, 0xfe, 0x79, 0x71, 0xda, 0x65, 0x0b, 0x8e, 0xb3, 0xa1, - 0x25, 0xaa, 0x9a, 0xdd, 0xd4, 0x08, 0x51, 0x22, 0x24, 0x48, 0x9a, 0x36, 0x4a, 0xa1, 0x25, 0x6c, - 0x73, 0x82, 0x83, 0x35, 0xf1, 0x0e, 0xeb, 0xc5, 0xf1, 0xec, 0x76, 0x77, 0x9c, 0x26, 0x42, 0x5c, - 0xf8, 0x04, 0x08, 0x2e, 0x9c, 0xf8, 0x06, 0x7c, 0x07, 0x8e, 0x3d, 0x22, 0x21, 0x2e, 0x1c, 0x02, - 0x0a, 0x7c, 0x10, 0x34, 0x7f, 0xd6, 0xb1, 0xd7, 0x51, 0x1a, 0x7a, 0xe0, 0xe4, 0x99, 0x37, 0x6f, - 0x7e, 0xef, 0xcf, 0xfc, 0x7e, 0x6f, 0x0d, 0x48, 0xe2, 0xb0, 0x7d, 0xd0, 0x72, 0x9f, 0x0d, 0x68, - 0x72, 0xe4, 0xc4, 0x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0x33, 0xea, 0x77, 0x6f, 0x46, 0x4a, 0xf6, 0x9d, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, - 0x5f, 0x76, 0xb6, 0x14, 0x44, 0x0a, 0x00, 0x00, + // 1017 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x73, 0xdb, 0x44, + 0x14, 0x47, 0x4e, 0x1c, 0xdb, 0xcf, 0x76, 0x4b, 0xd7, 0x4e, 0x2b, 0x54, 0xb0, 0x1d, 0x85, 0x96, + 0x4c, 0x87, 0x48, 0xa9, 0x19, 0x86, 0x92, 0x61, 0x06, 0xe2, 0xa6, 0xf5, 0xa4, 0xd0, 0x52, 0xd4, + 0x9c, 0xe0, 0xe0, 0xd9, 0x58, 0x8b, 0x2c, 0x1c, 0xaf, 0x54, 0x69, 0xed, 0xc6, 0xc3, 0x70, 0xe1, + 0x13, 0x30, 0x70, 0xe1, 0xc4, 0x95, 0x13, 0xdf, 0x81, 0x63, 0x8f, 0xcc, 0x70, 0xe3, 0x10, 0x98, + 0xc0, 0x07, 0x61, 0xf6, 0x8f, 0x1c, 0x59, 0xce, 0xa4, 0xa1, 0x07, 0x4e, 0xde, 0x7d, 0xfb, 0xde, + 0xef, 0xfd, 0xfb, 0xbd, 0x67, 0x01, 0xc2, 0xa1, 0xdf, 0x9b, 0xb4, 0xed, 0xa7, 0x63, 0x12, 0x4d, + 0xad, 0x30, 0x0a, 0x58, 0x80, 0xaa, 0x5f, 0x61, 0xe2, 0x91, 0xc8, 0x92, 0x4f, 0x46, 0x79, 0x14, + 0xb8, 0xe4, 0x50, 0xbe, 0x19, 0x75, 0x2f, 0xf0, 0x02, 0x71, 0xb4, 0xf9, 0x49, 0x49, 0x5f, 0xf7, + 0x82, 0xc0, 0x3b, 0x24, 0x36, 0x0e, 0x7d, 0x1b, 0x53, 0x1a, 0x30, 0xcc, 0xfc, 0x80,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xb3, 0xea, 0xa2, 0x57, 0x61, + 0x69, 0x48, 0xa6, 0xaa, 0xb7, 0xfc, 0x88, 0xea, 0x90, 0x9f, 0xe0, 0xc3, 0x71, 0xd2, 0x4a, 0x79, + 0xd9, 0xce, 0xdd, 0xd1, 0xcc, 0x47, 0x70, 0xe5, 0xbe, 0x4f, 0x5d, 0xd1, 0xaf, 0x38, 0xe1, 0xec, + 0xfb, 0x90, 0x17, 0xfb, 0x44, 0x40, 0x94, 0xdb, 0xeb, 0x17, 0x68, 0xae, 0x23, 0x2d, 0xcc, 0x3a, + 0xa0, 0x2e, 0x61, 0x4f, 0x24, 0x9f, 0x12, 0x40, 0xf3, 0x36, 0xd4, 0xe6, 0xa4, 0x92, 0xa6, 0xc8, + 0x80, 0xa2, 0x62, 0x9e, 0x1c, 0xb3, 0x92, 0x33, 0xbb, 0x9b, 0x0f, 0xa1, 0xde, 0x25, 0xec, 0xd3, + 0x84, 0x73, 0xb3, 0xd8, 0x74, 0x28, 0x28, 0x1d, 0x95, 0x60, 0x72, 0x45, 0xd7, 0xa1, 0xc4, 0x27, + 0xb1, 0x37, 0xf4, 0xa9, 0xab, 0x12, 0x2d, 0x72, 0xc1, 0xc7, 0x3e, 0x75, 0xcd, 0x0f, 0xa0, 0x34, + 0xc3, 0x42, 0x08, 0x96, 0x53, 0xec, 0x17, 0xe7, 0xf3, 0xad, 0xa7, 0xb0, 0x9a, 0x09, 0x46, 0x65, + 0x70, 0x33, 0x35, 0x2c, 0x7c, 0x2c, 0x92, 0x3c, 0x32, 0x52, 0x74, 0x07, 0x60, 0x26, 0x89, 0xf5, + 0x9c, 0x98, 0x19, 0x3d, 0x53, 0xd6, 0x19, 0xbc, 0x93, 0xd2, 0x35, 0x7f, 0xd2, 0xe0, 0x6a, 0x97, + 0xb0, 0x5d, 0x12, 0x12, 0xea, 0x12, 0xda, 0xf7, 0x4f, 0xdb, 0x74, 0x17, 0xe0, 0x94, 0xf3, 0xaa, + 0x57, 0x17, 0xe3, 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59, 0x18, 0x78, 0xe3, 0xcd, 0xf3, + 0x95, 0x94, 0xbb, 0x9a, 0x70, 0x57, 0x45, 0x65, 0xfb, 0x74, 0x76, 0xd0, 0x33, 0xf1, 0x25, 0x91, + 0xa6, 0x26, 0xba, 0xb1, 0x88, 0x76, 0xc6, 0x68, 0x19, 0x37, 0x5f, 0xa4, 0xa6, 0xdc, 0xae, 0x0a, + 0xb7, 0x97, 0x51, 0xd5, 0x4e, 0xf3, 0xb5, 0x33, 0xf9, 0x7e, 0xa7, 0x83, 0xf2, 0xed, 0xa5, 0xdb, + 0xd6, 0xd6, 0xad, 0x9c, 0x96, 0x8b, 0xde, 0x05, 0x78, 0x20, 0xf0, 0x5a, 0x3b, 0x8f, 0xf7, 0xd0, + 0x5b, 0x03, 0xc6, 0xc2, 0x78, 0xdb, 0xb6, 0x5f, 0xf0, 0x01, 0xf0, 0xfc, 0xa4, 0xa1, 0xfd, 0x76, + 0xd2, 0xd0, 0xfe, 0x3a, 0x69, 0x68, 0xbf, 0xfe, 0xdd, 0xd0, 0xe0, 0x9a, 0x1f, 0x58, 0x73, 0x8a, + 0x2a, 0xbc, 0xcf, 0x57, 0xe4, 0xef, 0xc1, 0x8a, 0x18, 0xd9, 0x77, 0xfe, 0x0d, 0x00, 0x00, 0xff, + 0xff, 0x26, 0xf0, 0x4d, 0x32, 0x16, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1300,21 +1290,6 @@ func (m *TraceQueryParameters) MarshalTo(dAtA []byte) (int, error) { i++ i = encodeVarintQuery(dAtA, i, uint64(m.SearchDepth)) } - if len(m.CheckTagsPresent) > 0 { - for _, s := range m.CheckTagsPresent { - dAtA[i] = 0x4a - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -1693,12 +1668,6 @@ func (m *TraceQueryParameters) Size() (n int) { if m.SearchDepth != 0 { n += 1 + sovQuery(uint64(m.SearchDepth)) } - if len(m.CheckTagsPresent) > 0 { - for _, s := range m.CheckTagsPresent { - l = len(s) - n += 1 + l + sovQuery(uint64(l)) - } - } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2549,38 +2518,6 @@ func (m *TraceQueryParameters) Unmarshal(dAtA []byte) error { break } } - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CheckTagsPresent", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CheckTagsPresent = append(m.CheckTagsPresent, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/storage/spanstore/interface.go b/storage/spanstore/interface.go index feeb0f245fb..207bc6c64f2 100644 --- a/storage/spanstore/interface.go +++ b/storage/spanstore/interface.go @@ -44,15 +44,14 @@ type Reader interface { // TraceQueryParameters contains parameters of a trace query. type TraceQueryParameters struct { - ServiceName string - OperationName string - Tags map[string]string - StartTimeMin time.Time - StartTimeMax time.Time - DurationMin time.Duration - DurationMax time.Duration - NumTraces int - CheckTagsPresent []string + ServiceName string + OperationName string + Tags map[string]string + StartTimeMin time.Time + StartTimeMax time.Time + DurationMin time.Duration + DurationMax time.Duration + NumTraces int } // OperationQueryParameters contains parameters of query operations, empty spanKind means get operations for all kinds of span. From 6f87b9390614bdeacfaf2ae8c7eabaf06834fc6d Mon Sep 17 00:00:00 2001 From: Annanay Date: Mon, 3 Feb 2020 17:14:36 +0530 Subject: [PATCH 4/8] Add query builder and integration tests Signed-off-by: Annanay --- .../es/spanstore/fixtures/query_02.json | 103 ++++++++++++++++++ .../es/spanstore/fixtures/query_03.json | 103 ++++++++++++++++++ plugin/storage/es/spanstore/reader_test.go | 30 +++++ .../storage/integration/fixtures/queries.json | 32 ++++++ .../fixtures/traces/tags_regex_trace.json | 33 ++++++ 5 files changed, 301 insertions(+) create mode 100644 plugin/storage/es/spanstore/fixtures/query_02.json create mode 100644 plugin/storage/es/spanstore/fixtures/query_03.json create mode 100644 plugin/storage/integration/fixtures/traces/tags_regex_trace.json diff --git a/plugin/storage/es/spanstore/fixtures/query_02.json b/plugin/storage/es/spanstore/fixtures/query_02.json new file mode 100644 index 00000000000..60d6516aef1 --- /dev/null +++ b/plugin/storage/es/spanstore/fixtures/query_02.json @@ -0,0 +1,103 @@ +{ + "bool":{ + "should":[ + { + "bool":{ + "must":{ + "regexp":{ + "tag.bat@foo":{ + "value":"spo.*" + } + } + } + } + }, + { + "bool":{ + "must":{ + "regexp":{ + "process.tag.bat@foo":{ + "value":"spo.*" + } + } + } + } + }, + { + "nested":{ + "path":"tags", + "query":{ + "bool":{ + "must":[ + { + "match":{ + "tags.key":{ + "query":"bat.foo" + } + } + }, + { + "regexp":{ + "tags.value":{ + "value":"spo.*" + } + } + } + ] + } + } + } + }, + { + "nested":{ + "path":"process.tags", + "query":{ + "bool":{ + "must":[ + { + "match":{ + "process.tags.key":{ + "query":"bat.foo" + } + } + }, + { + "regexp":{ + "process.tags.value":{ + "value":"spo.*" + } + } + } + ] + } + } + } + }, + { + "nested":{ + "path":"logs.fields", + "query":{ + "bool":{ + "must":[ + { + "match":{ + "logs.fields.key":{ + "query":"bat.foo" + } + } + }, + { + "regexp":{ + "logs.fields.value":{ + "value":"spo.*" + } + } + } + ] + } + } + } + } + ] + } +} diff --git a/plugin/storage/es/spanstore/fixtures/query_03.json b/plugin/storage/es/spanstore/fixtures/query_03.json new file mode 100644 index 00000000000..05da6e4a0b6 --- /dev/null +++ b/plugin/storage/es/spanstore/fixtures/query_03.json @@ -0,0 +1,103 @@ +{ + "bool":{ + "should":[ + { + "bool":{ + "must":{ + "regexp":{ + "tag.bat@foo":{ + "value":"spo\\*" + } + } + } + } + }, + { + "bool":{ + "must":{ + "regexp":{ + "process.tag.bat@foo":{ + "value":"spo\\*" + } + } + } + } + }, + { + "nested":{ + "path":"tags", + "query":{ + "bool":{ + "must":[ + { + "match":{ + "tags.key":{ + "query":"bat.foo" + } + } + }, + { + "regexp":{ + "tags.value":{ + "value":"spo\\*" + } + } + } + ] + } + } + } + }, + { + "nested":{ + "path":"process.tags", + "query":{ + "bool":{ + "must":[ + { + "match":{ + "process.tags.key":{ + "query":"bat.foo" + } + } + }, + { + "regexp":{ + "process.tags.value":{ + "value":"spo\\*" + } + } + } + ] + } + } + } + }, + { + "nested":{ + "path":"logs.fields", + "query":{ + "bool":{ + "must":[ + { + "match":{ + "logs.fields.key":{ + "query":"bat.foo" + } + } + }, + { + "regexp":{ + "logs.fields.value":{ + "value":"spo\\*" + } + } + } + ] + } + } + } + } + ] + } +} diff --git a/plugin/storage/es/spanstore/reader_test.go b/plugin/storage/es/spanstore/reader_test.go index 62f7e63eb58..b2431dd3a31 100644 --- a/plugin/storage/es/spanstore/reader_test.go +++ b/plugin/storage/es/spanstore/reader_test.go @@ -1029,6 +1029,36 @@ func TestSpanReader_buildTagQuery(t *testing.T) { }) } +func TestSpanReader_buildTagRegexQuery(t *testing.T) { + inStr, err := ioutil.ReadFile("fixtures/query_02.json") + require.NoError(t, err) + withSpanReader(func(r *spanReaderTest) { + tagQuery := r.reader.buildTagQuery("bat.foo", "spo.*") + actual, err := tagQuery.Source() + require.NoError(t, err) + + expected := make(map[string]interface{}) + json.Unmarshal(inStr, &expected) + + assert.EqualValues(t, expected, actual) + }) +} + +func TestSpanReader_buildTagRegexEscapedQuery(t *testing.T) { + inStr, err := ioutil.ReadFile("fixtures/query_03.json") + require.NoError(t, err) + withSpanReader(func(r *spanReaderTest) { + tagQuery := r.reader.buildTagQuery("bat.foo", "spo\\*") + actual, err := tagQuery.Source() + require.NoError(t, err) + + expected := make(map[string]interface{}) + json.Unmarshal(inStr, &expected) + + assert.EqualValues(t, expected, actual) + }) +} + func TestSpanReader_GetEmptyIndex(t *testing.T) { withSpanReader(func(r *spanReaderTest) { mockSearchService(r). diff --git a/plugin/storage/integration/fixtures/queries.json b/plugin/storage/integration/fixtures/queries.json index 35707341379..e8fa4d271a6 100644 --- a/plugin/storage/integration/fixtures/queries.json +++ b/plugin/storage/integration/fixtures/queries.json @@ -376,5 +376,37 @@ "NumTraces": 1000 }, "ExpectedFixtures": ["multiple1_trace", "multiple2_trace", "multiple3_trace"] + }, + { + "Caption": "Tag regex + Operation name + max Duration", + "Query": { + "ServiceName": "query23-service", + "OperationName": "query23-operation", + "Tags": { + "sameplacetag1":"random\\*" + }, + "StartTimeMin": "2017-01-26T15:46:31.639875Z", + "StartTimeMax": "2017-01-26T17:46:31.639875Z", + "DurationMin": 0, + "DurationMax": 1000, + "NumTraces": 1000 + }, + "ExpectedFixtures": ["tags_regex_trace"] + }, + { + "Caption": "Tag regex + Operation name + max Duration - Multiple traces", + "Query": { + "ServiceName": "query23-service", + "OperationName": "", + "Tags": { + "sameplacetag1":"same*" + }, + "StartTimeMin": "2017-01-26T15:46:31.639875Z", + "StartTimeMax": "2017-01-26T17:46:31.639875Z", + "DurationMin": 0, + "DurationMax": 1000, + "NumTraces": 1000 + }, + "ExpectedFixtures": ["tags_opname_trace", "tags_regex_trace"] } ] diff --git a/plugin/storage/integration/fixtures/traces/tags_regex_trace.json b/plugin/storage/integration/fixtures/traces/tags_regex_trace.json new file mode 100644 index 00000000000..d4699a736dc --- /dev/null +++ b/plugin/storage/integration/fixtures/traces/tags_regex_trace.json @@ -0,0 +1,33 @@ +{ + "spans": [ + { + "traceId": "AAAAAAAAAAAAAAAAAAAAEh==", + "spanId": "AAAAAAAAAAU=", + "operationName": "query23-operation", + "references": [], + "startTime": "2017-01-26T16:46:31.639875Z", + "duration": "1000ns", + "tags": [ + { + "key": "sameplacetag1", + "vType": "STRING", + "vStr": "random*" + } + ], + "process": { + "serviceName": "query23-service", + "tags": [] + }, + "logs": [ + { + "timestamp": "2017-01-26T16:46:31.639875Z", + "fields": [] + }, + { + "timestamp": "2017-01-26T16:46:31.639875Z", + "fields": [] + } + ] + } + ] +} From 0955efa38d658f508c64c41f71c5eafdbdf0d8ac Mon Sep 17 00:00:00 2001 From: Annanay Date: Thu, 6 Feb 2020 01:04:55 +0530 Subject: [PATCH 5/8] Fix tests Signed-off-by: Annanay --- plugin/storage/integration/fixtures/queries.json | 14 +++++++------- ...trace.json => tags_escaped_operator_trace.json} | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) rename plugin/storage/integration/fixtures/traces/{tags_regex_trace.json => tags_escaped_operator_trace.json} (93%) diff --git a/plugin/storage/integration/fixtures/queries.json b/plugin/storage/integration/fixtures/queries.json index e8fa4d271a6..dbde74b022a 100644 --- a/plugin/storage/integration/fixtures/queries.json +++ b/plugin/storage/integration/fixtures/queries.json @@ -378,7 +378,7 @@ "ExpectedFixtures": ["multiple1_trace", "multiple2_trace", "multiple3_trace"] }, { - "Caption": "Tag regex + Operation name + max Duration", + "Caption": "Tag excaped operator + Operation name + max Duration", "Query": { "ServiceName": "query23-service", "OperationName": "query23-operation", @@ -391,22 +391,22 @@ "DurationMax": 1000, "NumTraces": 1000 }, - "ExpectedFixtures": ["tags_regex_trace"] + "ExpectedFixtures": ["tags_escaped_operator_trace"] }, { - "Caption": "Tag regex + Operation name + max Duration - Multiple traces", + "Caption": "Tag wildcard regex + Operation name + max Duration", "Query": { - "ServiceName": "query23-service", + "ServiceName": "query12-service", "OperationName": "", "Tags": { - "sameplacetag1":"same*" + "sameplacetag1":"same.*" }, "StartTimeMin": "2017-01-26T15:46:31.639875Z", "StartTimeMax": "2017-01-26T17:46:31.639875Z", "DurationMin": 0, - "DurationMax": 1000, + "DurationMax": 0, "NumTraces": 1000 }, - "ExpectedFixtures": ["tags_opname_trace", "tags_regex_trace"] + "ExpectedFixtures": ["tags_opname_trace"] } ] diff --git a/plugin/storage/integration/fixtures/traces/tags_regex_trace.json b/plugin/storage/integration/fixtures/traces/tags_escaped_operator_trace.json similarity index 93% rename from plugin/storage/integration/fixtures/traces/tags_regex_trace.json rename to plugin/storage/integration/fixtures/traces/tags_escaped_operator_trace.json index d4699a736dc..ff4d1d20c0f 100644 --- a/plugin/storage/integration/fixtures/traces/tags_regex_trace.json +++ b/plugin/storage/integration/fixtures/traces/tags_escaped_operator_trace.json @@ -1,7 +1,7 @@ { "spans": [ { - "traceId": "AAAAAAAAAAAAAAAAAAAAEh==", + "traceId": "AAAAAAAAAAAAAAAAAAAFEh==", "spanId": "AAAAAAAAAAU=", "operationName": "query23-operation", "references": [], From af7baa6059d73515ac4b8ca70018296171dfb85f Mon Sep 17 00:00:00 2001 From: Annanay Date: Thu, 6 Feb 2020 12:50:15 +0530 Subject: [PATCH 6/8] Add ES specific integration tests Signed-off-by: Annanay --- .../storage/integration/elasticsearch_test.go | 6 ++-- .../storage/integration/fixtures/queries.json | 32 ----------------- .../integration/fixtures/queries_es.json | 34 +++++++++++++++++++ .../storage/integration/integration_test.go | 13 +++---- 4 files changed, 45 insertions(+), 40 deletions(-) create mode 100644 plugin/storage/integration/fixtures/queries_es.json diff --git a/plugin/storage/integration/elasticsearch_test.go b/plugin/storage/integration/elasticsearch_test.go index de138819330..780304fb3e3 100644 --- a/plugin/storage/integration/elasticsearch_test.go +++ b/plugin/storage/integration/elasticsearch_test.go @@ -68,7 +68,7 @@ func (s *ESStorageIntegration) getVersion() (uint, error) { return uint(esVersion), nil } -func (s *ESStorageIntegration) initializeES(allTagsAsFields, archive bool) error { +func (s *ESStorageIntegration) initializeES(t *testing.T, allTagsAsFields, archive bool) error { rawClient, err := elastic.NewClient( elastic.SetURL(queryURL), elastic.SetSniff(false)) @@ -96,6 +96,8 @@ func (s *ESStorageIntegration) initializeES(allTagsAsFields, archive bool) error s.esCleanUp(allTagsAsFields, archive) // TODO: remove this flag after ES support returning spanKind when get operations s.notSupportSpanKindWithOperation = true + + s.Fixtures = loadAndParseQueryTestCases(t, "fixtures/queries_es.json") return nil } @@ -169,7 +171,7 @@ func testElasticsearchStorage(t *testing.T, allTagsAsFields, archive bool) { t.Fatal(err) } s := &ESStorageIntegration{} - require.NoError(t, s.initializeES(allTagsAsFields, archive)) + require.NoError(t, s.initializeES(t, allTagsAsFields, archive)) if archive { t.Run("ArchiveTrace", s.testArchiveTrace) diff --git a/plugin/storage/integration/fixtures/queries.json b/plugin/storage/integration/fixtures/queries.json index dbde74b022a..35707341379 100644 --- a/plugin/storage/integration/fixtures/queries.json +++ b/plugin/storage/integration/fixtures/queries.json @@ -376,37 +376,5 @@ "NumTraces": 1000 }, "ExpectedFixtures": ["multiple1_trace", "multiple2_trace", "multiple3_trace"] - }, - { - "Caption": "Tag excaped operator + Operation name + max Duration", - "Query": { - "ServiceName": "query23-service", - "OperationName": "query23-operation", - "Tags": { - "sameplacetag1":"random\\*" - }, - "StartTimeMin": "2017-01-26T15:46:31.639875Z", - "StartTimeMax": "2017-01-26T17:46:31.639875Z", - "DurationMin": 0, - "DurationMax": 1000, - "NumTraces": 1000 - }, - "ExpectedFixtures": ["tags_escaped_operator_trace"] - }, - { - "Caption": "Tag wildcard regex + Operation name + max Duration", - "Query": { - "ServiceName": "query12-service", - "OperationName": "", - "Tags": { - "sameplacetag1":"same.*" - }, - "StartTimeMin": "2017-01-26T15:46:31.639875Z", - "StartTimeMax": "2017-01-26T17:46:31.639875Z", - "DurationMin": 0, - "DurationMax": 0, - "NumTraces": 1000 - }, - "ExpectedFixtures": ["tags_opname_trace"] } ] diff --git a/plugin/storage/integration/fixtures/queries_es.json b/plugin/storage/integration/fixtures/queries_es.json new file mode 100644 index 00000000000..eab38c94900 --- /dev/null +++ b/plugin/storage/integration/fixtures/queries_es.json @@ -0,0 +1,34 @@ +[ + { + "Caption": "Tag excaped operator + Operation name + max Duration", + "Query": { + "ServiceName": "query23-service", + "OperationName": "query23-operation", + "Tags": { + "sameplacetag1":"random\\*" + }, + "StartTimeMin": "2017-01-26T15:46:31.639875Z", + "StartTimeMax": "2017-01-26T17:46:31.639875Z", + "DurationMin": 0, + "DurationMax": 1000, + "NumTraces": 1000 + }, + "ExpectedFixtures": ["tags_escaped_operator_trace"] + }, + { + "Caption": "Tag wildcard regex + Operation name + max Duration", + "Query": { + "ServiceName": "query12-service", + "OperationName": "", + "Tags": { + "sameplacetag1":"same.*" + }, + "StartTimeMin": "2017-01-26T15:46:31.639875Z", + "StartTimeMax": "2017-01-26T17:46:31.639875Z", + "DurationMin": 0, + "DurationMax": 0, + "NumTraces": 1000 + }, + "ExpectedFixtures": ["tags_opname_trace"] + } +] \ No newline at end of file diff --git a/plugin/storage/integration/integration_test.go b/plugin/storage/integration/integration_test.go index 3fa9646e4b2..03a0c7d29f5 100644 --- a/plugin/storage/integration/integration_test.go +++ b/plugin/storage/integration/integration_test.go @@ -61,6 +61,7 @@ type StorageIntegration struct { SpanReader spanstore.Reader DependencyWriter dependencystore.Writer DependencyReader dependencystore.Reader + Fixtures []*QueryFixtures // TODO: remove this flag after all storage plugins returns spanKind with operationNames notSupportSpanKindWithOperation bool @@ -208,13 +209,13 @@ func (s *StorageIntegration) testFindTraces(t *testing.T) { defer s.cleanUp(t) // Note: all cases include ServiceName + StartTime range - queryTestCases := loadAndParseQueryTestCases(t) + s.Fixtures = append(s.Fixtures, loadAndParseQueryTestCases(t, "fixtures/queries.json")...) // Each query test case only specifies matching traces, but does not provide counterexamples. // To improve coverage we get all possible traces and store all of them before running queries. allTraceFixtures := make(map[string]*model.Trace) - expectedTracesPerTestCase := make([][]*model.Trace, 0, len(queryTestCases)) - for _, queryTestCase := range queryTestCases { + expectedTracesPerTestCase := make([][]*model.Trace, 0, len(s.Fixtures)) + for _, queryTestCase := range s.Fixtures { var expected []*model.Trace for _, traceFixture := range queryTestCase.ExpectedFixtures { trace, ok := allTraceFixtures[traceFixture] @@ -229,7 +230,7 @@ func (s *StorageIntegration) testFindTraces(t *testing.T) { expectedTracesPerTestCase = append(expectedTracesPerTestCase, expected) } s.refresh(t) - for i, queryTestCase := range queryTestCases { + for i, queryTestCase := range s.Fixtures { t.Run(queryTestCase.Caption, func(t *testing.T) { expected := expectedTracesPerTestCase[i] actual := s.findTracesByQuery(t, queryTestCase.Query, expected) @@ -304,9 +305,9 @@ func loadAndParseJSONPB(t *testing.T, path string, object proto.Message) { require.NoError(t, err, "Not expecting error when unmarshaling fixture %s", path) } -func loadAndParseQueryTestCases(t *testing.T) []*QueryFixtures { +func loadAndParseQueryTestCases(t *testing.T, queriesFile string) []*QueryFixtures { var queries []*QueryFixtures - loadAndParseJSON(t, "fixtures/queries.json", &queries) + loadAndParseJSON(t, queriesFile, &queries) return queries } From 039e6c907374d65072099b69a01a0ae5053c8250 Mon Sep 17 00:00:00 2001 From: Annanay Date: Wed, 4 Mar 2020 19:58:21 +0530 Subject: [PATCH 7/8] Improve tag search tests Signed-off-by: Annanay --- .../storage/integration/elasticsearch_test.go | 3 +- .../integration/fixtures/queries_es.json | 12 +++---- ...son => tags_escaped_operator_trace_1.json} | 2 +- .../traces/tags_escaped_operator_trace_2.json | 33 +++++++++++++++++++ .../traces/tags_wildcard_regex_1.json | 25 ++++++++++++++ .../traces/tags_wildcard_regex_2.json | 25 ++++++++++++++ 6 files changed, 92 insertions(+), 8 deletions(-) rename plugin/storage/integration/fixtures/traces/{tags_escaped_operator_trace.json => tags_escaped_operator_trace_1.json} (96%) create mode 100644 plugin/storage/integration/fixtures/traces/tags_escaped_operator_trace_2.json create mode 100644 plugin/storage/integration/fixtures/traces/tags_wildcard_regex_1.json create mode 100644 plugin/storage/integration/fixtures/traces/tags_wildcard_regex_2.json diff --git a/plugin/storage/integration/elasticsearch_test.go b/plugin/storage/integration/elasticsearch_test.go index 780304fb3e3..7a9e7ede31e 100644 --- a/plugin/storage/integration/elasticsearch_test.go +++ b/plugin/storage/integration/elasticsearch_test.go @@ -97,7 +97,6 @@ func (s *ESStorageIntegration) initializeES(t *testing.T, allTagsAsFields, archi // TODO: remove this flag after ES support returning spanKind when get operations s.notSupportSpanKindWithOperation = true - s.Fixtures = loadAndParseQueryTestCases(t, "fixtures/queries_es.json") return nil } @@ -173,6 +172,8 @@ func testElasticsearchStorage(t *testing.T, allTagsAsFields, archive bool) { s := &ESStorageIntegration{} require.NoError(t, s.initializeES(t, allTagsAsFields, archive)) + s.Fixtures = loadAndParseQueryTestCases(t, "fixtures/queries_es.json") + if archive { t.Run("ArchiveTrace", s.testArchiveTrace) } else { diff --git a/plugin/storage/integration/fixtures/queries_es.json b/plugin/storage/integration/fixtures/queries_es.json index eab38c94900..810c912b5db 100644 --- a/plugin/storage/integration/fixtures/queries_es.json +++ b/plugin/storage/integration/fixtures/queries_es.json @@ -1,11 +1,11 @@ [ { - "Caption": "Tag excaped operator + Operation name + max Duration", + "Caption": "Tag escaped operator + Operation name + max Duration", "Query": { "ServiceName": "query23-service", "OperationName": "query23-operation", "Tags": { - "sameplacetag1":"random\\*" + "sameplacetag1":"same\\*" }, "StartTimeMin": "2017-01-26T15:46:31.639875Z", "StartTimeMax": "2017-01-26T17:46:31.639875Z", @@ -13,12 +13,12 @@ "DurationMax": 1000, "NumTraces": 1000 }, - "ExpectedFixtures": ["tags_escaped_operator_trace"] + "ExpectedFixtures": ["tags_escaped_operator_trace_1"] }, { - "Caption": "Tag wildcard regex + Operation name + max Duration", + "Caption": "Tag wildcard regex", "Query": { - "ServiceName": "query12-service", + "ServiceName": "query24-service", "OperationName": "", "Tags": { "sameplacetag1":"same.*" @@ -29,6 +29,6 @@ "DurationMax": 0, "NumTraces": 1000 }, - "ExpectedFixtures": ["tags_opname_trace"] + "ExpectedFixtures": ["tags_wildcard_regex_1", "tags_wildcard_regex_2"] } ] \ No newline at end of file diff --git a/plugin/storage/integration/fixtures/traces/tags_escaped_operator_trace.json b/plugin/storage/integration/fixtures/traces/tags_escaped_operator_trace_1.json similarity index 96% rename from plugin/storage/integration/fixtures/traces/tags_escaped_operator_trace.json rename to plugin/storage/integration/fixtures/traces/tags_escaped_operator_trace_1.json index ff4d1d20c0f..6079e9beea5 100644 --- a/plugin/storage/integration/fixtures/traces/tags_escaped_operator_trace.json +++ b/plugin/storage/integration/fixtures/traces/tags_escaped_operator_trace_1.json @@ -11,7 +11,7 @@ { "key": "sameplacetag1", "vType": "STRING", - "vStr": "random*" + "vStr": "same*" } ], "process": { diff --git a/plugin/storage/integration/fixtures/traces/tags_escaped_operator_trace_2.json b/plugin/storage/integration/fixtures/traces/tags_escaped_operator_trace_2.json new file mode 100644 index 00000000000..2a0da0ddc5a --- /dev/null +++ b/plugin/storage/integration/fixtures/traces/tags_escaped_operator_trace_2.json @@ -0,0 +1,33 @@ +{ + "spans": [ + { + "traceId": "AAAAAAAAAAAAAAAAAABZEh==", + "spanId": "AAAAAAAAAAU=", + "operationName": "query23-operation", + "references": [], + "startTime": "2017-01-26T16:46:31.639875Z", + "duration": "1000ns", + "tags": [ + { + "key": "sameplacetag1", + "vType": "STRING", + "vStr": "sameplacedifferentvalue" + } + ], + "process": { + "serviceName": "query23-service", + "tags": [] + }, + "logs": [ + { + "timestamp": "2017-01-26T16:46:31.639875Z", + "fields": [] + }, + { + "timestamp": "2017-01-26T16:46:31.639875Z", + "fields": [] + } + ] + } + ] +} diff --git a/plugin/storage/integration/fixtures/traces/tags_wildcard_regex_1.json b/plugin/storage/integration/fixtures/traces/tags_wildcard_regex_1.json new file mode 100644 index 00000000000..9eaa2731950 --- /dev/null +++ b/plugin/storage/integration/fixtures/traces/tags_wildcard_regex_1.json @@ -0,0 +1,25 @@ +{ + "spans": [ + { + "traceId": "AAAAAAAAAAAAAAAAAAAKEg==", + "spanId": "AAAAAAAAAAQ=", + "operationName": "", + "references": [ + ], + "tags": [ + { + "key": "sameplacetag1", + "vType": "STRING", + "vStr": "sameplacevalue1" + } + ], + "startTime": "2017-01-26T16:46:31.639875Z", + "duration": "2000ns", + "process": { + "serviceName": "query24-service", + "tags": [] + }, + "logs": [] + } + ] +} diff --git a/plugin/storage/integration/fixtures/traces/tags_wildcard_regex_2.json b/plugin/storage/integration/fixtures/traces/tags_wildcard_regex_2.json new file mode 100644 index 00000000000..887978c6c4c --- /dev/null +++ b/plugin/storage/integration/fixtures/traces/tags_wildcard_regex_2.json @@ -0,0 +1,25 @@ +{ + "spans": [ + { + "traceId": "AAAAAAAAAAAAAAAAAAASEg==", + "spanId": "AAAAAAAAAAQ=", + "operationName": "", + "references": [ + ], + "tags": [ + { + "key": "sameplacetag1", + "vType": "STRING", + "vStr": "sameplacevalue2" + } + ], + "startTime": "2017-01-26T16:46:31.639875Z", + "duration": "2000ns", + "process": { + "serviceName": "query24-service", + "tags": [] + }, + "logs": [] + } + ] +} From 0d2fb5e4218fa68ab40fe07edf60790cf507cc1f Mon Sep 17 00:00:00 2001 From: Annanay Date: Wed, 4 Mar 2020 20:23:24 +0530 Subject: [PATCH 8/8] Nit, clean function params Signed-off-by: Annanay --- plugin/storage/integration/elasticsearch_test.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugin/storage/integration/elasticsearch_test.go b/plugin/storage/integration/elasticsearch_test.go index 7a9e7ede31e..a5d9ad39a58 100644 --- a/plugin/storage/integration/elasticsearch_test.go +++ b/plugin/storage/integration/elasticsearch_test.go @@ -68,7 +68,7 @@ func (s *ESStorageIntegration) getVersion() (uint, error) { return uint(esVersion), nil } -func (s *ESStorageIntegration) initializeES(t *testing.T, allTagsAsFields, archive bool) error { +func (s *ESStorageIntegration) initializeES(allTagsAsFields, archive bool) error { rawClient, err := elastic.NewClient( elastic.SetURL(queryURL), elastic.SetSniff(false)) @@ -96,7 +96,6 @@ func (s *ESStorageIntegration) initializeES(t *testing.T, allTagsAsFields, archi s.esCleanUp(allTagsAsFields, archive) // TODO: remove this flag after ES support returning spanKind when get operations s.notSupportSpanKindWithOperation = true - return nil } @@ -170,7 +169,7 @@ func testElasticsearchStorage(t *testing.T, allTagsAsFields, archive bool) { t.Fatal(err) } s := &ESStorageIntegration{} - require.NoError(t, s.initializeES(t, allTagsAsFields, archive)) + require.NoError(t, s.initializeES(allTagsAsFields, archive)) s.Fixtures = loadAndParseQueryTestCases(t, "fixtures/queries_es.json")