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

Populate agent.id field in .fleet-agents index #609

Merged
merged 4 commits into from
Aug 3, 2021

Conversation

aleksmaus
Copy link
Member

What does this PR do?

Populate agent.id field in .fleet-agents index as requested here:
#595

@scunningham The current agent schema/mapping has "version" field along with "id", if we populate only the "agent.id" it will save the version as "" empty string, so I updated the code to capture the "agent.version" too. Also assumed that the version could be updated for the same "agent.id".
Could you check if my assumptions are correct there? Thanks!

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas

Related issues

Screenshots

Screen Shot 2021-08-02 at 8 50 46 AM

@aleksmaus aleksmaus added the enhancement New feature or request label Aug 2, 2021
@elasticmachine
Copy link
Contributor

elasticmachine commented Aug 2, 2021

💚 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: 2021-08-03T02:32:01.735+0000

  • Duration: 5 min 36 sec

  • Commit: 789e691

Test stats 🧪

Test Results
Failed 0
Passed 206
Skipped 0
Total 206

Trends 🧪

Image of Build Times

Image of Tests

Copy link

@scunningham scunningham left a comment

Choose a reason for hiding this comment

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

Looks good.

@aleksmaus aleksmaus marked this pull request as ready for review August 2, 2021 14:10
@aleksmaus aleksmaus added Team:Elastic-Agent Label for the Agent team Team:Fleet Label for the Fleet team v7.15.0 v7.16.0 labels Aug 2, 2021
Copy link
Member

@pzl pzl left a comment

Choose a reason for hiding this comment

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

looks good, thank you

@mergify
Copy link
Contributor

mergify bot commented Aug 2, 2021

This pull request is now in conflicts. Could you fix it @aleksmaus? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b feature/populate_agent.id upstream/feature/populate_agent.id
git merge upstream/master
git push upstream feature/populate_agent.id

@aleksmaus
Copy link
Member Author

@blakerouse I picked up your changes from master branch and it looks like the white space trimming was removed around the version string there. I've put it back. Could you review this please? Thanks!

Copy link
Contributor

@blakerouse blakerouse left a comment

Choose a reason for hiding this comment

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

Thanks for adding it back.

Overall this change looks good.

@aleksmaus aleksmaus merged commit cb77724 into elastic:master Aug 3, 2021
mergify bot pushed a commit that referenced this pull request Aug 3, 2021
* Populate agent.id field in .fleet-agents index

* Address feedback on the draft

* Put back the version spaces trimming that was lost in the master changes

(cherry picked from commit cb77724)
mergify bot added a commit that referenced this pull request Aug 3, 2021
* Populate agent.id field in .fleet-agents index

* Address feedback on the draft

* Put back the version spaces trimming that was lost in the master changes

(cherry picked from commit cb77724)

Co-authored-by: Aleksandr Maus <[email protected]>
@dikshachauhan-qasource
Copy link

Hi @aleksmaus

We have validated this merged PR in 7.15.1 BC1 build and could not find agent id under .fleet-agents index.

Screenshot:
image

Build details:
BUILD 44185
COMMIT c1aa1ef8dc38b511ce4a647fe92ca0348aadd834

Could you please let us know if we are missing anything.

NOTE: Due to incomplete build deployments on 7.16 snapshot from cloud, we were unable to verify relative merges there. We will revalidate same on 7.16 too when builds deployments will be working fine.

Thanks
QAS

@blakerouse
Copy link
Contributor

@dikshachauhan-qasource Your looking at the mapping not the documents in the index.

Use the following to get all the documents in the index.

GET .fleet-agents/_search
{
    "query" : {
        "match_all" : {}
    }
}

@dikshachauhan-qasource
Copy link

Hi @blakerouse

Thanks for the feedback.

We re-attempted it with the updated query index and found ID and version entries in results.

However, could you please let us know from where does this ID value is fetched for any respective agent, as we looked on agent details tab and discover tab too but value fetch in results dont match with them.

Screenshots:

  • Dev Tools:
    image

  • Discover tab:
    image

  • agent details tab:
    image

After your feedback, we will update validation in testcase.

Thanks
QAS

@blakerouse
Copy link
Contributor

@dikshachauhan-qasource The document you have selected is set to active: false which means it used to be an Elastic Agent on that host with that ID in the past, but it has since been enrolled. We currently keep all records or all Elastic Agents they are just marked with active: false.

You should find the document that has that hostname that is set to active: true and then the ID's should align.

@dikshachauhan-qasource
Copy link

@blakerouse Thanks for the feedback..I'll check this out.

@dikshachauhan-qasource
Copy link

Hi @blakerouse

We have reattempted today and found agent IDs matched under Active value when set to "True".

We have created 01 testcase for same.
Link: https://elastic.testrail.io/index.php?/cases/view/150241

Thanks
QAS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Team:Elastic-Agent Label for the Agent team Team:Fleet Label for the Fleet team v7.15.0 v7.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Populate agent.id field in .fleet-agents index
6 participants