-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[ES] Add Scope
field to DB Span
#7039
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Manik2708 <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7039 +/- ##
==========================================
+ Coverage 96.04% 96.09% +0.04%
==========================================
Files 352 352
Lines 20821 20820 -1
==========================================
+ Hits 19998 20007 +9
+ Misses 620 613 -7
+ Partials 203 200 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Name string `json:"name,omitempty"` | ||
Version string `json:"version,omitempty"` | ||
Tags []KeyValue `json:"tags,omitempty"` | ||
Tag map[string]any `json:"tag,omitempty"` |
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 can't we add another field TagType
to capture the type of value and avoid data loss? We'd want to do that for all 3 flavors of Tag field
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.
Will add it in the DotReplacement
PR as tag map handling is taking place there!
internal/storage/v1/elasticsearch/mappings/fixtures/jaeger-span-6.json
Outdated
Show resolved
Hide resolved
operationNameField = "operationName" | ||
objectTagsField = "tag" | ||
objectProcessTagsField = "process.tag" | ||
objectScopeTagsField = "scope.tag" |
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.
how come this is the only change in the reader? Doesn't it need to alter queries sent to ES to look in the new fields?
And how will it work if the ES template doesn't have those fields (legacy data)? Will the query fail or just not find anything?
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.
how come this is the only change in the reader? Doesn't it need to alter queries sent to ES to look in the new fields?
The changes are automatically captured by the array to reflect in the query! Query looks for all the tags therefore we just need to add it in the nestedTagFieldList
and objectTagFieldList
And how will it work if the ES template doesn't have those fields (legacy data)? Will the query fail or just not find anything?
For nested field query it will fail as we need to inform to ES about nested fields to make nested query success and for object fields, it will return nothing
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.
how come this is the only change in the reader? Doesn't it need to alter queries sent to ES to look in the new fields?
The changes are automatically captured by the array to reflect in the query! Query looks for all the tags therefore we just need to add it in the
nestedTagFieldList
andobjectTagFieldList
And how will it work if the ES template doesn't have those fields (legacy data)? Will the query fail or just not find anything?
For nested field query it will fail as we need to inform to ES about nested fields to make nested query success and for object fields, it will return nothing
My bad! It will fail only the nested query, nothing will happen for object (everything will be fine)!
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.
We can't have queries against old data fail. What's the solution?
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.
I have thought 2 step solution. We should understand that the only thing we need to ensure is: Mappings are up-to-date.
- The users which have enabled
CreateIndexTemplates
: We can introduce a feature gate to automatically update the mappings. - The users which have disabled
CreateIndexTemplates
: We can have an update log to inform them the changes they might have to make in the mappings before updating jaeger.
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.
Can we detect automatically if the mapping is missing something? Don't we allow users to make manual changes to the mappings too? You need to think through possible permutations of starting conditions and have a path for each of them.
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.
I just want to know a thing, when users will take the update, the ES Factory will be re-initialized, right? If yes then I think new templates will automatically be created if user has enabled CreateIndexTemplates
. Please see this code:
jaeger/internal/storage/v1/elasticsearch/factory.go
Lines 248 to 256 in 40e1ff3
if cfg.CreateIndexTemplates && !cfg.UseILM { | |
mappingBuilder := mappingBuilderFromConfig(cfg) | |
spanMapping, serviceMapping, err := mappingBuilder.GetSpanServiceMappings() | |
if err != nil { | |
return nil, err | |
} | |
if err := writer.CreateTemplates(spanMapping, serviceMapping, cfg.Indices.IndexPrefix); err != nil { | |
return nil, err | |
} |
Internally we use *elastic.IndicesPutTemplateService
which replaces the mapping if it already exists. For the users who have turned off CreateIndexTemplates
we can inform them to make the necessary changes before updating jaeger.
Don't we allow users to make manual changes to the mappings too?
Can you please explain, how users can do this? I can understand 2 cases around this:
- Users who have enabled
CreateIndexTemplates
and manually edited the mappings later, the new mappings will be overrided on the old mappings automatically. - Users who have disabled
CreateIndexTemplates
, as said above we need to inform them about the necessay changes!
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.
So you're saying writer.CreateTemplates
will always override the mappings on collector restart? Then yes we'd just need to provide migration instructions for users who have the setting set to manual creation.
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.
Yes, but firstly I am thinking to test inserting some old data and then restarting jaeger and then see whether the queries are running fine or not. Have to make some changes in bash scripts for this locally. Will get back with enough evidences and then I think work on migration guide!
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.
Sounds good. All of that should be documented in the PR description, which we can label as breaking change to call people's attention.
Signed-off-by: Manik2708 <[email protected]>
Signed-off-by: Manik2708 <[email protected]>
@yurishkuro Good news! Now queries are not crashing no matter whether mappings are updated or not. This has become possible by using
|
Indeed good news. However, the scope attributes are not being tested in the e2e tests today, we need to add that to the suite. It may require some refactoring because the existing e2e tests work off the v1 model which cannot adequately represent scope attributes
We need to add the ability to read fixtures in OTLP and use v2 Storage API to write from the test (in the v2 e2e tests these writes are already automatically upgraded to v2 Storage API, but since the input is v1 we still can't test the scope attributes). This could be a separate prequel PR - ideally we would upgrade all fixtures to OTLP first, then it will be easier to extend fixtures to include resource and scope attributes. |
NB: this doesn't need to be a big bang, we can just upgrade the path to write via V2 API first and remove unnecessary translations on the way ... #7050 |
@yurishkuro Then before that I think we need to implement the factory for ES, or should we directly use the v2 writer? I am thinking to first refactor the v1 factory, then implement the v2 factory and then finally upgrade the integration tests! Does this look fine? |
well, refactoring e2e tests is a good chunk of changes by itself. It might be easier to finish v2 memory storage first and use it as a guinea pig, rather than introducing dependency on ES just for the e2e tests upgrade. It's also much easier/faster to run e2e tests for memory storage. |
Have a doubt over this! Currently we have implemented v2 APIs for two backends: |
v2 API is also implemented for GRPC storage. |
we can apply some normalization function in the test before comparing with expected fixture, e.g. to split the whole payload such that each span has its own copy of resource & scope objects (even if they are duplicated). |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. You may re-open it if you need more time. |
@Manik2708 is this still needed? |
@yurishkuro Extremely sorry for not looking into this. But this can be completed once refactoring of e2e tests is done and we could add integration tests related to scope |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. You may re-open it if you need more time. |
Which problem is this PR solving?
Description of the changes
How was this change tested?
Checklist
jaeger
:make lint test
jaeger-ui
:npm run lint
andnpm run test