Skip to content

[Fleet] save and read custom asset errors#218816

Merged
juliaElastic merged 10 commits intoelastic:mainfrom
juliaElastic:custom-asset-error
Apr 24, 2025
Merged

[Fleet] save and read custom asset errors#218816
juliaElastic merged 10 commits intoelastic:mainfrom
juliaElastic:custom-asset-error

Conversation

@juliaElastic
Copy link
Contributor

@juliaElastic juliaElastic commented Apr 22, 2025

Summary

Closes #217154

Improvements to sync integrations status API and error reporting

  • Saving custom asset update errors to the package SO in latest_custom_asset_install_failed_attempts field

  • Reading these errors in the status API and UI

  • Fix sync status calculation: show FAILED if one of integrations or custom assets are in failed state, SYNCHRONIZING if one of integrations or custom assets are in synchronizing state, otherwise show COMPLETED state.

image
  • Reading the followStats API to report on fatal errors, found that the followInfo API doesn't report if the connection to the remote cluster fails. Reproduced this by updating an active Remote Cluster with an invalid port. The followInfo API still reports active status.
image
GET fleet-synced-integrations-ccr-main/_ccr/stats

{
  "indices": [
    {
      "index": "fleet-synced-integrations-ccr-main",
      "shards": [
        {
          "remote_cluster": "main",
          "leader_index": "fleet-synced-integrations",
          "follower_index": "fleet-synced-integrations-ccr-main",
          ...
          "fatal_exception": {
            "type": "exception",
            "reason": "java.lang.IllegalArgumentException: port out of range:93001",
            "caused_by": {
              "type": "illegal_argument_exception",
              "reason": "port out of range:93001"
            }
          }
        }
      ]
    }
  ]
}

Checklist

@juliaElastic juliaElastic added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Apr 22, 2025
@juliaElastic juliaElastic self-assigned this Apr 22, 2025
} catch (error) {
if (error.isBoom && error.output.statusCode === 404) {
throw new FleetNotFoundError(`No output found with id ${outputId}`);
} else if (error.type === 'system' && error.code === 'ECONNREFUSED') {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

error scenario when the remote kibana is down

kibanamachine and others added 4 commits April 22, 2025 13:21
…t --include-path /api/status --include-path /api/alerting/rule/ --include-path /api/alerting/rules --include-path /api/actions --include-path /api/security/role --include-path /api/spaces --include-path /api/streams --include-path /api/fleet --include-path /api/dashboards --include-path /api/saved_objects/_import --include-path /api/saved_objects/_export --include-path /api/alerting/maintenance_window --update'
@juliaElastic juliaElastic marked this pull request as ready for review April 23, 2025 12:00
@juliaElastic juliaElastic requested a review from a team as a code owner April 23, 2025 12:00
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Apr 23, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

}),
})
),
service_token: schema.maybe(
Copy link
Member

Choose a reason for hiding this comment

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

was this not needed before?

Copy link
Contributor Author

@juliaElastic juliaElastic Apr 23, 2025

Choose a reason for hiding this comment

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

I had an error locally, it's probably a bug that we introduced with the ssl changes here.
I'm going to change it to allow unknowns, to allow any other secrets.

<EuiBadge color="hollow">
<FormattedMessage
id="xpack.fleet.integrationSyncStatus.deletedText"
defaultMessage="Deleted"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Showing deleted assets with a badge
image

Copy link
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

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

code LGTM 🚀

juliaElastic and others added 3 commits April 23, 2025 14:56
…t --include-path /api/status --include-path /api/alerting/rule/ --include-path /api/alerting/rules --include-path /api/actions --include-path /api/security/role --include-path /api/spaces --include-path /api/streams --include-path /api/fleet --include-path /api/dashboards --include-path /api/saved_objects/_import --include-path /api/saved_objects/_export --include-path /api/alerting/maintenance_window --update'
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
fleet 1406 1407 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
fleet 1.7MB 1.7MB +564.0B

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
fleet 90 91 +1
Unknown metric groups

API count

id before after diff
fleet 1535 1536 +1

History

cc @juliaElastic

@juliaElastic juliaElastic merged commit 0ed82c4 into elastic:main Apr 24, 2025
9 checks passed
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request May 29, 2025
## Summary

Closes elastic#217154

Improvements to sync integrations status API and error reporting

- Saving custom asset update errors to the package SO in
`latest_custom_asset_install_failed_attempts` field
- Reading these errors in the status API and UI 

- Fix sync status calculation: show `FAILED` if one of integrations or
custom assets are in failed state, `SYNCHRONIZING` if one of
integrations or custom assets are in synchronizing state, otherwise show
`COMPLETED` state.

<img width="608" alt="image"
src="https://github.com/user-attachments/assets/15a17690-443b-4ca1-b705-cc92ec7d3b20"
/>

- Reading the `followStats` API to report on fatal errors, found that
the `followInfo` API doesn't report if the connection to the remote
cluster fails. Reproduced this by updating an active Remote Cluster with
an invalid port. The `followInfo` API still reports `active` status.

<img width="612" alt="image"
src="https://github.com/user-attachments/assets/e95ebc62-4ed9-42c2-9954-93d9438b6ece"
/>


```
GET fleet-synced-integrations-ccr-main/_ccr/stats

{
  "indices": [
    {
      "index": "fleet-synced-integrations-ccr-main",
      "shards": [
        {
          "remote_cluster": "main",
          "leader_index": "fleet-synced-integrations",
          "follower_index": "fleet-synced-integrations-ccr-main",
          ...
          "fatal_exception": {
            "type": "exception",
            "reason": "java.lang.IllegalArgumentException: port out of range:93001",
            "caused_by": {
              "type": "illegal_argument_exception",
              "reason": "port out of range:93001"
            }
          }
        }
      ]
    }
  ]
}
```

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v9.1.0

4 participants