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

[serverless] Create Observability Serverless plugin #156118

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ packages/kbn-securitysolution-utils @elastic/security-solution-platform
packages/kbn-server-http-tools @elastic/kibana-core
packages/kbn-server-route-repository @elastic/apm-ui
x-pack/plugins/serverless @elastic/appex-sharedux
x-pack/plugins/serverless_observability @elastic/appex-sharedux
packages/serverless/project_switcher @elastic/appex-sharedux
packages/serverless/storybook/config @elastic/appex-sharedux
packages/serverless/types @elastic/appex-sharedux
Expand Down
17 changes: 16 additions & 1 deletion config/serverless.oblt.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
uiSettings.overrides.defaultRoute: /app/observability/overview
# Observability Project config

## Disable plugins
enterpriseSearch.enabled: false
xpack.cloudSecurityPosture.enabled: false
xpack.securitySolution.enabled: false

## Enable the Serverless Obsersability plugin
xpack.serverless.observability.enabled: true

## Configure plugins
xpack.infra.logs.app_target: discover

## Set the home route
uiSettings.overrides.defaultRoute: /app/observability/overview

## Set the dev project switch current type
xpack.serverless.plugin.developer.projectSwitcher.currentType: 'observability'
4 changes: 4 additions & 0 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,10 @@ Kibana.
|


|{kib-repo}blob/{branch}/x-pack/plugins/serverless_observability/README.mdx[serverlessObservability]
|This plugin contains configuration and code used to create a Serverless Observability project. It leverages universal configuration and other APIs in the serverless plugin to configure Kibana.


|{kib-repo}blob/{branch}/x-pack/plugins/session_view/README.md[sessionView]
|Session View is meant to provide a visualization into what is going on in a particular Linux environment where the agent is running. It looks likes a terminal emulator; however, it is a tool for introspecting process activity and understanding user and service behaviour in your Linux servers and infrastructure. It is a time-ordered series of process executions displayed in a tree over time.

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@
"@kbn/server-http-tools": "link:packages/kbn-server-http-tools",
"@kbn/server-route-repository": "link:packages/kbn-server-route-repository",
"@kbn/serverless": "link:x-pack/plugins/serverless",
"@kbn/serverless-observability": "link:x-pack/plugins/serverless_observability",
"@kbn/serverless-project-switcher": "link:packages/serverless/project_switcher",
"@kbn/serverless-types": "link:packages/serverless/types",
"@kbn/session-notifications-plugin": "link:test/plugin_functional/plugins/session_notifications",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ pageLoadAssetSize:
security: 65433
securitySolution: 66738
serverless: 16573
serverlessObservability: 16582
sessionView: 77750
share: 71239
snapshotRestore: 79032
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,8 @@
"@kbn/server-route-repository/*": ["packages/kbn-server-route-repository/*"],
"@kbn/serverless": ["x-pack/plugins/serverless"],
"@kbn/serverless/*": ["x-pack/plugins/serverless/*"],
"@kbn/serverless-observability": ["x-pack/plugins/serverless_observability"],
"@kbn/serverless-observability/*": ["x-pack/plugins/serverless_observability/*"],
"@kbn/serverless-project-switcher": ["packages/serverless/project_switcher"],
"@kbn/serverless-project-switcher/*": ["packages/serverless/project_switcher/*"],
"@kbn/serverless-storybook-config": ["packages/serverless/storybook/config"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import React from 'react';
import useObservable from 'react-use/lib/useObservable';
import type {
ObservabilityPageTemplateDependencies,
WrappedPageTemplateProps,
Expand All @@ -15,12 +16,23 @@ export const LazyObservabilityPageTemplate = React.lazy(() => import('./page_tem

export type LazyObservabilityPageTemplateProps = WrappedPageTemplateProps;

export function createLazyObservabilityPageTemplate(
injectedDeps: ObservabilityPageTemplateDependencies
) {
return (pageTemplateProps: LazyObservabilityPageTemplateProps) => (
<React.Suspense fallback={null}>
<LazyObservabilityPageTemplate {...pageTemplateProps} {...injectedDeps} />
</React.Suspense>
);
export function createLazyObservabilityPageTemplate({
clintandrewhall marked this conversation as resolved.
Show resolved Hide resolved
getChromeStyle$,
...injectedDeps
}: ObservabilityPageTemplateDependencies) {
return (pageTemplateProps: LazyObservabilityPageTemplateProps) => {
const chromeStyle = useObservable(getChromeStyle$());
const { showSolutionNav: showSolutionNavProp, ...props } = pageTemplateProps;
let showSolutionNav = showSolutionNavProp;

if (chromeStyle === 'project') {
showSolutionNav = false;
}

return (
<React.Suspense fallback={null}>
<LazyObservabilityPageTemplate {...{ ...props, showSolutionNav }} {...injectedDeps} />
</React.Suspense>
);
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ describe('Page template', () => {
navigationSections$: navigationRegistry.sections$,
getPageTemplateServices,
guidedOnboardingApi: guidedOnboardingMock.createStart().guidedOnboardingApi,
getChromeStyle$: () => of('classic'),
});

const component = shallow(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import type {
KibanaPageTemplateProps,
KibanaPageTemplateKibanaDependencies,
} from '@kbn/shared-ux-page-kibana-template';
import type { ChromeStart } from '@kbn/core-chrome-browser';
import { GuidedOnboardingPluginStart } from '@kbn/guided-onboarding-plugin/public';
import { ObservabilityAppServices } from '../../../application/types';
import type { NavigationSection } from '../../../services/navigation_registry';
Expand Down Expand Up @@ -53,9 +54,13 @@ export interface ObservabilityPageTemplateDependencies {
navigationSections$: Observable<NavigationSection[]>;
getPageTemplateServices: () => KibanaPageTemplateKibanaDependencies;
guidedOnboardingApi: GuidedOnboardingPluginStart['guidedOnboardingApi'];
getChromeStyle$: ChromeStart['getChromeStyle$'];
clintandrewhall marked this conversation as resolved.
Show resolved Hide resolved
}

export type ObservabilityPageTemplateProps = ObservabilityPageTemplateDependencies &
export type ObservabilityPageTemplateProps = Omit<
ObservabilityPageTemplateDependencies,
'getChromeStyle$'
> &
WrappedPageTemplateProps;

export function ObservabilityPageTemplate({
Expand All @@ -76,7 +81,6 @@ export function ObservabilityPageTemplate({
const sections = useObservable(navigationSections$, []);
const currentAppId = useObservable(currentAppId$, undefined);
const { pathname: currentPath } = useLocation();

const { services } = useKibana<ObservabilityAppServices>();

const sideNavItems = useMemo<Array<EuiSideNavItemType<unknown>>>(
Expand Down
7 changes: 5 additions & 2 deletions x-pack/plugins/observability/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@
"@kbn/core-theme-browser",
"@kbn/core-elasticsearch-server",
"@kbn/observability-shared-plugin",
"@kbn/exploratory-view-plugin"
"@kbn/exploratory-view-plugin",
"@kbn/core-chrome-browser"
],
"exclude": ["target/**/*"]
"exclude": [
"target/**/*"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*/

import React from 'react';
import useObservable from 'react-use/lib/useObservable';

import type {
ObservabilityPageTemplateDependencies,
WrappedPageTemplateProps,
Expand All @@ -15,12 +17,23 @@ export const LazyObservabilityPageTemplate = React.lazy(() => import('./page_tem

export type LazyObservabilityPageTemplateProps = WrappedPageTemplateProps;

export function createLazyObservabilityPageTemplate(
injectedDeps: ObservabilityPageTemplateDependencies
) {
return (pageTemplateProps: LazyObservabilityPageTemplateProps) => (
<React.Suspense fallback={null}>
<LazyObservabilityPageTemplate {...pageTemplateProps} {...injectedDeps} />
</React.Suspense>
);
export function createLazyObservabilityPageTemplate({
getChromeStyle$,
...injectedDeps
}: ObservabilityPageTemplateDependencies) {
return (pageTemplateProps: LazyObservabilityPageTemplateProps) => {
const chromeStyle = useObservable(getChromeStyle$());
const { showSolutionNav: showSolutionNavProp, ...props } = pageTemplateProps;
let showSolutionNav = showSolutionNavProp;

if (chromeStyle === 'project') {
showSolutionNav = false;
}

return (
<React.Suspense fallback={null}>
<LazyObservabilityPageTemplate {...{ ...props, showSolutionNav }} {...injectedDeps} />
</React.Suspense>
);
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ describe('Page template', () => {
navigationSections$: navigationRegistry.sections$,
getPageTemplateServices,
guidedOnboardingApi: guidedOnboardingMock.createStart().guidedOnboardingApi,
getChromeStyle$: () => of('classic'),
});

const component = shallow(
Expand Down Expand Up @@ -85,6 +86,7 @@ describe('Page template', () => {
}}
getPageTemplateServices={getPageTemplateServices}
guidedOnboardingApi={guidedOnboardingMock.createStart().guidedOnboardingApi}
getChromeStyle$={() => of('classic')}
>
<div>Test structure</div>
</ObservabilityPageTemplate>
Expand All @@ -107,6 +109,7 @@ describe('Page template', () => {
}}
getPageTemplateServices={getPageTemplateServices}
guidedOnboardingApi={guidedOnboardingMock.createStart().guidedOnboardingApi}
getChromeStyle$={() => of('classic')}
>
<div>Test structure</div>
</ObservabilityPageTemplate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import React, { useMemo } from 'react';
import { matchPath, useLocation } from 'react-router-dom';
import useObservable from 'react-use/lib/useObservable';
import type { Observable } from 'rxjs';
import type { ApplicationStart } from '@kbn/core/public';
import type { ApplicationStart, ChromeStart } from '@kbn/core/public';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import {
KibanaPageTemplate,
Expand Down Expand Up @@ -85,9 +85,13 @@ export interface ObservabilityPageTemplateDependencies {
navigationSections$: Observable<NavigationSection[]>;
getPageTemplateServices: () => KibanaPageTemplateKibanaDependencies;
guidedOnboardingApi: GuidedOnboardingPluginStart['guidedOnboardingApi'];
getChromeStyle$: ChromeStart['getChromeStyle$'];
}

export type ObservabilityPageTemplateProps = ObservabilityPageTemplateDependencies &
export type ObservabilityPageTemplateProps = Omit<
ObservabilityPageTemplateDependencies,
'getChromeStyle$'
> &
WrappedPageTemplateProps;

export function ObservabilityPageTemplate({
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/observability_shared/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class ObservabilitySharedPlugin implements Plugin {
}

public start(core: CoreStart, plugins: ObservabilitySharedStart) {
const { application } = core;
const { application, chrome } = core;

const PageTemplate = createLazyObservabilityPageTemplate({
currentAppId$: application.currentAppId$,
Expand All @@ -39,6 +39,7 @@ export class ObservabilitySharedPlugin implements Plugin {
navigationSections$: this.navigationRegistry.sections$,
guidedOnboardingApi: plugins.guidedOnboarding.guidedOnboardingApi,
getPageTemplateServices: () => ({ coreStart: core }),
getChromeStyle$: chrome.getChromeStyle$,
});

return {
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/serverless_observability/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build
/target
3 changes: 3 additions & 0 deletions x-pack/plugins/serverless_observability/README.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Serverless Observability project plugin

This plugin contains configuration and code used to create a Serverless Observability project. It leverages universal configuration and other APIs in the [`serverless`](../serverless/README.mdx) plugin to configure Kibana.
9 changes: 9 additions & 0 deletions x-pack/plugins/serverless_observability/common/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export const PLUGIN_ID = 'serverlessObservability';
export const PLUGIN_NAME = 'serverlessObservability';
22 changes: 22 additions & 0 deletions x-pack/plugins/serverless_observability/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"type": "plugin",
"id": "@kbn/serverless-observability",
"owner": "@elastic/appex-sharedux",
"description": "Serverless customizations for observability.",
"plugin": {
"id": "serverlessObservability",
"server": true,
"browser": true,
"configPath": [
"xpack",
"serverless",
"observability"
],
"requiredPlugins": [
"serverless",
"observability"
],
"optionalPlugins": [],
"requiredBundles": []
}
}
11 changes: 11 additions & 0 deletions x-pack/plugins/serverless_observability/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@kbn/serverless-observability",
"version": "1.0.0",
"license": "Elastic License 2.0",
"private": true,
"scripts": {
"build": "yarn plugin-helpers build",
"plugin-helpers": "node ../../../scripts/plugin_helpers",
"kbn": "node ../../../scripts/kbn"
}
}
19 changes: 19 additions & 0 deletions x-pack/plugins/serverless_observability/public/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { ServerlessObservabilityPlugin } from './plugin';

// This exports static code and TypeScript types,
// as well as, Kibana Platform `plugin()` initializer.
export function plugin() {
return new ServerlessObservabilityPlugin();
}

export type {
ServerlessObservabilityPluginSetup,
ServerlessObservabilityPluginStart,
} from './types';
34 changes: 34 additions & 0 deletions x-pack/plugins/serverless_observability/public/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
import {
ServerlessObservabilityPluginSetup,
ServerlessObservabilityPluginStart,
ServerlessObservabilityPluginSetupDependencies,
ServerlessObservabilityPluginStartDependencies,
} from './types';

export class ServerlessObservabilityPlugin
implements Plugin<ServerlessObservabilityPluginSetup, ServerlessObservabilityPluginStart>
{
public setup(
_core: CoreSetup,
_setupDeps: ServerlessObservabilityPluginSetupDependencies
): ServerlessObservabilityPluginSetup {
return {};
}

public start(
_core: CoreStart,
{ serverless }: ServerlessObservabilityPluginStartDependencies
): ServerlessObservabilityPluginStart {
return {};
}

public stop() {}
}
28 changes: 28 additions & 0 deletions x-pack/plugins/serverless_observability/public/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { ServerlessPluginSetup, ServerlessPluginStart } from '@kbn/serverless/public';
import {
ObservabilityPublicSetup,
ObservabilityPublicStart,
} from '@kbn/observability-plugin/public';

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ServerlessObservabilityPluginSetup {}

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ServerlessObservabilityPluginStart {}

export interface ServerlessObservabilityPluginSetupDependencies {
observability: ObservabilityPublicSetup;
serverless: ServerlessPluginSetup;
}

export interface ServerlessObservabilityPluginStartDependencies {
observability: ObservabilityPublicStart;
serverless: ServerlessPluginStart;
}
Loading