-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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: Add Span Kind support for ES/OS #6399
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Manik2708 <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6399 +/- ##
==========================================
- Coverage 96.23% 96.20% -0.04%
==========================================
Files 368 368
Lines 21028 21112 +84
==========================================
+ Hits 20237 20311 +74
- Misses 606 612 +6
- Partials 185 189 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall lgtm, but I have question on whether the whole thing could be even simpler, by treating Kind as always present (but maybe blank).
// ServiceWithKind is the JSON struct service:kind:operation documents in ElasticSearch | ||
type ServiceWithKind struct { | ||
Service | ||
Kind string `json:"spanKind"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure I follow. Why wouldn't we just add Kind field to the Service struct above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the comment. As then in query for fetching spans of all kinds, we have apply another filter with kind as empty.
@@ -124,8 +124,9 @@ func getSpanAndServiceIndexFn(p SpanWriterParams) spanAndServiceIndexFn { | |||
func (s *SpanWriter) WriteSpan(_ context.Context, span *model.Span) error { | |||
spanIndexName, serviceIndexName := s.spanServiceIndex(span.StartTime) | |||
jsonSpan := s.spanConverter.FromDomainEmbedProcess(span) | |||
kind, _ := span.GetSpanKind() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not add Kind field to the dbmodel.Span and not pass it around separately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be present as a tag in json model also! I tried fetching kind from original span but failed because of the bool AllTagsAsFields
. As it will already be present in the json model, should we resave it as a seperate kind also?
if !keyInCache(cacheKey, s.serviceCache) { | ||
s.client().Index().Index(indexName).Type(serviceType).Id(cacheKey).BodyJson(service).Add() | ||
writeCache(cacheKey, s.serviceCache) | ||
if kind != model.SpanKindUnspecified { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to bifurcate? If for some reason span kind is unavailable, we can just treat it as blank string and not change the code to deal with it separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please the comment #6399 (comment). If the reason seems valid then I don't think we should introduce empty kinds because that will become messy along with data of Without Kind
(old data) and then in reader it might become more complex while fetching.
Then we can't get old data! In old data |
} | ||
|
||
func bucketOfOperationsToOperationsArray(searchResult *elastic.AggregationBucketFilters) ([]spanstore.Operation, error) { | ||
var result []spanstore.Operation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This is concerning because we are unaware of the total length of result so not sure whether we should initialize this way or not. The best possible solution which could think of is as number of kinds are limited we can iterate through each kind fetch the total doc count of each kind, then finally create the array of total length. Will it be fine?
Signed-off-by: Manik2708 <[email protected]>
Signed-off-by: Manik2708 <[email protected]>
Signed-off-by: Manik2708 <[email protected]>
@yurishkuro Comitted as per your suggestions. I tried many ways but I couldn't merge those with |
please update the branch, I am not sure if CI is failing because of that or because of your changes. If it's the latter, how are you testing this change? Did you run e2e tests locally? |
This reverts commit 8c608cd. Signed-off-by: Manik2708 <[email protected]>
I tried approaching with empty kind but failed as query in |
@yurishkuro Saving empty strings in ES is not optimal. Please see: elastic/elasticsearch#7515. I have been trying various ways of employing empty or null kinds but not getting results. The probable reason is because query is a bit complex and unconventional. I think it will be better to not to keep empty and null kinds rather handelling them seperately! |
I don't have a strong opinion, but the issue you linked talks about searching for empty strings, which I don't think is the case for our scenario, we just need to write it. |
But while reading we have to search for those operations also which have empty kinds or no kind! I am facing problems when fetching spans of all kinds, the search query behaves weirdly if I introduce filter of |
Searching for "all kinds" to me means not specifying any filter for the "kind" field. How would it even work if you say |
I think there is some sort of misunderstanding of my approach. Let me first explain problems:
|
"Not available in our abstraction" is an odd argument since we own the abstraction and can change it at will. Re fetchsource, what is the source here - is it the whole span? Or do we write separate entries just for service/operation? |
Service, Operation and Kind (if present) but have to investigate the indices whether it is extracting any other information. |
Which problem is this PR solving?
Fixes: #1923
Description of the changes
GetOperations
, operations can now be fetched with kind also. When kind kept empty, spans of all kinds are returnedHow was this change tested?
Checklist
jaeger
:make lint test
jaeger-ui
:npm run lint
andnpm run test