[Observability Onboarding] Link to right APM onboarding from the panel (#190598)

The APM and OpenTelemetry tiles on the "Add data" page always link to
the`/onboarding` page. However, on stateful, it should be `/tutorial`
instead (this is also what the "Add data" button in the top right of the
APM page links to).

This PR fixes the links, so the tiles link to the new streamlined
onboarding flow for serverless and to the old one for stateful.

On the new flow the "OpenTelemetry" tab is automatically selected. In
this fix, this isn't done for the old onboarding flow, as this would
require further changes. These can be done as a follow-up separate to
this PR to get the fix in place for 8.15.1
This commit is contained in:
Joe Reuter 2024-08-15 16:54:23 +02:00 committed by GitHub
parent f904104f23
commit 66a10805df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -23,7 +23,11 @@ export function useCustomCardsForCategory(
const history = useHistory();
const location = useLocation();
const {
services: { application, http },
services: {
application,
http,
context: { isServerless },
},
} = useKibana<ObservabilityOnboardingAppServices>();
const getUrlForApp = application?.getUrlForApp;
@ -32,6 +36,9 @@ export function useCustomCardsForCategory(
const { href: otelLogsUrl } = reactRouterNavigate(history, `/otel-logs/${location.search}`);
const { href: kubernetesUrl } = reactRouterNavigate(history, `/kubernetes/${location.search}`);
const apmUrl = `${getUrlForApp?.('apm')}/${isServerless ? 'onboarding' : 'tutorial'}`;
const otelApmUrl = isServerless ? `${apmUrl}?agent=openTelemetry` : apmUrl;
const otelCard: VirtualCard = {
id: 'otel-logs',
type: 'virtual',
@ -68,7 +75,7 @@ export function useCustomCardsForCategory(
src: 'apmApp',
},
],
url: `${getUrlForApp?.('apm')}/onboarding` ?? '',
url: apmUrl,
version: '',
integration: '',
},
@ -85,7 +92,7 @@ export function useCustomCardsForCategory(
src: http?.staticAssets.getPluginAssetHref('opentelemetry.svg') ?? '',
},
],
url: `${getUrlForApp?.('apm')}/onboarding?agent=openTelemetry` ?? '',
url: otelApmUrl,
version: '',
integration: '',
},