Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move detected field logic to query frontend #14212

Merged
merged 7 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 1 addition & 27 deletions pkg/querier/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,7 @@ func containsAllIDTypes(values []string) bool {
return true
}

// TODO(twhitney): Delete this method and the GRPC service signature. This is now handled in the query frontend.
shantanualsi marked this conversation as resolved.
Show resolved Hide resolved
func (q *SingleTenantQuerier) DetectedFields(ctx context.Context, req *logproto.DetectedFieldsRequest) (*logproto.DetectedFieldsResponse, error) {
expr, err := syntax.ParseLogSelector(req.Query, true)
if err != nil {
Expand Down Expand Up @@ -1134,33 +1135,6 @@ func (q *SingleTenantQuerier) DetectedFields(ctx context.Context, req *logproto.
}, nil
}

func getParsersFromExpr(expr syntax.LogSelectorExpr) []string {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this wasn't used by anything

parsers := make([]string, 0)
expr.Walk(func(e syntax.Expr) {
switch concrete := e.(type) {
case *syntax.LogfmtParserExpr, *syntax.LogfmtExpressionParser:
if !slices.Contains(parsers, "logfmt") {
parsers = append(parsers, "logfmt")
}
case *syntax.JSONExpressionParser:
if !slices.Contains(parsers, "json") {
parsers = append(parsers, "json")
}
case *syntax.LabelParserExpr:
if concrete.Op == syntax.OpParserTypeJSON {
if !slices.Contains(parsers, "json") {
parsers = append(parsers, "json")
}
}
}
// bail if we found both parsers
if len(parsers) == 2 {
return
}
})
return parsers
}

type parsedFields struct {
sketch *hyperloglog.Sketch
fieldType logproto.DetectedFieldType
Expand Down
Loading
Loading