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

Makes spaces optional in observability plugin #151147

Merged
merged 14 commits into from
Mar 1, 2023

Conversation

jasonrhodes
Copy link
Member

@jasonrhodes jasonrhodes commented Feb 14, 2023

Summary

This PR makes spaces optional in the "observability" plugin as requested in #149687

To test this, use the following setting in your kibana.yml config file:

xpack.spaces.enabled: false

When you log in, there will be no spaces choice.

Screenshot 2023-02-21 at 11 53 18 AM

jennypavlova added a commit that referenced this pull request Feb 15, 2023
Closes #149973 

# Summary

This PR makes `spaces` an optional plugin. In Logs UI we use only the
space id and there we want to fallback to the default space id when the
space plugin is disabled. The difference to the changes in the other PRs
is that we will consider the default space as "active" space if the
space plugin is disabled: so in this case we will return the default
space id as this is the only property we need from the `getActiveSpace`
response.

# Testing
1. In the `kibana.dev.yaml` add `xpack.spaces.enabled: false`
2. Before we have this
[PR](#151147) merged you should do
[this
change](https://github.com/elastic/kibana/pull/151147/files#diff-1b17eae66f358505fae8d86df37e155a25e8db996fce93ee6016582fb341092e)
on the branch while testing
3. Inside Logs the `Anomalies` and `Categories` pages should load the
default space

---------

Co-authored-by: kibanamachine <[email protected]>
@jasonrhodes
Copy link
Member Author

So testing this has proven to be complicated. When I open the Kibana UI with this PR change, I don't see observability in the navigation at all.

Screenshot 2023-02-13 at 11 47 06 AM

At first, I thought this might be because we depend on a plugin which still depends on "spaces", but the Kibana log output doesn't indicate that. As seen here, "observability" is included in the array of 124 plugins that started.

[2023-02-15T14:49:42.005-05:00][INFO ][node] Kibana process configured with roles: [background_tasks, ui]
 np bld    log   [14:49:49.690] [info][@kbn/optimizer] [22/152] initial bundle builds complete
[2023-02-15T14:49:53.861-05:00][INFO ][plugins-service] Plugin "apm" has been disabled since the following direct or transitive dependencies are missing, disabled, or have incompatible types: [infra]
[2023-02-15T14:49:53.863-05:00][INFO ][plugins-service] Plugin "cloudDefend" has been disabled since the following direct or transitive dependencies are missing, disabled, or have incompatible types: [fleet]
[2023-02-15T14:49:53.863-05:00][INFO ][plugins-service] Plugin "cloudChat" is disabled.
[2023-02-15T14:49:53.863-05:00][INFO ][plugins-service] Plugin "cloudExperiments" is disabled.
[2023-02-15T14:49:53.863-05:00][INFO ][plugins-service] Plugin "cloudFullStory" is disabled.
[2023-02-15T14:49:53.863-05:00][INFO ][plugins-service] Plugin "cloudGainsight" is disabled.
[2023-02-15T14:49:53.864-05:00][INFO ][plugins-service] Plugin "cloudSecurityPosture" has been disabled since the following direct or transitive dependencies are missing, disabled, or have incompatible types: [fleet]
[2023-02-15T14:49:53.866-05:00][INFO ][plugins-service] Plugin "enterpriseSearch" has been disabled since the following direct or transitive dependencies are missing, disabled, or have incompatible types: [spaces, infra]
[2023-02-15T14:49:53.866-05:00][INFO ][plugins-service] Plugin "fleet" has been disabled since the following direct or transitive dependencies are missing, disabled, or have incompatible types: [spaces]
[2023-02-15T14:49:53.868-05:00][INFO ][plugins-service] Plugin "infra" has been disabled since the following direct or transitive dependencies are missing, disabled, or have incompatible types: [spaces]
[2023-02-15T14:49:53.876-05:00][INFO ][plugins-service] Plugin "profiling" is disabled.
[2023-02-15T14:49:53.880-05:00][INFO ][plugins-service] Plugin "securitySolution" has been disabled since the following direct or transitive dependencies are missing, disabled, or have incompatible types: [cloudSecurityPosture]
[2023-02-15T14:49:53.881-05:00][INFO ][plugins-service] Plugin "spaces" is disabled.
[2023-02-15T14:49:53.882-05:00][INFO ][plugins-service] Plugin "synthetics" has been disabled since the following direct or transitive dependencies are missing, disabled, or have incompatible types: [spaces]
[2023-02-15T14:49:53.885-05:00][INFO ][plugins-service] Plugin "ux" has been disabled since the following direct or transitive dependencies are missing, disabled, or have incompatible types: [infra, apm]
[2023-02-15T14:49:53.925-05:00][INFO ][http.server.Preboot] http server running at http://localhost:5601/local
[2023-02-15T14:49:53.997-05:00][INFO ][plugins-system.preboot] Setting up [1] plugins: [interactiveSetup]
[2023-02-15T14:49:54.014-05:00][WARN ][config.deprecation] The default mechanism for Reporting privileges will work differently in future versions, which will affect the behavior of this cluster. Set "xpack.reporting.roles.enabled" to "false" to adopt the future behavior before upgrading.
[2023-02-15T14:49:54.138-05:00][INFO ][plugins-system.standard] Setting up [124] plugins: [translations,monitoringCollection,licensing,globalSearch,globalSearchProviders,features,mapsEms,licenseApiGuard,customBranding,eventLog,usageCollection,taskManager,cloud,guidedOnboarding,telemetryCollectionManager,telemetryCollectionXpack,kibanaUsageCollection,share,screenshotMode,banners,newsfeed,ftrApis,fieldFormats,expressions,screenshotting,dataViews,charts,esUiShared,customIntegrations,home,searchprofiler,painlessLab,grokdebugger,management,security,snapshotRestore,lists,indexManagement,remoteClusters,crossClusterReplication,indexLifecycleManagement,encryptedSavedObjects,actions,notifications,telemetry,licenseManagement,files,cloudDataMigration,advancedSettings,console,contentManagement,bfetch,data,watcher,upgradeAssistant,fileUpload,ingestPipelines,ecsDataQualityDashboard,alerting,unifiedSearch,unifiedFieldList,savedSearch,savedObjects,graph,savedObjectsTagging,savedObjectsManagement,eventAnnotation,embeddable,reporting,uiActionsEnhanced,presentationUtil,expressionShape,expressionRevealImage,expressionRepeatImage,expressionMetric,expressionImage,controls,dataViewFieldEditor,triggersActionsUi,transform,stackConnectors,stackAlerts,ruleRegistry,visualizations,canvas,visTypeXy,visTypeVislib,visTypeVega,visTypeTimeseries,rollup,visTypeTimelion,visTypeTagcloud,visTypeTable,visTypeMetric,visTypeHeatmap,visTypeMarkdown,dashboard,dashboardEnhanced,expressionXY,expressionTagcloud,expressionPartitionVis,visTypePie,expressionMetricVis,expressionLegacyMetricVis,expressionHeatmap,expressionGauge,lens,maps,cases,timelines,sessionView,kubernetesSecurity,threatIntelligence,aiops,discover,osquery,observability,monitoring,logstash,discoverEnhanced,dataVisualizer,ml,visTypeGauge,dataViewManagement]

Interestingly, the "Dashboards" app appears in the left-hand nav, but doesn't load.
Screenshot 2023-02-15 at 2 51 00 PM

To debug, I placed debug log messages throughout the setup() method in the public/plugin.ts file in the observability plugin. When I undo the space configuration change (comment out this line # xpack.spaces.enabled: false), Dashboards looks happier in the UI.

Screenshot 2023-02-15 at 3 13 44 PM

And the Observability section returns to the navigation. The main difference appears to be something to do with observables being used to register navigation elements. I am logging out deepLinks and otherLinks from within the map in this section: https://github.com/jasonrhodes/kibana/blob/obs-optional-spaces/x-pack/plugins/observability/public/plugin.ts#L267-L310

When spaces isn't disabled (behavior from before this PR), I get the following logs:

temporaryDebugLog.ts:11 [JR TEMP DEBUG] [3:23:53 PM] deepLinks [{"id":"alerts","title":"Alerts","order":8001,"path":"/alerts","navLinkStatus":1,"deepLinks":[{"id":"rules","title":"Rules","path":"/alerts/rules","navLinkStatus":3}]},{"title":"Cases","order":8003,"navLinkStatus":1,"id":"cases","path":"/cases","deepLinks":[{"title":"Create New Case","navLinkStatus":3,"searchable":false,"id":"cases_create","path":"/cases/create"},{"title":"Configure Cases","navLinkStatus":3,"searchable":false,"id":"cases_configure","path":"/cases/configure"}]}]
temporaryDebugLog.ts:11 [JR TEMP DEBUG] [3:23:53 PM] otherLinks [{"app":"observability-overview","label":"Alerts","path":"/alerts"},{"app":"observability-overview","label":"Cases","path":"/cases"}]

When spaces is disabled via config, deepLinks is almost exactly the same, but otherLinks is an empty array.

temporaryDebugLog.ts:11 [JR TEMP DEBUG] [3:25:53 PM] deepLinks [{"id":"alerts","title":"Alerts","order":8001,"path":"/alerts","navLinkStatus":3,"deepLinks":[{"id":"rules","title":"Rules","path":"/alerts/rules","navLinkStatus":3}]},{"title":"Cases","order":8003,"navLinkStatus":3,"id":"cases","path":"/cases","deepLinks":[{"title":"Create New Case","navLinkStatus":3,"searchable":false,"id":"cases_create","path":"/cases/create"},{"title":"Configure Cases","navLinkStatus":3,"searchable":false,"id":"cases_configure","path":"/cases/configure"}]}]
temporaryDebugLog.ts:11 [JR TEMP DEBUG] [3:25:53 PM] otherLinks []

I need to continue this investigation later about what causes otherLinks to disappear in this scenario.

@jasonrhodes
Copy link
Member Author

jasonrhodes commented Feb 21, 2023

Update: The observability plugin does a check to see if at least one of the main observability sections is available and if none of them are, the top-level Observability pages (overview, alerts, cases, etc) are not shown in the navigation at all.

However, since I created this PR, it appears as though other observability apps have already merged their spaces-optional changes, so after having merged those changes in, it should be possible to test these changes in this PR now.

@jasonrhodes jasonrhodes marked this pull request as ready for review February 21, 2023 16:37
@jasonrhodes jasonrhodes requested a review from a team as a code owner February 21, 2023 16:37
@jasonrhodes jasonrhodes added the release_note:skip Skip the PR/issue when compiling release notes label Feb 21, 2023
@simianhacker
Copy link
Member

Tested this against edge-oblt data and the "Observability Overview Page" fails because the uptime capabilities are not available here:

We should change that line to:

if (capabilities[feature] && capabilities[feature].show === false) {

Since missing features (plugins) won't be available in the capabilities object.

@jasonrhodes jasonrhodes requested review from a team as code owners February 22, 2023 15:17
@jasonrhodes
Copy link
Member Author

Good catch, @simianhacker -- I've pushed a fix for that null pointer issue. I'm not sure if we use those track metric telemetry values at all, but just in case, I wanted to track the two scenarios (capability totally missing vs. capability explicitly set as show: false).

I'm still investigating an issue with the infra plugin where the empty state screens change when spaces are disabled.

@jasonrhodes jasonrhodes enabled auto-merge (squash) February 22, 2023 15:46
justinkambic pushed a commit to justinkambic/kibana that referenced this pull request Feb 23, 2023
Closes elastic#149973 

# Summary

This PR makes `spaces` an optional plugin. In Logs UI we use only the
space id and there we want to fallback to the default space id when the
space plugin is disabled. The difference to the changes in the other PRs
is that we will consider the default space as "active" space if the
space plugin is disabled: so in this case we will return the default
space id as this is the only property we need from the `getActiveSpace`
response.

# Testing
1. In the `kibana.dev.yaml` add `xpack.spaces.enabled: false`
2. Before we have this
[PR](elastic#151147) merged you should do
[this
change](https://github.com/elastic/kibana/pull/151147/files#diff-1b17eae66f358505fae8d86df37e155a25e8db996fce93ee6016582fb341092e)
on the branch while testing
3. Inside Logs the `Anomalies` and `Categories` pages should load the
default space

---------

Co-authored-by: kibanamachine <[email protected]>
@simianhacker
Copy link
Member

Here is what the Observability Overview page looks like with xpack.spaces.enabled: false:

image

As you can see all of the solution (plugins) are missing from the navigation and the page is not populated with data. Here is what it looks like without Spaces disabled:

image

@jasonrhodes Is this the expected behavior for this pr?

@jasonrhodes
Copy link
Member Author

@simianhacker Looks like the required spaces dependency for the "infra" plugin was accidentally re-introduced in a bad merge, causing what you saw in the UI for this branch. That's now been fixed and merged into this branch as well. This is what I see locally when I have spaces disabled:

Screenshot 2023-02-27 at 10 25 17 AM

Copy link
Member

@simianhacker simianhacker left a comment

Choose a reason for hiding this comment

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

Kid Pumped

Everything is working as expected now... Thanks @jasonrhodes!

@jasonrhodes
Copy link
Member Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Page load bundle

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

id before after diff
observability 89.0KB 89.1KB +102.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
securitySolution 428 430 +2

Total ESLint disabled count

id before after diff
securitySolution 506 508 +2

History

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

@jasonrhodes jasonrhodes merged commit 5e397c4 into elastic:main Mar 1, 2023
@kibanamachine kibanamachine added v8.8.0 backport:skip This commit does not require backporting labels Mar 1, 2023
bmorelli25 pushed a commit to bmorelli25/kibana that referenced this pull request Mar 10, 2023
## Summary

This PR makes spaces optional in the "observability" plugin as requested
in elastic#149687

To test this, use the following setting in your kibana.yml config file:

```yaml
xpack.spaces.enabled: false
```

When you log in, there will be no spaces choice. 

<img width="2543" alt="Screenshot 2023-02-21 at 11 53 18 AM"
src="https://user-images.githubusercontent.com/159370/220409537-43a216d5-81c9-4b29-97d8-47705bdacd06.png">
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 v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants