diff --git a/x-pack/plugins/apm/public/application/index.tsx b/x-pack/plugins/apm/public/application/index.tsx
index 9e62f0257f489..c79dbb44c8349 100644
--- a/x-pack/plugins/apm/public/application/index.tsx
+++ b/x-pack/plugins/apm/public/application/index.tsx
@@ -20,6 +20,7 @@ import { createCallApmApi } from '../services/rest/create_call_apm_api';
import { setHelpExtension } from '../set_help_extension';
import { setReadonlyBadge } from '../update_badge';
import { ApmAppRoot } from '../components/routing/app_root';
+import type { KibanaEnvContext } from '../context/kibana_environment_context/kibana_environment_context';
/**
* This module is rendered asynchronously in the Kibana platform.
@@ -32,6 +33,7 @@ export const renderApp = ({
pluginsStart,
observabilityRuleTypeRegistry,
apmServices,
+ kibanaEnvironment,
}: {
coreStart: CoreStart;
pluginsSetup: ApmPluginSetupDeps;
@@ -40,6 +42,7 @@ export const renderApp = ({
pluginsStart: ApmPluginStartDeps;
observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry;
apmServices: ApmServices;
+ kibanaEnvironment: KibanaEnvContext;
}) => {
const { element, theme$ } = appMountParameters;
const apmPluginContextValue = {
@@ -58,6 +61,7 @@ export const renderApp = ({
uiActions: pluginsStart.uiActions,
observabilityAIAssistant: pluginsStart.observabilityAIAssistant,
share: pluginsSetup.share,
+ kibanaEnvironment,
};
// render APM feedback link in global help menu
diff --git a/x-pack/plugins/apm/public/components/routing/app_root/index.tsx b/x-pack/plugins/apm/public/components/routing/app_root/index.tsx
index ea1440c91706c..6f95463f619b6 100644
--- a/x-pack/plugins/apm/public/components/routing/app_root/index.tsx
+++ b/x-pack/plugins/apm/public/components/routing/app_root/index.tsx
@@ -21,6 +21,7 @@ import { RouteRenderer, RouterProvider } from '@kbn/typed-react-router-config';
import { euiDarkVars, euiLightVars } from '@kbn/ui-theme';
import React from 'react';
import { DefaultTheme, ThemeProvider } from 'styled-components';
+import { useKibanaEnvironmentContextProvider } from '../../../context/kibana_environment_context/use_kibana_environment_context';
import { AnomalyDetectionJobsContextProvider } from '../../../context/anomaly_detection_jobs/anomaly_detection_jobs_context';
import {
ApmPluginContext,
@@ -54,7 +55,9 @@ export function ApmAppRoot({
pluginsStart: ApmPluginStartDeps;
apmServices: ApmServices;
}) {
- const { appMountParameters, core } = apmPluginContextValue;
+ const { appMountParameters, kibanaEnvironment, core } = apmPluginContextValue;
+ const KibanaEnvironmentContextProvider =
+ useKibanaEnvironmentContextProvider(kibanaEnvironment);
const { history } = appMountParameters;
const i18nCore = core.i18n;
@@ -73,46 +76,50 @@ export function ApmAppRoot({
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/x-pack/plugins/apm/public/components/routing/templates/apm_main_template.tsx b/x-pack/plugins/apm/public/components/routing/templates/apm_main_template.tsx
index 5f9a68c0852dc..5e2e0964be791 100644
--- a/x-pack/plugins/apm/public/components/routing/templates/apm_main_template.tsx
+++ b/x-pack/plugins/apm/public/components/routing/templates/apm_main_template.tsx
@@ -9,8 +9,11 @@ import { EuiFlexGroup, EuiFlexItem, EuiPageHeaderProps } from '@elastic/eui';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { ObservabilityPageTemplateProps } from '@kbn/observability-shared-plugin/public';
import type { KibanaPageTemplateProps } from '@kbn/shared-ux-page-kibana-template';
-import React from 'react';
+import React, { useContext } from 'react';
import { useLocation } from 'react-router-dom';
+import { FeatureFeedbackButton } from '@kbn/observability-shared-plugin/public';
+import { KibanaEnvironmentContext } from '../../../context/kibana_environment_context/kibana_environment_context';
+import { getPathForFeedback } from '../../../utils/get_path_for_feedback';
import { EnvironmentsContextProvider } from '../../../context/environments_context/environments_context';
import { FETCH_STATUS, useFetcher } from '../../../hooks/use_fetcher';
import { ApmPluginStartDeps } from '../../../plugin';
@@ -22,6 +25,7 @@ import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_
// Paths that must skip the no data screen
const bypassNoDataScreenPaths = ['/settings', '/diagnostics'];
+const APM_FEEDBACK_LINK = 'https://ela.st/services-feedback';
/*
* This template contains:
@@ -56,7 +60,9 @@ export function ApmMainTemplate({
const location = useLocation();
const { services } = useKibana();
+ const kibanaEnvironment = useContext(KibanaEnvironmentContext);
const { http, docLinks, observabilityShared, application } = services;
+ const { kibanaVersion, isCloudEnv, isServerlessEnv } = kibanaEnvironment;
const basePath = http?.basePath.get();
const { config } = useApmPluginContext();
@@ -66,7 +72,7 @@ export function ApmMainTemplate({
return callApmApi('GET /internal/apm/has_data');
}, []);
- // create static data view on inital load
+ // create static data view on initial load
useFetcher(
(callApmApi) => {
const canCreateDataView =
@@ -111,11 +117,26 @@ export function ApmMainTemplate({
...(showServiceGroupSaveButton ? [] : []),
];
+ const sanitizedPath = getPathForFeedback(window.location.pathname);
const pageHeaderTitle = (
{pageHeader?.pageTitle ?? pageTitle}
- {environmentFilter && }
+
+
+
+
+
+ {environmentFilter && }
+
+
);
diff --git a/x-pack/plugins/apm/public/context/apm_plugin/apm_plugin_context.tsx b/x-pack/plugins/apm/public/context/apm_plugin/apm_plugin_context.tsx
index 9440a5e1c13f5..3fb8f3bacb767 100644
--- a/x-pack/plugins/apm/public/context/apm_plugin/apm_plugin_context.tsx
+++ b/x-pack/plugins/apm/public/context/apm_plugin/apm_plugin_context.tsx
@@ -19,6 +19,7 @@ import type { ObservabilityAIAssistantPluginStart } from '@kbn/observability-ai-
import { SharePluginSetup } from '@kbn/share-plugin/public';
import type { ApmPluginSetupDeps } from '../../plugin';
import type { ConfigSchema } from '../..';
+import type { KibanaEnvContext } from '../kibana_environment_context/kibana_environment_context';
export interface ApmPluginContextValue {
appMountParameters: AppMountParameters;
@@ -34,6 +35,7 @@ export interface ApmPluginContextValue {
uiActions: UiActionsStart;
observabilityAIAssistant: ObservabilityAIAssistantPluginStart;
share: SharePluginSetup;
+ kibanaEnvironment: KibanaEnvContext;
}
export const ApmPluginContext = createContext({} as ApmPluginContextValue);
diff --git a/x-pack/plugins/apm/public/context/kibana_environment_context/kibana_environment_context.tsx b/x-pack/plugins/apm/public/context/kibana_environment_context/kibana_environment_context.tsx
new file mode 100644
index 0000000000000..acf974d4d2dae
--- /dev/null
+++ b/x-pack/plugins/apm/public/context/kibana_environment_context/kibana_environment_context.tsx
@@ -0,0 +1,16 @@
+/*
+ * 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 { createContext } from 'react';
+
+export interface KibanaEnvContext {
+ kibanaVersion?: string;
+ isCloudEnv?: boolean;
+ isServerlessEnv?: boolean;
+}
+
+export const KibanaEnvironmentContext = createContext({});
diff --git a/x-pack/plugins/apm/public/context/kibana_environment_context/use_kibana_environment_context.tsx b/x-pack/plugins/apm/public/context/kibana_environment_context/use_kibana_environment_context.tsx
new file mode 100644
index 0000000000000..db9694e717c35
--- /dev/null
+++ b/x-pack/plugins/apm/public/context/kibana_environment_context/use_kibana_environment_context.tsx
@@ -0,0 +1,41 @@
+/*
+ * 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 React, { useMemo, createElement } from 'react';
+import {
+ KibanaEnvironmentContext,
+ type KibanaEnvContext,
+} from './kibana_environment_context';
+
+export const useKibanaEnvironmentContextProvider = ({
+ kibanaVersion,
+ isCloudEnv,
+ isServerlessEnv,
+}: KibanaEnvContext) => {
+ const value = useMemo(
+ () => ({
+ kibanaVersion,
+ isCloudEnv,
+ isServerlessEnv,
+ }),
+ [kibanaVersion, isCloudEnv, isServerlessEnv]
+ );
+
+ const Provider: React.FC<{ kibanaEnvironment?: KibanaEnvContext }> = ({
+ kibanaEnvironment = {},
+ children,
+ }) => {
+ const newProvider = createElement(KibanaEnvironmentContext.Provider, {
+ value: { ...kibanaEnvironment, ...value },
+ children,
+ });
+
+ return newProvider;
+ };
+
+ return Provider;
+};
diff --git a/x-pack/plugins/apm/public/plugin.ts b/x-pack/plugins/apm/public/plugin.ts
index 065eba1b7e64f..476a4e1fd5b82 100644
--- a/x-pack/plugins/apm/public/plugin.ts
+++ b/x-pack/plugins/apm/public/plugin.ts
@@ -73,6 +73,7 @@ import { DashboardStart } from '@kbn/dashboard-plugin/public';
import type { IUiSettingsClient } from '@kbn/core-ui-settings-browser';
import { from } from 'rxjs';
import { map } from 'rxjs/operators';
+import type { CloudSetup } from '@kbn/cloud-plugin/public';
import type { ConfigSchema } from '.';
import { registerApmRuleTypes } from './components/alerting/rule_types/register_apm_rule_types';
import {
@@ -106,6 +107,7 @@ export interface ApmPluginSetupDeps {
share: SharePluginSetup;
uiActions: UiActionsSetup;
profiling?: ProfilingPluginSetup;
+ cloud?: CloudSetup;
}
export interface ApmServices {
@@ -190,11 +192,16 @@ const apmTutorialTitle = i18n.translate(
export class ApmPlugin implements Plugin {
private telemetry: TelemetryService;
+ private kibanaVersion: string;
+ private isServerlessEnv: boolean;
constructor(
private readonly initializerContext: PluginInitializerContext
) {
this.initializerContext = initializerContext;
this.telemetry = new TelemetryService();
+ this.kibanaVersion = initializerContext.env.packageInfo.version;
+ this.isServerlessEnv =
+ initializerContext.env.packageInfo.buildFlavor === 'serverless';
}
public setup(core: CoreSetup, plugins: ApmPluginSetupDeps) {
@@ -396,17 +403,25 @@ export class ApmPlugin implements Plugin {
{ id: 'tutorial', title: apmTutorialTitle, path: '/tutorial' },
],
- async mount(appMountParameters: AppMountParameters) {
+ mount: async (appMountParameters: AppMountParameters) => {
// Load application bundle and Get start services
const [{ renderApp }, [coreStart, pluginsStart]] = await Promise.all([
import('./application'),
core.getStartServices(),
]);
+ const isCloudEnv = !!pluginSetupDeps.cloud?.isCloudEnabled;
+ const isServerlessEnv =
+ pluginSetupDeps.cloud?.isServerlessEnabled || this.isServerlessEnv;
return renderApp({
coreStart,
- pluginsSetup: pluginSetupDeps,
+ pluginsSetup: pluginSetupDeps as ApmPluginSetupDeps,
appMountParameters,
config,
+ kibanaEnvironment: {
+ isCloudEnv,
+ isServerlessEnv,
+ kibanaVersion: this.kibanaVersion,
+ },
pluginsStart: pluginsStart as ApmPluginStartDeps,
observabilityRuleTypeRegistry,
apmServices: {
diff --git a/x-pack/plugins/apm/public/utils/get_path_for_feedback.test.ts b/x-pack/plugins/apm/public/utils/get_path_for_feedback.test.ts
new file mode 100644
index 0000000000000..d8ee4c771a660
--- /dev/null
+++ b/x-pack/plugins/apm/public/utils/get_path_for_feedback.test.ts
@@ -0,0 +1,56 @@
+/*
+ * 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 { getPathForFeedback } from './get_path_for_feedback';
+
+describe('getPathForFeedback ', () => {
+ const testData = [
+ { value: `/ftw/app/apm/traces`, result: '/app/apm/traces' },
+ { value: `/app/apm/traces`, result: '/app/apm/traces' },
+ {
+ value: `/ftw/app/apm/traces/frontend/transactions/view`,
+ result: '/app/apm/traces*',
+ },
+ { value: `/app/apm/services`, result: '/app/apm/services' },
+ {
+ value: `/longer/path/before/app/apm/services`,
+ result: '/app/apm/services',
+ },
+ {
+ value: `/ftw/app/apm/services/long/path/after/services`,
+ result: '/app/apm/services*',
+ },
+ {
+ value: `/ftw/app/apm/dependencies/frontend/transactions/view`,
+ result: '/app/apm/dependencies*',
+ },
+ { value: `/app/apm/dependencies`, result: '/app/apm/dependencies' },
+ {
+ value: `/ftw/app/apm/dependencies/frontend/transactions/view`,
+ result: '/app/apm/dependencies*',
+ },
+ {
+ value: `/ftw/app/apm/settings/frontend/transactions/view`,
+ result: '/app/apm/settings*',
+ },
+ {
+ value: `/app/apm/some-page/frontend/transactions/view`,
+ result: '/app/apm/some-page*',
+ },
+ {
+ value: `/app/apm/settings`,
+ result: '/app/apm/settings',
+ },
+ ];
+
+ it.each(testData)(
+ 'Returns correct path for the feedback form $value -> $result',
+ ({ value, result }) => {
+ expect(getPathForFeedback(value)).toBe(result);
+ }
+ );
+});
diff --git a/x-pack/plugins/apm/public/utils/get_path_for_feedback.ts b/x-pack/plugins/apm/public/utils/get_path_for_feedback.ts
new file mode 100644
index 0000000000000..a8fafc0949629
--- /dev/null
+++ b/x-pack/plugins/apm/public/utils/get_path_for_feedback.ts
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+const APP_BASE_PATH = '/app';
+
+export const shortenPath = (path: string, pathStart: string) => {
+ if (path.startsWith(pathStart)) {
+ return path;
+ }
+ const indexOfPathStart = path.indexOf(pathStart);
+ return path.substring(indexOfPathStart);
+};
+
+export const getPathForFeedback = (path: string) => {
+ const pathStartingFromApp = shortenPath(path, APP_BASE_PATH);
+ const pathParts = pathStartingFromApp.split('/');
+ const constructPath = `/${pathParts.slice(1, 4).join('/')}`;
+ if (pathStartingFromApp === constructPath) {
+ return pathStartingFromApp;
+ }
+ return `${constructPath}*`;
+};
diff --git a/x-pack/plugins/infra/public/apps/common_providers.tsx b/x-pack/plugins/infra/public/apps/common_providers.tsx
index 158e0b95293e9..3915446edaeee 100644
--- a/x-pack/plugins/infra/public/apps/common_providers.tsx
+++ b/x-pack/plugins/infra/public/apps/common_providers.tsx
@@ -13,7 +13,11 @@ import type { ObservabilityAIAssistantPluginStart } from '@kbn/observability-ai-
import { Storage } from '@kbn/kibana-utils-plugin/public';
import { NavigationWarningPromptProvider } from '@kbn/observability-shared-plugin/public';
import { TriggersAndActionsUIPublicPluginStart } from '@kbn/triggers-actions-ui-plugin/public';
-import { useKibanaContextForPluginProvider } from '../hooks/use_kibana';
+import {
+ type KibanaEnvContext,
+ useKibanaContextForPluginProvider,
+ useKibanaEnvironmentContextProvider,
+} from '../hooks/use_kibana';
import { InfraClientStartDeps, InfraClientStartExports } from '../types';
import { HeaderActionMenuProvider } from '../utils/header_action_menu_provider';
import { TriggersActionsProvider } from '../utils/triggers_actions_context';
@@ -55,6 +59,7 @@ export interface CoreProvidersProps {
pluginStart: InfraClientStartExports;
plugins: InfraClientStartDeps;
theme$: AppMountParameters['theme$'];
+ kibanaEnvironment?: KibanaEnvContext;
}
export const CoreProviders: React.FC = ({
@@ -63,6 +68,7 @@ export const CoreProviders: React.FC = ({
pluginStart,
plugins,
theme$,
+ kibanaEnvironment,
}) => {
const KibanaContextProviderForPlugin = useKibanaContextForPluginProvider(
core,
@@ -70,11 +76,15 @@ export const CoreProviders: React.FC = ({
pluginStart
);
+ const KibanaEnvContextForPluginProvider = useKibanaEnvironmentContextProvider(kibanaEnvironment);
+
return (
-
- {children}
-
+
+
+ {children}
+
+
);
};
diff --git a/x-pack/plugins/infra/public/apps/metrics_app.tsx b/x-pack/plugins/infra/public/apps/metrics_app.tsx
index 17d93311deb4b..d47aaa62adcec 100644
--- a/x-pack/plugins/infra/public/apps/metrics_app.tsx
+++ b/x-pack/plugins/infra/public/apps/metrics_app.tsx
@@ -22,6 +22,7 @@ import { CommonInfraProviders, CoreProviders } from './common_providers';
import { prepareMountElement } from './common_styles';
import { SourceProvider } from '../containers/metrics_source';
import { PluginConfigProvider } from '../containers/plugin_config_context';
+import type { KibanaEnvContext } from '../hooks/use_kibana';
export const METRICS_APP_DATA_TEST_SUBJ = 'infraMetricsPage';
@@ -30,7 +31,8 @@ export const renderApp = (
plugins: InfraClientStartDeps,
pluginStart: InfraClientStartExports,
pluginConfig: InfraPublicConfig,
- { element, history, setHeaderActionMenu, theme$ }: AppMountParameters
+ { element, history, setHeaderActionMenu, theme$ }: AppMountParameters,
+ kibanaEnvironment: KibanaEnvContext
) => {
const storage = new Storage(window.localStorage);
@@ -46,6 +48,7 @@ export const renderApp = (
setHeaderActionMenu={setHeaderActionMenu}
storage={storage}
theme$={theme$}
+ kibanaEnvironment={kibanaEnvironment}
/>,
element
);
@@ -66,6 +69,7 @@ const MetricsApp: React.FC<{
setHeaderActionMenu: AppMountParameters['setHeaderActionMenu'];
storage: Storage;
theme$: AppMountParameters['theme$'];
+ kibanaEnvironment: KibanaEnvContext;
}> = ({
core,
history,
@@ -75,11 +79,18 @@ const MetricsApp: React.FC<{
setHeaderActionMenu,
storage,
theme$,
+ kibanaEnvironment,
}) => {
const uiCapabilities = core.application.capabilities;
return (
-
+
({});
+
export const useKibanaContextForPlugin =
useKibana as () => KibanaReactContextValue;
@@ -40,6 +48,27 @@ export const useKibanaContextForPluginProvider = (
() => createKibanaContextForPlugin(core, plugins, pluginStart),
[core, pluginStart, plugins]
);
+ return Provider;
+};
+
+export const useKibanaEnvironmentContextProvider = (kibanaEnvironment?: KibanaEnvContext) => {
+ const value = useMemo(
+ () => ({
+ kibanaVersion: kibanaEnvironment?.kibanaVersion,
+ isCloudEnv: kibanaEnvironment?.isCloudEnv,
+ isServerlessEnv: kibanaEnvironment?.isServerlessEnv,
+ }),
+ [kibanaEnvironment]
+ );
+
+ const Provider: React.FC<{ kibanaEnv?: KibanaEnvContext }> = ({ kibanaEnv = {}, children }) => {
+ const newProvider = createElement(KibanaEnvironmentContext.Provider, {
+ value: { ...kibanaEnv, ...value },
+ children,
+ });
+
+ return newProvider;
+ };
return Provider;
};
diff --git a/x-pack/plugins/infra/public/pages/metrics/hosts/index.tsx b/x-pack/plugins/infra/public/pages/metrics/hosts/index.tsx
index 7d170ee9e9cea..8766a8bdddf2e 100644
--- a/x-pack/plugins/infra/public/pages/metrics/hosts/index.tsx
+++ b/x-pack/plugins/infra/public/pages/metrics/hosts/index.tsx
@@ -6,12 +6,12 @@
*/
import { EuiErrorBoundary } from '@elastic/eui';
-import React from 'react';
-import { useTrackPageview } from '@kbn/observability-shared-plugin/public';
+import React, { useContext } from 'react';
+import { useTrackPageview, FeatureFeedbackButton } from '@kbn/observability-shared-plugin/public';
import { APP_WRAPPER_CLASS } from '@kbn/core/public';
import { css } from '@emotion/react';
import { i18n } from '@kbn/i18n';
-import { FeatureFeedbackButton } from '../../../components/feature_feedback_button';
+import { KibanaEnvironmentContext } from '../../../hooks/use_kibana';
import { SourceErrorPage } from '../../../components/source_error_page';
import { SourceLoadingPage } from '../../../components/source_loading_page';
import { useSourceContext } from '../../../containers/metrics_source';
@@ -29,6 +29,7 @@ const HOSTS_FEEDBACK_LINK =
export const HostsPage = () => {
const { isLoading, loadSourceFailureMessage, loadSource, source } = useSourceContext();
+ const { kibanaVersion, isCloudEnv, isServerlessEnv } = useContext(KibanaEnvironmentContext);
useTrackPageview({ app: 'infra_metrics', path: 'hosts' });
useTrackPageview({ app: 'infra_metrics', path: 'hosts', delay: 15000 });
@@ -84,6 +85,9 @@ export const HostsPage = () => {
,
],
}}
diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/survey_kubernetes.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/survey_kubernetes.tsx
index c213e08a064f1..c5524bae4eb41 100644
--- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/survey_kubernetes.tsx
+++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/survey_kubernetes.tsx
@@ -6,10 +6,11 @@
*/
import { EuiFlexGroup, EuiFlexItem, EuiGlobalToastList } from '@elastic/eui';
-import React from 'react';
+import React, { useContext } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import useLocalStorage from 'react-use/lib/useLocalStorage';
-import { FeatureFeedbackButton } from '../../../../components/feature_feedback_button';
+import { FeatureFeedbackButton } from '@kbn/observability-shared-plugin/public';
+import { KibanaEnvironmentContext } from '../../../../hooks/use_kibana';
const KUBERNETES_TOAST_STORAGE_KEY = 'kubernetesToastKey';
const KUBERNETES_FEEDBACK_LINK = 'https://ela.st/k8s-feedback';
@@ -18,11 +19,16 @@ export const SurveyKubernetes = () => {
const [isToastSeen, setIsToastSeen] = useLocalStorage(KUBERNETES_TOAST_STORAGE_KEY, false);
const markToastAsSeen = () => setIsToastSeen(true);
+ const { kibanaVersion, isCloudEnv, isServerlessEnv } = useContext(KibanaEnvironmentContext);
+
return (
<>
{
data-test-subj="infra-toast-kubernetes-survey-start"
onClickCapture={markToastAsSeen}
defaultButton={true}
+ kibanaVersion={kibanaVersion}
+ isCloudEnv={isCloudEnv}
+ isServerlessEnv={isServerlessEnv}
surveyButtonText={
,
],
}}
diff --git a/x-pack/plugins/infra/public/plugin.ts b/x-pack/plugins/infra/public/plugin.ts
index a25e553faa2cf..7d717cf9057e4 100644
--- a/x-pack/plugins/infra/public/plugin.ts
+++ b/x-pack/plugins/infra/public/plugin.ts
@@ -314,13 +314,11 @@ export class Plugin implements InfraClientPluginClass {
const isCloudEnv = !!pluginsSetup.cloud?.isCloudEnabled;
const isServerlessEnv = pluginsSetup.cloud?.isServerlessEnabled || this.isServerlessEnv;
- return renderApp(
- coreStart,
- { ...plugins, kibanaVersion: this.kibanaVersion, isCloudEnv, isServerlessEnv },
- pluginStart,
- this.config,
- params
- );
+ return renderApp(coreStart, { ...plugins }, pluginStart, this.config, params, {
+ kibanaVersion: this.kibanaVersion,
+ isCloudEnv,
+ isServerlessEnv,
+ });
},
});
diff --git a/x-pack/plugins/infra/public/types.ts b/x-pack/plugins/infra/public/types.ts
index 946ee4a7b1943..94c8a067f879e 100644
--- a/x-pack/plugins/infra/public/types.ts
+++ b/x-pack/plugins/infra/public/types.ts
@@ -88,9 +88,6 @@ export interface InfraClientStartDeps {
dataViews: DataViewsPublicPluginStart;
discover: DiscoverStart;
embeddable?: EmbeddableStart;
- kibanaVersion?: string;
- isCloudEnv: boolean;
- isServerlessEnv: boolean;
lens: LensPublicStart;
logsShared: LogsSharedClientStartExports;
ml: MlPluginStart;
diff --git a/x-pack/plugins/infra/public/components/feature_feedback_button.tsx b/x-pack/plugins/observability_shared/public/components/feature_feedback_button/feature_feedback_button.tsx
similarity index 67%
rename from x-pack/plugins/infra/public/components/feature_feedback_button.tsx
rename to x-pack/plugins/observability_shared/public/components/feature_feedback_button/feature_feedback_button.tsx
index f550fb0337bb4..c8e684294dc0f 100644
--- a/x-pack/plugins/infra/public/components/feature_feedback_button.tsx
+++ b/x-pack/plugins/observability_shared/public/components/feature_feedback_button/feature_feedback_button.tsx
@@ -8,12 +8,12 @@
import React, { ReactElement } from 'react';
import { EuiButton } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
-import { useKibanaContextForPlugin } from '../hooks/use_kibana';
const KIBANA_VERSION_QUERY_PARAM = 'entry.548460210';
const KIBANA_DEPLOYMENT_TYPE_PARAM = 'entry.573002982';
+const SANITIZED_PATH_PARAM = 'entry.1876422621';
-const getDeploymentType = (isCloudEnv: boolean, isServerlessEnv: boolean): string | undefined => {
+const getDeploymentType = (isCloudEnv?: boolean, isServerlessEnv?: boolean): string | undefined => {
if (isServerlessEnv) {
return 'Serverless (fully-managed projects)';
}
@@ -23,7 +23,12 @@ const getDeploymentType = (isCloudEnv: boolean, isServerlessEnv: boolean): strin
return 'Self-Managed (you manage)';
};
-const getSurveyFeedbackURL = (formUrl: string, kibanaVersion?: string, deploymentType?: string) => {
+const getSurveyFeedbackURL = (
+ formUrl: string,
+ kibanaVersion?: string,
+ deploymentType?: string,
+ sanitizedPath?: string
+) => {
const url = new URL(formUrl);
if (kibanaVersion) {
url.searchParams.append(KIBANA_VERSION_QUERY_PARAM, kibanaVersion);
@@ -31,6 +36,9 @@ const getSurveyFeedbackURL = (formUrl: string, kibanaVersion?: string, deploymen
if (deploymentType) {
url.searchParams.append(KIBANA_DEPLOYMENT_TYPE_PARAM, deploymentType);
}
+ if (sanitizedPath) {
+ url.searchParams.append(SANITIZED_PATH_PARAM, sanitizedPath);
+ }
return url.href;
};
@@ -41,6 +49,10 @@ interface FeatureFeedbackButtonProps {
surveyButtonText?: ReactElement;
onClickCapture?: () => void;
defaultButton?: boolean;
+ kibanaVersion?: string;
+ isCloudEnv?: boolean;
+ isServerlessEnv?: boolean;
+ sanitizedPath?: string;
}
export const FeatureFeedbackButton = ({
@@ -48,21 +60,25 @@ export const FeatureFeedbackButton = ({
'data-test-subj': dts,
onClickCapture,
defaultButton,
+ kibanaVersion,
+ isCloudEnv,
+ isServerlessEnv,
+ sanitizedPath,
surveyButtonText = (
),
}: FeatureFeedbackButtonProps) => {
- const {
- services: { kibanaVersion, isCloudEnv, isServerlessEnv },
- } = useKibanaContextForPlugin();
+ const deploymentType =
+ isCloudEnv !== undefined || isServerlessEnv !== undefined
+ ? getDeploymentType(isCloudEnv, isServerlessEnv)
+ : undefined;
- const deploymentType = getDeploymentType(isCloudEnv, isServerlessEnv);
return (
0.5)",
diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index 4a23239256f53..a506cb6a837e9 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -20172,7 +20172,7 @@
"xpack.infra.homePage.noMetricsIndicesInstructionsActionLabel": "セットアップの手順を表示",
"xpack.infra.homePage.settingsTabTitle": "設定",
"xpack.infra.homePage.tellUsWhatYouThinkK8sLink": "ご意見をお聞かせください。(K8s)",
- "xpack.infra.homePage.tellUsWhatYouThinkLink": "ご意見をお聞かせください。",
+ "xpack.observabilityShared.featureFeedbackButton.tellUsWhatYouThinkLink": "ご意見をお聞かせください。",
"xpack.infra.homePage.toolbar.kqlSearchFieldPlaceholder": "インフラストラクチャーデータを検索…(例:host.name:host-1)",
"xpack.infra.hostFlyout.explainProcessMessageTitle": "このプロセスの概要",
"xpack.infra.hosts.searchPlaceholder": "ホストを検索(例:cloud.provider:gcp AND system.load.1 > 0.5)",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index ccce90db35aaf..0074dfd450b80 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -20239,7 +20239,7 @@
"xpack.infra.homePage.noMetricsIndicesInstructionsActionLabel": "查看设置说明",
"xpack.infra.homePage.settingsTabTitle": "设置",
"xpack.infra.homePage.tellUsWhatYouThinkK8sLink": "告诉我们您的看法!(K8s)",
- "xpack.infra.homePage.tellUsWhatYouThinkLink": "告诉我们您的看法!",
+ "xpack.observabilityShared.featureFeedbackButton.tellUsWhatYouThinkLink": "告诉我们您的看法!",
"xpack.infra.homePage.toolbar.kqlSearchFieldPlaceholder": "搜索基础设施数据……(例如 host.name:host-1)",
"xpack.infra.hostFlyout.explainProcessMessageTitle": "此进程是什么?",
"xpack.infra.hosts.searchPlaceholder": "搜索主机(例如,cloud.provider:gcp AND system.load.1 > 0.5)",