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

[microsoft_sqlserver,system] Add ECS error.code mapping #6868

Merged
merged 3 commits into from Jul 17, 2023

Conversation

ishleenk17
Copy link
Contributor

  • Bug

What does this PR do?

This PR fixes the type conflicts for error.message and error.code for datastreams in system and mssql package

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

Related issues

@ishleenk17 ishleenk17 requested a review from a team as a code owner July 7, 2023 12:02
@andrewkroh andrewkroh changed the title Add ecs mapping [microsoft_sqlserver,system] Add ECS error.code mapping Jul 7, 2023
@muthu-mps
Copy link
Contributor

@ishleenk17 - What happens to the existing user who faces the field conflicts ?

@ishleenk17
Copy link
Contributor Author

@ishleenk17 - What happens to the existing user who faces the field conflicts ?

They will have to upgrade to this version if they think it's a deal breaker for them.

@muthu-mps
Copy link
Contributor

@ishleenk17 - What happens to the existing user who faces the field conflicts ?

They will have to upgrade to this version if they think it's a deal breaker for them.

Does it requires removing the conflicting field and re-indexing the existing data ? Are we considering this as a breaking change ? Otherwise the changes looks good !

@ishleenk17
Copy link
Contributor Author

@ishleenk17 - What happens to the existing user who faces the field conflicts ?

They will have to upgrade to this version if they think it's a deal breaker for them.

Does it requires removing the conflicting field and re-indexing the existing data ? Are we considering this as a breaking change ? Otherwise the changes looks good !

Yes, I think this would be categorized as a breaking change since it's going to be a mapping change.
@andrewkroh: How do we handle such a scenario?
do we document them?

@andrewkroh
Copy link
Member

I would categorize this as a bug. ECS was not adhered here and the default ES dynamic mappings prevailed.

When the new package version is installed Fleet will _rollover the backing data stream index so that the new mappings are applied. From a data indexing point of view there should be no issues.

@ishleenk17
Copy link
Contributor Author

I would categorize this as a bug. ECS was not adhered here and the default ES dynamic mappings prevailed.

When the new package version is installed Fleet will _rollover the backing data stream index so that the new mappings are applied. From a data indexing point of view there should be no issues.

Thanks for the clarity @andrewkroh

@muthu-mps
Copy link
Contributor

muthu-mps commented Jul 12, 2023

@andrewkroh - I am trying to understand what happens when we try to search or perform aggregations against the data after the new change.

Will the type conflict still exists ?

Observations :

  • Applied an aggregation query against the datastream which has a type of long in older indices and with type of keyword in newer indices after _rollover.
  • Getting two different type for same field error.
Screenshot 2023-07-12 at 10 09 05 AM

Correct me if I am wrong,

  • This happens because we are searching for the data from older indices which has a different field type.
  • This can be avoided either by searching for the data from the newer index only or by re-indexing the older index with newer mapping.

@andrewkroh
Copy link
Member

That is correct. Any functions that require knowing the type can have issues. Queries without aggs (like Discover) should work. The options for resolution are reindexing, deleting, closing, or adding a runtime field in the old indices to shadow the field with the correct type.

@ishleenk17
Copy link
Contributor Author

If we go by this document, I think we should consider this as a bug fix and not a breaking change.
There are lesser chances that the error.code field will be used in aggregation queries.

@elasticmachine
Copy link

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-07-17T04:44:54.518+0000

  • Duration: 18 min 39 sec

Test stats 🧪

Test Results
Failed 0
Passed 165
Skipped 0
Total 165

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@elasticmachine
Copy link

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (5/5) 💚
Files 100.0% (6/6) 💚 2.778
Classes 100.0% (6/6) 💚 2.778
Methods 70.27% (78/111) 👎 -21.883
Lines 100.0% (4062/4062) 💚 8.852
Conditionals 100.0% (0/0) 💚

@ishleenk17 ishleenk17 merged commit 7e0edb3 into elastic:main Jul 17, 2023
4 checks passed
@elasticmachine
Copy link

Package microsoft_sqlserver - 2.1.1 containing this change is available at https://epr.elastic.co/search?package=microsoft_sqlserver

@elasticmachine
Copy link

Package system - 1.36.2 containing this change is available at https://epr.elastic.co/search?package=system

gizas pushed a commit that referenced this pull request Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[System] Type Conflict Error for error.code and error.message fields
4 participants