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

[Logs / Metrics] New Platform migration (full cutover) #54583

Merged
merged 162 commits into from
Feb 18, 2020
Merged
Show file tree
Hide file tree
Changes from 123 commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
26c7747
Remove remaining 'ui/' imports
Kerry350 Jan 8, 2020
d805286
Adds singleton registration utilities in case we need them as an esca…
jasonrhodes Dec 23, 2019
64c29ca
Renames app to legacy_shim for clarity
jasonrhodes Dec 23, 2019
1103ba3
Replaces QueryString kibana util with querystring lib
jasonrhodes Dec 23, 2019
a2d91ed
Move server dir (git mv x-pack/legacy/plugins/infra/server x-pack/plu…
Kerry350 Jan 13, 2020
b72e3a7
Move common dir (git mv x-pack/legacy/plugins/infra/common x-pack/plu…
Kerry350 Jan 13, 2020
a0def1f
Move public dir (git mv x-pack/legacy/plugins/infra/public x-pack/plu…
Kerry350 Jan 13, 2020
9d396ac
Move docs dir (git mv x-pack/legacy/plugins/infra/docs x-pack/plugins…
Kerry350 Jan 13, 2020
6d03a3c
Move types dir (git mv x-pack/legacy/plugins/infra/types x-pack/plugi…
Kerry350 Jan 13, 2020
6e65242
Move scripts dir (git mv x-pack/legacy/plugins/infra/scripts x-pack/p…
Kerry350 Jan 13, 2020
7d89358
Move README file (git mv x-pack/legacy/plugins/infra/README.md x-pack…
Kerry350 Jan 13, 2020
0ba19ee
Remove the legacy infra dir
Kerry350 Jan 13, 2020
edb53cc
Add eslint-disable-next-line @kbn/eslint/no-restricted-paths eslint r…
Kerry350 Jan 10, 2020
6c555d8
Unshims NP server plugin
jasonrhodes Dec 23, 2019
99ee9bd
Fix plugins.home.sampleData handling (this wasn't handled in the orig…
Kerry350 Jan 13, 2020
9303ac6
Fixes index patterns dependency for NP (based on APM)
jasonrhodes Dec 23, 2019
25fe506
Removes lodash/fp dependency to avoid need for our own lodash
jasonrhodes Dec 23, 2019
1e18bac
NP cleanup and removal of legacy server directory
jasonrhodes Jan 3, 2020
6719d12
Implements destructured imports for lodash methods
jasonrhodes Jan 9, 2020
9da401a
Fixes lodash destructure change so methods are correctly called in code
jasonrhodes Jan 9, 2020
d098523
yarn.lock changes (as package.json was removed from legacy infra folder)
Kerry350 Jan 13, 2020
19325ec
Fix various (non test) import paths
Kerry350 Jan 13, 2020
ede7bee
Add // eslint-disable-next-line @kbn/eslint/no-restricted-paths eslin…
Kerry350 Jan 13, 2020
d86cedd
Move metrics_explorer API types from server to common to fix restrict…
Kerry350 Jan 13, 2020
169365e
Move ip_to_hostname types from server to common to fix restricted imp…
Kerry350 Jan 13, 2020
7f9011c
Fixes to various typecheck and eslint errors
Kerry350 Jan 13, 2020
e8ea1bd
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Jan 14, 2020
650ab64
Move all brand new files (that don't fall under renames) to correct …
Kerry350 Jan 14, 2020
788586b
Amend import paths for categories work
Kerry350 Jan 14, 2020
2295e7e
Remove public shimming (not rendering yet)
Kerry350 Jan 14, 2020
e78358a
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Jan 14, 2020
3438cb3
Add Application registration and mounting for metrics and logs
Kerry350 Jan 14, 2020
0e31452
Fixes type and path errors
jasonrhodes Jan 15, 2020
d470f1b
Fix Lodash uses
Kerry350 Jan 15, 2020
0dbfaba
Merge pull request #3 from jasonrhodes/Kerry350__client-and-server-np…
Kerry350 Jan 15, 2020
714fa61
Merge branch 'client-and-server-np-dir-move' of github.com:Kerry350/k…
Kerry350 Jan 15, 2020
4131e59
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Jan 15, 2020
e72c06c
Move brand new file from master merge
Kerry350 Jan 15, 2020
8d81d6b
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Jan 16, 2020
afd35b9
Add styles to the element handed to us from application mouting
Kerry350 Jan 16, 2020
9c5b40a
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Jan 20, 2020
c2ea6c5
Change hash based routing to standard history API based routing
Kerry350 Jan 20, 2020
590c830
Move brand new files from merge
Kerry350 Jan 20, 2020
8c4ef84
Fix lodash references using _.
Kerry350 Jan 20, 2020
f382e35
Fix external linking
Kerry350 Jan 20, 2020
bad43ee
Amend usage of qs.stringify as it doesn't match the old behaviour and…
Kerry350 Jan 20, 2020
5598ff3
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Jan 21, 2020
1e338a8
Move new files from merge
Kerry350 Jan 21, 2020
b0edb90
Move file to correct location
Kerry350 Jan 21, 2020
145555a
Amend import path
Kerry350 Jan 22, 2020
2985910
Amend functional tests to accomodate browser based history
Kerry350 Jan 22, 2020
b3d6278
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Jan 22, 2020
fbed5ec
Port over Observability "category" changes from #53545
Kerry350 Jan 22, 2020
b7bc983
Add configPath to kibana.json
Kerry350 Jan 23, 2020
4533f91
Remove use of utils/fetch (Axios) and move to proper NP HTTP service
Kerry350 Jan 23, 2020
daaf0d6
Adjust response expectations to match http.fetch
Kerry350 Jan 23, 2020
ed6e5a7
Amend calculate_domain to account for change in behaviour in Lodash v…
Kerry350 Jan 23, 2020
3f316ca
Reinstates legacy infra plugin to make saved object mappings availabi…
jasonrhodes Jan 23, 2020
5879c9d
Merge pull request #4 from jasonrhodes/np-help_reinstate-legacy-infra…
Kerry350 Jan 23, 2020
4382081
Initiates legacy plugin correctly with proper dummy config
jasonrhodes Jan 23, 2020
bc0ed82
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Jan 23, 2020
bbe8436
Merge pull request #5 from jasonrhodes/np-help_reinstate-legacy-infra…
Kerry350 Jan 23, 2020
b5840dd
Merge branch 'client-and-server-np-dir-move' of github.com:Kerry350/k…
Kerry350 Jan 23, 2020
0ce1705
Move duplicated code into util function
Kerry350 Jan 23, 2020
9fa7a1c
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Jan 24, 2020
513bc07
Use usageCollection.reportUiStats for telemetry in useTrackMetric hook
Kerry350 Jan 24, 2020
272d21c
Add else clause
Kerry350 Jan 24, 2020
bd159f7
Change to conditional and switch warn to log
Kerry350 Jan 24, 2020
db3b578
Start amending functional tests
Kerry350 Jan 24, 2020
eab2091
Functional test amends
Kerry350 Jan 24, 2020
5d1f7f6
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Jan 27, 2020
8937728
Fix functional test / amend navigation helper
Kerry350 Jan 27, 2020
cc1dd36
Amend navigateToUrlWithBrowserHistory with new argument
Kerry350 Jan 27, 2020
9ddf7f9
Fixes APM trackEvent usage in NP context
jasonrhodes Jan 27, 2020
87ef535
Converts the rest of the APM uses of trackEvent
jasonrhodes Jan 27, 2020
3493e55
Moves track metric telemetry hooks etc to shared observability plugin
jasonrhodes Jan 27, 2020
dfcaaa0
Completes fleshing out basic observability NP plugin
jasonrhodes Jan 27, 2020
ed87031
Wraps APM app in KibanaContextProvider
jasonrhodes Jan 27, 2020
df4ccca
Fixed name mismatch problem
jasonrhodes Jan 27, 2020
d791da3
Fix unit tests
Kerry350 Jan 27, 2020
6a80609
Fix typing
Kerry350 Jan 27, 2020
83e17e4
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Jan 28, 2020
f5f41d7
Merge pull request #6 from jasonrhodes/apm-use-track-metric-hook-idea
Kerry350 Jan 28, 2020
3425228
Merge branch 'client-and-server-np-dir-move' of github.com:Kerry350/k…
Kerry350 Jan 28, 2020
2abc315
Guard against reportUiStats not being available (test scenarios etc)
Kerry350 Jan 28, 2020
ddf7a7a
Pass through plugins from start contracts not setup
Kerry350 Jan 28, 2020
cbb6c23
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Jan 29, 2020
3e1547e
Move shared typings from public/utils into proper shared Observabilit…
Kerry350 Jan 30, 2020
33a0fce
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Jan 30, 2020
3769ccd
Move new files
Kerry350 Jan 30, 2020
56869ae
Don't use typings as a module
Kerry350 Jan 30, 2020
7e5d87d
Fixes autocomplete in the new platform
jasonrhodes Jan 31, 2020
a89308f
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Jan 31, 2020
9289e49
Merge our plugins before starting the application
Kerry350 Jan 31, 2020
6cbc6c4
Merge remote-tracking branch 'origin/client-and-server-np-dir-move' i…
Kerry350 Jan 31, 2020
871a196
Fix variable reference from previous merge conflict resolution
Kerry350 Jan 31, 2020
2b59b50
Address typecheck failures
Kerry350 Jan 31, 2020
4cc05c1
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Feb 3, 2020
f44415d
Merge pull request #7 from jasonrhodes/np-fix-autocomplete
Kerry350 Feb 3, 2020
b2d7cfc
Merge branch 'client-and-server-np-dir-move' of github.com:Kerry350/k…
Kerry350 Feb 3, 2020
4243b4a
Remove rison_node.d.ts declaration file from infra and move to the sh…
Kerry350 Feb 3, 2020
ba35485
Better typings for autocomplete components
Kerry350 Feb 3, 2020
4161c86
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Feb 4, 2020
86a14ae
Fix i18nrc failures
Kerry350 Feb 4, 2020
b508b3b
Remove old legacy yarn.lock file
Kerry350 Feb 4, 2020
e1f2eb8
Updates app ids to solve routing problem when no base path is used
jasonrhodes Feb 4, 2020
f81207e
Merge pull request #8 from jasonrhodes/Kerry350__client-and-server-np…
Kerry350 Feb 4, 2020
c39d332
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Feb 4, 2020
4ee33d8
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Feb 5, 2020
d5c6459
Use data_enhanced plugin for Kuery autocomplete
Kerry350 Feb 5, 2020
3a1cce8
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Feb 6, 2020
881afe7
Add legacy routing layer to redirect /app/infra# URLs and fix app <->…
Kerry350 Feb 6, 2020
9f55d60
Account for edge case
Kerry350 Feb 6, 2020
6fd1cc5
Fix feature registration based on new App IDs
Kerry350 Feb 6, 2020
de70f2f
Update Jest snapshots for Uptime and Monitoring
Kerry350 Feb 6, 2020
ef4dca3
Fix tests / typecheck errors
Kerry350 Feb 7, 2020
6776339
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Feb 7, 2020
46656c4
Temp disable test
Kerry350 Feb 7, 2020
c576d14
Merge branch 'master' into client-and-server-np-dir-move
Kerry350 Feb 10, 2020
63a8798
Amend infrastucture_spaces functional tests
Kerry350 Feb 10, 2020
770339e
Account for different element setup
Kerry350 Feb 10, 2020
755acae
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Feb 10, 2020
2075cd1
Amend href attributes and remove the previous redirect layer
Kerry350 Feb 10, 2020
bb0c158
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Feb 11, 2020
327e480
Move new file
Kerry350 Feb 11, 2020
72641b2
Setup independent Metrics and Logs routers so that the history instan…
Kerry350 Feb 11, 2020
3f125f2
Remove APP_ID use
Kerry350 Feb 11, 2020
ea301f0
Add InfraAppId type
Kerry350 Feb 11, 2020
3d8deab
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Feb 12, 2020
89bb3de
Fix throttling of event tracking
Kerry350 Feb 12, 2020
7478011
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Feb 13, 2020
e45e6ce
Remove /legacy imports from Obervability plugin to fix build failures…
Kerry350 Feb 13, 2020
562cc09
Amend useUiTracker and APM usage
Kerry350 Feb 13, 2020
0e3a624
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Feb 13, 2020
917d173
Ensure response type for metrics explorer data is properly typed
Kerry350 Feb 13, 2020
5788aae
Use wrapper for mocking fetch from the KibanaContextProvider rather t…
Kerry350 Feb 13, 2020
80ce117
Update x-pack/plugins/infra/public/components/waffle/node_context_men…
Kerry350 Feb 13, 2020
997cf3b
Merge branch 'client-and-server-np-dir-move' of github.com:Kerry350/k…
Kerry350 Feb 13, 2020
5245816
Use Number.isFinite
Kerry350 Feb 13, 2020
47b9a34
Update x-pack/plugins/infra/public/components/logging/log_text_stream…
Kerry350 Feb 13, 2020
de32d77
Update x-pack/plugins/infra/public/components/logging/log_text_stream…
Kerry350 Feb 13, 2020
5342f07
Merge branch 'client-and-server-np-dir-move' of github.com:Kerry350/k…
Kerry350 Feb 13, 2020
1778b3a
Cleanup path prefixing with a hook
Kerry350 Feb 13, 2020
98b13bc
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Feb 14, 2020
5c21ac2
Fix tests
Kerry350 Feb 14, 2020
ab7fea7
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Feb 14, 2020
ce8b37b
Update x-pack/plugins/infra/server/lib/log_analysis/log_entry_rate_an…
Kerry350 Feb 14, 2020
2a2ec6a
Remove unused file
Kerry350 Feb 14, 2020
c3c0621
Merge branch 'client-and-server-np-dir-move' of github.com:Kerry350/k…
Kerry350 Feb 14, 2020
a92e367
Remove setup from legacy_singletons
Kerry350 Feb 14, 2020
18341a1
Add generic typing for clarity on which services are needed
Kerry350 Feb 14, 2020
9cbca46
Es lint fixes
Kerry350 Feb 14, 2020
825ffb4
Appease eslint
Kerry350 Feb 14, 2020
87fa820
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Feb 17, 2020
e967ce0
Ensure Apollo uses core.http.fetch
Kerry350 Feb 17, 2020
4f939c1
ES lint changes
Kerry350 Feb 17, 2020
a7678cf
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Feb 17, 2020
1cd37c8
Amend tests
Kerry350 Feb 17, 2020
f46a4c4
Ensure config is handled properly
Kerry350 Feb 17, 2020
934f001
Account for Apollo-link bug
Kerry350 Feb 17, 2020
e437cd3
Merge remote-tracking branch 'upstream/master' into client-and-server…
Kerry350 Feb 18, 2020
5a5813a
Improve type usages
Kerry350 Feb 18, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions test/functional/page_objects/common_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
public async navigateToUrlWithBrowserHistory(
appName: string,
subUrl?: string,
search?: string,
{
basePath = '',
ensureCurrentUrl = true,
Expand All @@ -203,6 +204,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
const appConfig = {
// subUrl following the basePath, assumes no hashes. Ex: 'app/endpoint/management'
pathname: `${basePath}${config.get(['apps', appName]).pathname}${subUrl}`,
search,
};

await this.navigate({
Expand Down
2 changes: 1 addition & 1 deletion x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"xpack.grokDebugger": "legacy/plugins/grokdebugger",
"xpack.idxMgmt": "legacy/plugins/index_management",
"xpack.indexLifecycleMgmt": "legacy/plugins/index_lifecycle_management",
"xpack.infra": "legacy/plugins/infra",
"xpack.infra": "plugins/infra",
"xpack.data": "plugins/data_enhanced",
"xpack.lens": "legacy/plugins/lens",
"xpack.licenseMgmt": "legacy/plugins/license_management",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { DetailView } from './DetailView';
import { ErrorDistribution } from './Distribution';
import { useLocation } from '../../../hooks/useLocation';
import { useUrlParams } from '../../../hooks/useUrlParams';
import { useTrackPageview } from '../../../../../infra/public';
import { useTrackPageview } from '../../../../../../../plugins/observability/public';

const Titles = styled.div`
margin-bottom: ${px(units.plus)};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { useFetcher } from '../../../hooks/useFetcher';
import { ErrorDistribution } from '../ErrorGroupDetails/Distribution';
import { ErrorGroupList } from './List';
import { useUrlParams } from '../../../hooks/useUrlParams';
import { useTrackPageview } from '../../../../../infra/public';
import { useTrackPageview } from '../../../../../../../plugins/observability/public';
import { PROJECTION } from '../../../../common/projections/typings';
import { LocalUIFilters } from '../../shared/LocalUIFilters';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useFetcher } from '../../../hooks/useFetcher';
import { NoServicesMessage } from './NoServicesMessage';
import { ServiceList } from './ServiceList';
import { useUrlParams } from '../../../hooks/useUrlParams';
import { useTrackPageview } from '../../../../../infra/public';
import { useTrackPageview } from '../../../../../../../plugins/observability/public';
import { PROJECTION } from '../../../../common/projections/typings';
import { LocalUIFilters } from '../../shared/LocalUIFilters';
import { useApmPluginContext } from '../../../hooks/useApmPluginContext';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { isRumAgentName } from '../../../../../../common/agent_name';
import { ALL_OPTION_VALUE } from '../../../../../../common/agent_configuration_constants';
import { saveConfig } from './saveConfig';
import { useApmPluginContext } from '../../../../../hooks/useApmPluginContext';
import { useUiTracker } from '../../../../../../../../../plugins/observability/public';

const defaultSettings = {
TRANSACTION_SAMPLE_RATE: '1.0',
Expand All @@ -59,6 +60,9 @@ export function AddEditFlyout({

const callApmApiFromHook = useCallApmApi();

// get a telemetry UI event tracker
const trackApmEvent = useUiTracker({ app: 'apm' });
Kerry350 marked this conversation as resolved.
Show resolved Hide resolved

// config conditions (service)
const [serviceName, setServiceName] = useState<string>(
selectedConfig ? selectedConfig.service.name || ALL_OPTION_VALUE : ''
Expand Down Expand Up @@ -133,7 +137,8 @@ export function AddEditFlyout({
transactionMaxSpans,
configurationId: selectedConfig ? selectedConfig.id : undefined,
agentName,
toasts
toasts,
trackApmEvent
});
setIsSaving(false);
onSaved();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import { i18n } from '@kbn/i18n';
import { NotificationsStart } from 'kibana/public';
import { APMClient } from '../../../../../services/rest/createCallApmApi';
import { trackEvent } from '../../../../../../../infra/public/hooks/use_track_metric';
import { isRumAgentName } from '../../../../../../common/agent_name';
import {
getOptionLabel,
omitAllOption
} from '../../../../../../common/agent_configuration_constants';
import { UiTracker } from '../../../../../../../../../plugins/observability/public';

interface Settings {
transaction_sample_rate: number;
Expand All @@ -29,7 +29,8 @@ export async function saveConfig({
transactionMaxSpans,
configurationId,
agentName,
toasts
toasts,
trackApmEvent
}: {
callApmApi: APMClient;
serviceName: string;
Expand All @@ -40,8 +41,9 @@ export async function saveConfig({
configurationId?: string;
agentName?: string;
toasts: NotificationsStart['toasts'];
trackApmEvent: UiTracker;
}) {
trackEvent({ app: 'apm', name: 'save_agent_configuration' });
trackApmEvent({ metric: 'save_agent_configuration' });

try {
const settings: Settings = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { isEmpty } from 'lodash';
import { useFetcher } from '../../../../hooks/useFetcher';
import { AgentConfigurationListAPIResponse } from '../../../../../server/lib/settings/agent_configuration/list_configurations';
import { AgentConfigurationList } from './AgentConfigurationList';
import { useTrackPageview } from '../../../../../../infra/public';
import { useTrackPageview } from '../../../../../../../../plugins/observability/public';
import { AddEditFlyout } from './AddEditFlyout';

export type Config = AgentConfigurationListAPIResponse[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React, { useMemo } from 'react';
import { FETCH_STATUS, useFetcher } from '../../../hooks/useFetcher';
import { TraceList } from './TraceList';
import { useUrlParams } from '../../../hooks/useUrlParams';
import { useTrackPageview } from '../../../../../infra/public';
import { useTrackPageview } from '../../../../../../../plugins/observability/public';
import { LocalUIFilters } from '../../shared/LocalUIFilters';
import { PROJECTION } from '../../../../common/projections/typings';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { useUrlParams } from '../../../hooks/useUrlParams';
import { FETCH_STATUS } from '../../../hooks/useFetcher';
import { TransactionBreakdown } from '../../shared/TransactionBreakdown';
import { ChartsSyncContextProvider } from '../../../context/ChartsSyncContext';
import { useTrackPageview } from '../../../../../infra/public';
import { useTrackPageview } from '../../../../../../../plugins/observability/public';
import { PROJECTION } from '../../../../common/projections/typings';
import { LocalUIFilters } from '../../shared/LocalUIFilters';
import { HeightRetainer } from '../../shared/HeightRetainer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { getHasMLJob } from '../../../services/rest/ml';
import { history } from '../../../utils/history';
import { useLocation } from '../../../hooks/useLocation';
import { ChartsSyncContextProvider } from '../../../context/ChartsSyncContext';
import { useTrackPageview } from '../../../../../infra/public';
import { useTrackPageview } from '../../../../../../../plugins/observability/public';
import { fromQuery, toQuery } from '../../shared/Links/url_helpers';
import { LocalUIFilters } from '../../shared/LocalUIFilters';
import { PROJECTION } from '../../../../common/projections/typings';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ import { InfraLink } from './InfraLink';

test('InfraLink produces the correct URL', async () => {
const href = await getRenderedHref(
() => <InfraLink path="/some/path" query={{ time: 1554687198 }} />,
() => (
<InfraLink app="metrics" path="/some/path" query={{ time: 1554687198 }} />
),
{
search: '?rangeFrom=now-5h&rangeTo=now-2h'
} as Location
);

expect(href).toMatchInlineSnapshot(
`"/basepath/app/infra#/some/path?time=1554687198"`
`"/basepath/app/metrics/some/path?time=1554687198"`
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { EuiLink, EuiLinkAnchorProps } from '@elastic/eui';
import { compact } from 'lodash';
import React from 'react';
import url from 'url';
import { fromQuery } from './url_helpers';
Expand All @@ -18,17 +17,18 @@ interface InfraQueryParams {
}

interface Props extends EuiLinkAnchorProps {
app: string;
Kerry350 marked this conversation as resolved.
Show resolved Hide resolved
path?: string;
query: InfraQueryParams;
children?: React.ReactNode;
}

export function InfraLink({ path, query = {}, ...rest }: Props) {
export function InfraLink({ app, path, query = {}, ...rest }: Props) {
const { core } = useApmPluginContext();
const nextSearch = fromQuery(query);
const href = url.format({
pathname: core.http.basePath.prepend('/app/infra'),
hash: compact([path, nextSearch]).join('?')
pathname: core.http.basePath.prepend(`/app/${app}${path}`),
search: nextSearch
});
return <EuiLink {...rest} href={href} />;
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ interface InfraConfigItem {
icon: string;
label: string;
condition?: boolean;
app: string;
Kerry350 marked this conversation as resolved.
Show resolved Hide resolved
path: string;
query: Record<string, any>;
}
Expand Down Expand Up @@ -86,6 +87,7 @@ export const TransactionActionMenu: FunctionComponent<Props> = (
{ defaultMessage: 'Show pod logs' }
),
condition: !!podId,
app: 'logs',
path: `/link-to/pod-logs/${podId}`,
query: { time }
},
Expand All @@ -96,6 +98,7 @@ export const TransactionActionMenu: FunctionComponent<Props> = (
{ defaultMessage: 'Show container logs' }
),
condition: !!containerId,
app: 'logs',
path: `/link-to/container-logs/${containerId}`,
query: { time }
},
Expand All @@ -106,6 +109,7 @@ export const TransactionActionMenu: FunctionComponent<Props> = (
{ defaultMessage: 'Show host logs' }
),
condition: !!hostName,
app: 'logs',
path: `/link-to/host-logs/${hostName}`,
query: { time }
},
Expand All @@ -116,6 +120,7 @@ export const TransactionActionMenu: FunctionComponent<Props> = (
{ defaultMessage: 'Show trace logs' }
),
condition: true,
app: 'logs',
path: `/link-to/logs`,
query: {
time,
Expand All @@ -129,6 +134,7 @@ export const TransactionActionMenu: FunctionComponent<Props> = (
{ defaultMessage: 'Show pod metrics' }
),
condition: !!podId,
app: 'metrics',
path: `/link-to/pod-detail/${podId}`,
query: infraMetricsQuery
},
Expand All @@ -139,6 +145,7 @@ export const TransactionActionMenu: FunctionComponent<Props> = (
{ defaultMessage: 'Show container metrics' }
),
condition: !!containerId,
app: 'metrics',
path: `/link-to/container-detail/${containerId}`,
query: infraMetricsQuery
},
Expand All @@ -149,17 +156,18 @@ export const TransactionActionMenu: FunctionComponent<Props> = (
{ defaultMessage: 'Show host metrics' }
),
condition: !!hostName,
app: 'metrics',
path: `/link-to/host-detail/${hostName}`,
query: infraMetricsQuery
}
];

const infraItems = infraConfigItems.map(
({ icon, label, condition, path, query }, index) => ({
({ icon, label, condition, path, query, app }, index) => ({
icon,
key: `infra-link-${index}`,
child: (
<InfraLink path={path} query={query}>
<InfraLink app={app} path={path} query={query}>
{label}
</InfraLink>
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { TransactionLineChart } from '../../charts/TransactionCharts/Transaction
import { asPercent } from '../../../../utils/formatters';
import { unit } from '../../../../style/variables';
import { isValidCoordinateValue } from '../../../../utils/isValidCoordinateValue';
import { trackEvent } from '../../../../../../infra/public/hooks/use_track_metric';
import { useUiTracker } from '../../../../../../../../plugins/observability/public';

interface Props {
timeseries: TimeSeries[];
Expand All @@ -30,13 +30,12 @@ const formatTooltipValue = (coordinate: Coordinate) => {
: NOT_AVAILABLE_LABEL;
};

const trackHoverBreakdownChart = throttle(
() => trackEvent({ app: 'apm', name: 'hover_breakdown_chart' }),
60000
);

const TransactionBreakdownGraph: React.FC<Props> = props => {
const { timeseries } = props;
const trackApmEvent = useUiTracker({ app: 'apm' });
const trackHoverBreakdownChart = throttle(() => {
Kerry350 marked this conversation as resolved.
Show resolved Hide resolved
trackApmEvent({ metric: 'hover_breakdown_chart' });
}, 60000);

return (
<TransactionLineChart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import {
EuiIcon
} from '@elastic/eui';
import styled from 'styled-components';
import { InfraFormatterType } from '../../../../../infra/public/lib/lib';
import { FORMATTERS } from '../../../../../infra/public/utils/formatters';
import {
FORMATTERS,
InfraFormatterType
} from '../../../../../../../plugins/infra/public';

interface TransactionBreakdownKpi {
name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { useTransactionBreakdown } from '../../../hooks/useTransactionBreakdown'
import { TransactionBreakdownHeader } from './TransactionBreakdownHeader';
import { TransactionBreakdownKpiList } from './TransactionBreakdownKpiList';
import { TransactionBreakdownGraph } from './TransactionBreakdownGraph';
import { trackEvent } from '../../../../../infra/public/hooks/use_track_metric';
import { FETCH_STATUS } from '../../../hooks/useFetcher';
import { useUiTracker } from '../../../../../../../plugins/observability/public';

const emptyMessage = i18n.translate('xpack.apm.transactionBreakdown.noData', {
defaultMessage: 'No data within this time range.'
Expand All @@ -21,11 +21,9 @@ const TransactionBreakdown: React.FC<{
initialIsOpen?: boolean;
}> = ({ initialIsOpen }) => {
const [showChart, setShowChart] = useState(!!initialIsOpen);

const { data, status } = useTransactionBreakdown();

const trackApmEvent = useUiTracker({ app: 'apm' });
const { kpis, timeseries } = data;

const noHits = data.kpis.length === 0 && status === FETCH_STATUS.SUCCESS;
const showEmptyMessage = noHits && !showChart;

Expand All @@ -38,9 +36,9 @@ const TransactionBreakdown: React.FC<{
onToggleClick={() => {
setShowChart(!showChart);
if (showChart) {
trackEvent({ app: 'apm', name: 'hide_breakdown_chart' });
trackApmEvent({ metric: 'hide_breakdown_chart' });
} else {
trackEvent({ app: 'apm', name: 'show_breakdown_chart' });
trackApmEvent({ metric: 'show_breakdown_chart' });
}
}}
/>
Expand Down
33 changes: 18 additions & 15 deletions x-pack/legacy/plugins/apm/public/new-platform/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { getConfigFromInjectedMetadata } from './getConfigFromInjectedMetadata';
import { setHelpExtension } from './setHelpExtension';
import { toggleAppLinkInNav } from './toggleAppLinkInNav';
import { setReadonlyBadge } from './updateBadge';
import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public';
import { Permission } from '../components/app/Permission';

export const REACT_APP_ROOT_ID = 'react-apm-root';
Expand Down Expand Up @@ -135,21 +136,23 @@ export class ApmPlugin

ReactDOM.render(
<ApmPluginContext.Provider value={apmPluginContextValue}>
<i18nCore.Context>
<Router history={history}>
<LocationProvider>
<MatchedRouteProvider routes={routes}>
<UrlParamsProvider>
<LoadingIndicatorProvider>
<LicenseProvider>
<App />
</LicenseProvider>
</LoadingIndicatorProvider>
</UrlParamsProvider>
</MatchedRouteProvider>
</LocationProvider>
</Router>
</i18nCore.Context>
<KibanaContextProvider services={{ ...core, ...plugins }}>
Kerry350 marked this conversation as resolved.
Show resolved Hide resolved
<i18nCore.Context>
<Router history={history}>
<LocationProvider>
<MatchedRouteProvider routes={routes}>
<UrlParamsProvider>
<LoadingIndicatorProvider>
<LicenseProvider>
<App />
</LicenseProvider>
</LoadingIndicatorProvider>
</UrlParamsProvider>
</MatchedRouteProvider>
</LocationProvider>
</Router>
</i18nCore.Context>
</KibanaContextProvider>
</ApmPluginContext.Provider>,
document.getElementById(REACT_APP_ROOT_ID)
);
Expand Down
Loading