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

Badger storage plugin: query service to support spanKind when retrieve operations for a given service. #1922

Open
guo0693 opened this issue Nov 13, 2019 · 4 comments
Labels
good first issue Good for beginners help wanted Features that maintainers are willing to accept but do not have cycles to implement storage/badger Issues related to badger storage

Comments

@guo0693
Copy link
Contributor

guo0693 commented Nov 13, 2019

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

Related to #1920

Update badger reader and writer such that we can retrieve operations by service name and span kind

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

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

Any open questions to address

@guo0693 guo0693 changed the title Badger storage update: query service to support spanKind when retrieve operations for a given service. Badger storage plugin: query service to support spanKind when retrieve operations for a given service. Nov 13, 2019
@burmanm
Copy link
Contributor

burmanm commented Nov 17, 2019

I'll add notes here so that I don't forget (or if someone else is implementing):

  • A single index key is enough for serviceName, operationName + span.Kind indexing

Thus, replace the following code from reader:

		if query.OperationName != "" {
			indexSearchKey = append(indexSearchKey, operationNameIndexKey)
			indexSearchKey = append(indexSearchKey, []byte(query.ServiceName+query.OperationName)...)
		} else {
			indexSearchKey = append(indexSearchKey, serviceNameIndexKey)
			indexSearchKey = append(indexSearchKey, []byte(query.ServiceName)...)
		}

Instead, write a single key with operationIndexKey and in the form of query.ServiceName+query.OperationName+tags.span.kind. Then, in the reader scanning, take into account the length of the searched index key such as query.ServiceName has total length of serviceName+overhead+timestamp+sizeOfTraceID and not more. This can be added to the scanFunction to skip keys which do not match here (or stop searching if we bypassed the match).

In the cache.go, remove two full-table-scans and replace with one which would warm the cache for both services, operations as well any theoretical operations+kind query.

Bonus is one less key written to the db with a slight increase in complexity for reading.

@guo0693
Copy link
Contributor Author

guo0693 commented Dec 2, 2019

Not familiar with badger, but should the key be query.ServiceName+tags.span.kind+query.OperationName because we want to get a list of operation names given the service name & span.kind?

@burmanm
Copy link
Contributor

burmanm commented Dec 2, 2019

It slightly depends. There's two different use-cases for that information, fetching the list of operations vs fetching the list of traces. For traces, is the span.kind used or not? You should optimize for that use-case and then the "list of operations" for UI purposes is done with the cache.go and a table scan of possible pairs of span.kind + operations meaning it doesn't really matter in which order they are.

To clarify, the list of available operations is done once in the startup and never again before a restart. So don't optimize for that, but optimize for the use-case of traces-fetching where the order for smaller TraceID scanning is more important.

@guo0693
Copy link
Contributor Author

guo0693 commented Dec 2, 2019

Make sense. I didn't know it's also used for fetching traces.

@pavolloffay pavolloffay added the storage/badger Issues related to badger storage label Dec 3, 2019
@yurishkuro yurishkuro added help wanted Features that maintainers are willing to accept but do not have cycles to implement good first issue Good for beginners labels Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for beginners help wanted Features that maintainers are willing to accept but do not have cycles to implement storage/badger Issues related to badger storage
Projects
None yet
Development

No branches or pull requests

4 participants