jaegertracing / jaeger-ui

Web UI for Jaeger
http://jaegertracing.io/
Apache License 2.0
1.15k stars 483 forks source link

Better trace page search #213

Open nziebart opened 6 years ago

nziebart commented 6 years ago

Requirement - what kind of business use case are you trying to solve?

We would like the ability to search for spans by tag in the trace view page.

A specific use case here is finding which span is making a certain SQL query. We already know the query, but if there are hundreds of spans in the trace, it's very difficult to locate the corresponding span.

Problem - what in Jaeger blocks you from solving the requirement?

The search bar on the trace view page only searches by service and operation name (https://github.com/jaegertracing/jaeger-ui/blob/master/packages/jaeger-ui/src/selectors/span.js#L65).

Proposal - what do you suggest to solve the problem or improve the existing situation?

It would be relatively simple to also search tags and logs, by adding them to the search string. However I came across two issues when experimenting with this: 1) Some tags/logs are too big and match too many inputs. E.g. a stacktrace 2) The fuzzy search exacerbates (1). Also, some of our tag values are hash strings (e.g. 0ca9bd1a2bfcdd3d7abdff52cb49a072) which the fuzzy search loves to match against.

I'm not sure about the best solution for (1) - maybe have a way to configure tag keys to omit from search? Alternatively, require tag search to be of the form key: value (same as the homepage search feature) rather then just blindly searching all tag values against the input string.

To solve (2) I would propose either (a) removing fuzzy search (IMO it's not that useful, and users who are used to chrome search are used to needing exact matching) or (b) using fuzzy search only on operation/service name and doing exact matching for tags/logs.

Any open questions to address

Questions are noted in proposal.

bboreham commented 6 years ago

Came here looking for a way to find a span by tag value.

tiffon commented 6 years ago

@nziebart Thanks for creating this ticket!

Great suggestions and discussion of issues / solutions.

The fuzzy search exacerbates..

I agree, fuzzy search is a bit dubious... Seems fine to change to something better.

  1. Some tags/logs are too big and match too many inputs.

The pattern used in GMail's email search seems like it would work pretty well. It starts as a simple text input which works most of the time but can be used as a more advanced search when the "▾" is clicked.

One approach would be something like the following:

screen shot 2018-06-17 at 3 57 07 am

Searching via just the top text input (not the "advanced" search form), would match the input string via exact substring matching against the service name, operation, or the key or value from any key:value in Tags, Process or a log message. That will probably work for most scenarios and is pretty simple.

In the form:

Some benefits of the two-mode approach are:

What do you think?

I was originally hoping to keep this much simpler, but conjunctions and differentiating between free-form text matching and key:value pair matching kept getting in my way. I wasn't able to come up with an approach using just a single text input that had an obvious UX / syntax.

nziebart commented 6 years ago

Hey @tiffon , great proposal! Although I was trying to get around the need for a more complex UI, I think it's probably the best general solution here. We've been running with a forked version of the UI that does only exact matching, but skips tags or logs that are stacktraces. This has gotten us pretty far but I could see more advanced use cases where the other options would be useful.

Instead of a big modal view like the one in the screenshot, I might suggest keeping a single search bar but having a dropdown or segmented control to the side where you can pick the "type" of search performed on the input text.

One common use case we have is searching for the existance of a certain tag. In this case it'd be nice if the key:value search mode would do partial matches. e.g. if I am looking for the tag foo.bar=baz, it should be highlighted as soon as I type f.

tiffon commented 6 years ago

@nziebart, thanks for sharing this info.

The screenshot above is intended to be a dropdown, not a modal, albeit a dropdown that's a pretty involved form. The Gmail advanced input form is shown expanded, below.

gmail-00-form-input

Something new I noticed is when the search is executed the parameters are converted to plain text. (And, vice-versa – the plain text is converted to the relevant form values when it's expanded.)

gmail-01-converted-to-string

Console

A few days ago I noticed the Console app that ships with Macs has exactly the type of search you mentioned (if I follow):

Find

Free form text entered and selecting a pattern:

mac-console-find-01-refine mac-console-find-02-insert-pattern mac-console-find-03-with-pattern

Search

Free-form text entry:

mac-console-search-03-exclusion-as-red copy

Pressing ENTER adds a button to indicate the type of predicate:

The type of predicate can be modified:

Multiple:

These are reminiscent of an experiment I did for #20:

jaeger-search-panel-ticket
tiffon commented 6 years ago

@davit-y is working on this. (I'm unable to assign to him.)