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

[Fleet] Replace Console API with internal API #186899

Merged

Conversation

jillguyonnet
Copy link
Contributor

@jillguyonnet jillguyonnet commented Jun 25, 2024

Summary

Closes #160194

Parts of the Fleet debugger currently use the Console API to query Fleet indices and Ingest Saved Objects. This PR replaces those uses with internal API endpoints that use Elasticsearch and Saved Objects clients.

Affected parts:

  • Fleet Index Debugger:
    • This component directly queries some Fleet indices.
    • The new service uses an Elasticsearch client.
    • There should be no difference with respect to the previous behaviour.
  • Saved Object Debugger:
    • This component directly queries the .kibana-ingest index to retrieve saved objects of a given type.
    • Based on the type, the existing saved object names are retrieved: this is now done using a Saved Objects client and should work the same.
    • When a name is selected, the actual saved object is fetched: this is now done using a Saved Objects client and there are small differences in the result (no information is lost).

The following example shows the difference between the saved object response before and after this change:

Before
{
  "total": {
    "value": 1,
    "relation": "eq"
  },
  "max_score": 0.9808291,
  "hits": [
    {
      "_index": ".kibana_ingest_8.15.0_001",
      "_id": "ingest-agent-policies:174cc817-06d7-4e2c-88b3-44d7cb5322b6",
      "_score": 0.9808291,
      "_source": {
        "ingest-agent-policies": {
          "name": "Agent policy 1",
          "description": "",
          "namespace": "default",
          "monitoring_enabled": [
            "logs",
            "metrics"
          ],
          "inactivity_timeout": 1209600,
          "is_protected": false,
          "status": "active",
          "is_managed": false,
          "revision": 1,
          "updated_at": "2024-06-24T08:15:37.813Z",
          "updated_by": "elastic",
          "schema_version": "1.1.1"
        },
        "type": "ingest-agent-policies",
        "references": [],
        "managed": false,
        "coreMigrationVersion": "8.8.0",
        "typeMigrationVersion": "10.3.0",
        "updated_at": "2024-06-24T08:15:37.813Z",
        "created_at": "2024-06-24T08:15:37.813Z"
      }
    }
  ]
}
After
[
  {
    "type": "ingest-agent-policies",
    "id": "174cc817-06d7-4e2c-88b3-44d7cb5322b6",
    "attributes": {
      "name": "Agent policy 1",
      "description": "",
      "namespace": "default",
      "monitoring_enabled": [
        "logs",
        "metrics"
      ],
      "inactivity_timeout": 1209600,
      "is_protected": false,
      "status": "active",
      "is_managed": false,
      "revision": 1,
      "updated_at": "2024-06-24T08:15:37.813Z",
      "updated_by": "elastic",
      "schema_version": "1.1.1"
    },
    "references": [],
    "managed": false,
    "updated_at": "2024-06-24T08:15:37.813Z",
    "created_at": "2024-06-24T08:15:37.813Z",
    "version": "WzQ2OCwxXQ==",
    "coreMigrationVersion": "8.8.0",
    "typeMigrationVersion": "10.3.0",
    "score": 0.9808291
  }
]

Testing

Go to app/fleet/_debug and check the various parts described above.

Screenshots

Screenshot 2024-06-26 at 15 28 07 Screenshot 2024-06-26 at 15 27 52

Checklist

@jillguyonnet jillguyonnet self-assigned this Jun 25, 2024
@jillguyonnet jillguyonnet added the Team:Fleet Team label for Observability Data Collection Fleet team label Jun 25, 2024
@obltmachine
Copy link

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@jillguyonnet jillguyonnet added the release_note:skip Skip the PR/issue when compiling release notes label Jun 25, 2024
@jillguyonnet jillguyonnet force-pushed the fleet/160194-remove-use-of-console-api branch from 65192a4 to c30c5a0 Compare June 26, 2024 13:13
@jillguyonnet
Copy link
Contributor Author

/ci

@jillguyonnet jillguyonnet marked this pull request as ready for review June 26, 2024 15:01
@jillguyonnet jillguyonnet requested a review from a team as a code owner June 26, 2024 15:01
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@jillguyonnet jillguyonnet force-pushed the fleet/160194-remove-use-of-console-api branch from c30c5a0 to 7ca9544 Compare June 27, 2024 07:24
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

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.4MB 1.4MB -232.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
fleet 166.5KB 166.8KB +371.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @jillguyonnet

Copy link
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@criamico criamico left a comment

Choose a reason for hiding this comment

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

LGTM

@jillguyonnet jillguyonnet merged commit 028994c into elastic:main Jun 27, 2024
20 checks passed
@jillguyonnet jillguyonnet deleted the fleet/160194-remove-use-of-console-api branch June 27, 2024 13:13
@kibanamachine kibanamachine added v8.15.0 backport:skip This commit does not require backporting labels Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit 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 v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fleet plugin should not use /console/proxy API
7 participants