From f94c2209b12df0abd3c4c27284fd647d1faa5501 Mon Sep 17 00:00:00 2001 From: Annanay Date: Thu, 30 Jan 2020 14:41:54 +0530 Subject: [PATCH] [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, 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, 0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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, 0x3a, 0xfd, 0xc4, 0xa7, 0x43, 0xb5, 0x54, - 0xe7, 0x0c, 0xdb, 0xbf, 0xe4, 0xa1, 0x22, 0x08, 0xa7, 0x28, 0x84, 0x86, 0x50, 0x4c, 0xfe, 0x23, - 0x50, 0x23, 0x83, 0x97, 0x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 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, 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, 0x49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x33, 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.