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(server): add endpoint to search spans in a trace #3611

Merged
merged 2 commits into from Feb 8, 2024

Conversation

schoren
Copy link
Collaborator

@schoren schoren commented Feb 8, 2024

This PR adds an endpoint that allows searching spans within a trace.

The query is transmitted via post body to avoid possible issues with URL length if the query is a bit large.

The plain text implementation is a bit naive, it just does a string.contains over a json encoded version of each span, both the query and the json lowercased for improved matching.
While this is a pretty terrible implementation, it's easy and it works. In the future if needed we could implement a more complex solution, like Bleve, ElasticSearch, etc, but at this time this seems like a good enough approach.

Examples:

Search by query language

POST http://localhost:11633/api/tests/{{testID}}/run/{{runID}}/search-spans

{"query": "span[tracetest.span.name = \"Delete Report from cache\"]"}

Search by text

POST http://localhost:11633/api/tests/{{testID}}/run/{{runID}}/search-spans

{"query": "Delete Report from cache"}

Loom video

https://www.loom.com/share/e2912a4fde554a85a8dfb043fca983fc

Copy link

vercel bot commented Feb 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
tracetest ✅ Ready (Inspect) Visit Preview Feb 8, 2024 4:41pm

@schoren schoren linked an issue Feb 8, 2024 that may be closed by this pull request
Copy link
Collaborator

@xoscar xoscar left a comment

Choose a reason for hiding this comment

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

I understand the idea of having this done in a simpler way for the moment, great job on the quick turn around @schoren!

@schoren schoren merged commit 3bfdbab into main Feb 8, 2024
39 checks passed
@schoren schoren deleted the backend-span-search branch February 8, 2024 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Big Trace] Move search in Trace to Backend
2 participants