Skip to content

Commit

Permalink
[Serverless] Observability side navigation (#160620)
Browse files Browse the repository at this point in the history
fixes: #159681
fixes: #153777


<img width="1470" alt="image"
src="https://github.com/elastic/kibana/assets/3369346/eb810c65-c780-4597-9570-4b30cf2e1b09">


### Related
ML deep links won't show until it's merged
#159433

### Test
- e2e will be covered #160674
  • Loading branch information
kpatticha authored Jun 28, 2023
1 parent 0a6f5b8 commit 1a21965
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 31 deletions.
2 changes: 2 additions & 0 deletions test/plugin_functional/test_suites/core_plugins/rendering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
'xpack.apm.featureFlags.migrationToFleetAvailable (any)',
'xpack.apm.featureFlags.sourcemapApiAvailable (any)',
'xpack.apm.featureFlags.storageExplorerAvailable (any)',
'xpack.apm.serverless.enabled (any)', // It's a boolean (any because schema.conditional)
'xpack.observability_onboarding.serverless.enabled (any)', // It's a boolean (any because schema.conditional)
'xpack.cases.files.allowedMimeTypes (array)',
'xpack.cases.files.maxSize (number)',
'xpack.cases.markdownPlugins.lens (boolean)',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const mockConfig: ConfigSchema = {
sourcemapApiAvailable: true,
storageExplorerAvailable: true,
},
serverless: { enabled: false },
};

const urlService = new UrlService({
Expand Down
3 changes: 3 additions & 0 deletions x-pack/plugins/apm/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export interface ConfigSchema {
sourcemapApiAvailable: boolean;
storageExplorerAvailable: boolean;
};
serverless: {
enabled: boolean;
};
}

export const plugin: PluginInitializer<ApmPluginSetup, ApmPluginStart> = (
Expand Down
17 changes: 16 additions & 1 deletion x-pack/plugins/apm/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { map } from 'rxjs/operators';
import { UsageCollectionStart } from '@kbn/usage-collection-plugin/public';
import {
AppMountParameters,
AppNavLinkStatus,
CoreSetup,
CoreStart,
DEFAULT_APP_CATEGORIES,
Expand Down Expand Up @@ -321,6 +322,7 @@ export class ApmPlugin implements Plugin<ApmPluginSetup, ApmPluginStart> {
appRoute: '/app/apm',
icon: 'plugins/apm/public/icon.svg',
category: DEFAULT_APP_CATEGORIES.observability,
navLinkStatus: AppNavLinkStatus.visible,
deepLinks: [
{
id: 'service-groups-list',
Expand All @@ -331,13 +333,26 @@ export class ApmPlugin implements Plugin<ApmPluginSetup, ApmPluginStart> {
id: 'services',
title: servicesTitle,
path: '/services',
navLinkStatus: config.serverless.enabled
? AppNavLinkStatus.visible
: AppNavLinkStatus.default,
},
{
id: 'traces',
title: tracesTitle,
path: '/traces',
navLinkStatus: config.serverless.enabled
? AppNavLinkStatus.visible
: AppNavLinkStatus.default,
},
{ id: 'traces', title: tracesTitle, path: '/traces' },
{ id: 'service-map', title: serviceMapTitle, path: '/service-map' },
{
id: 'dependencies',
title: dependenciesTitle,
path: '/dependencies/inventory',
navLinkStatus: config.serverless.enabled
? AppNavLinkStatus.visible
: AppNavLinkStatus.default,
},
{ id: 'settings', title: apmSettingsTitle, path: '/settings' },
{
Expand Down
10 changes: 10 additions & 0 deletions x-pack/plugins/apm/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ const configSchema = schema.object({
sourcemapApiAvailable: disabledOnServerless,
storageExplorerAvailable: disabledOnServerless,
}),
serverless: schema.object({
enabled: schema.conditional(
schema.contextRef('serverless'),
true,
schema.literal(true),
schema.never(),
{ defaultValue: schema.contextRef('serverless') }
),
}),
});

// plugin config
Expand Down Expand Up @@ -150,6 +159,7 @@ export const config: PluginConfigDescriptor<APMConfig> = {
managedServiceUrl: true,
serverlessOnboarding: true,
featureFlags: true,
serverless: true,
},
schema: configSchema,
};
Expand Down
5 changes: 4 additions & 1 deletion x-pack/plugins/observability_onboarding/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class ObservabilityOnboardingPlugin
) {
const {
ui: { enabled: isObservabilityOnboardingUiEnabled },
serverless: { enabled: isServerlessEnabled },
} = this.ctx.config.get<ObservabilityOnboardingConfig>();

const pluginSetupDeps = plugins;
Expand All @@ -62,7 +63,9 @@ export class ObservabilityOnboardingPlugin
// and go to /app/observabilityOnboarding
if (isObservabilityOnboardingUiEnabled) {
core.application.register({
navLinkStatus: AppNavLinkStatus.hidden,
navLinkStatus: isServerlessEnabled
? AppNavLinkStatus.visible
: AppNavLinkStatus.hidden,
id: 'observabilityOnboarding',
title: 'Observability Onboarding',
order: 8500,
Expand Down
10 changes: 10 additions & 0 deletions x-pack/plugins/observability_onboarding/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ const configSchema = schema.object({
ui: schema.object({
enabled: schema.boolean({ defaultValue: true }),
}),
serverless: schema.object({
enabled: schema.conditional(
schema.contextRef('serverless'),
true,
schema.literal(true),
schema.never(),
{ defaultValue: schema.contextRef('serverless') }
),
}),
});

export type ObservabilityOnboardingConfig = TypeOf<typeof configSchema>;
Expand All @@ -24,6 +33,7 @@ export type ObservabilityOnboardingConfig = TypeOf<typeof configSchema>;
export const config: PluginConfigDescriptor<ObservabilityOnboardingConfig> = {
exposeToBrowser: {
ui: true,
serverless: true,
},
schema: configSchema,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,22 @@ const navigationTree: NavigationTreeDefinition = {
breadcrumbStatus: 'hidden',
children: [
{
id: 'services-infra',
id: 'discover-dashboard-viz',
children: [
{ link: 'apm:services' },
{
title: i18n.translate('xpack.serverlessObservability.nav.infrastructure', {
defaultMessage: 'Infrastructure',
link: 'discover',
},
{
title: i18n.translate('xpack.serverlessObservability.nav.dashboards', {
defaultMessage: 'Dashboards',
}),
link: 'dashboards',
},
{
title: i18n.translate('xpack.serverlessObservability.nav.visualizations', {
defaultMessage: 'Visualizations',
}),
link: 'metrics:inventory',
link: 'visualize',
},
],
},
Expand All @@ -54,32 +62,21 @@ const navigationTree: NavigationTreeDefinition = {
],
},
{
id: 'signals',
title: 'Signals',
id: 'apm',
title: 'APM',
children: [
{ link: 'apm:services' },
{
link: 'apm:traces',
},
{
title: i18n.translate('xpack.serverlessObservability.nav.signalsLogs', {
title: i18n.translate('xpack.serverlessObservability.nav.logs', {
defaultMessage: 'Logs',
}),
link: 'logs:stream',
},
],
},
{
id: 'toolbox',
title: 'Toolbox',
children: [
{
title: i18n.translate('xpack.serverlessObservability.nav.toolBoxVisualization', {
defaultMessage: 'Visualization',
}),
link: 'visualize',
},
{
link: 'dashboards',
link: 'apm:dependencies',
},
],
},
Expand All @@ -97,14 +94,6 @@ const navigationTree: NavigationTreeDefinition = {
},
],
},
{
type: 'navGroup',
...getPresets('analytics'),
},
{
type: 'navGroup',
...getPresets('ml'),
},
],
footer: [
{
Expand Down

0 comments on commit 1a21965

Please sign in to comment.