-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Profiling] Stack traces embeddable (#173905)
Adding Stack traces Threads to the Infra plugin <img width="1680" alt="Screenshot 2023-12-27 at 14 28 50" src="https://github.com/elastic/kibana/assets/55978943/4f6b82a1-5c2a-4517-ad5d-481163b7ae37"> Error: <img width="1637" alt="Screenshot 2024-01-02 at 10 08 22" src="https://github.com/elastic/kibana/assets/55978943/3a881c8f-5513-4d15-928d-ae29c0ef3e68"> Empty: <img width="1625" alt="Screenshot 2024-01-02 at 10 11 01" src="https://github.com/elastic/kibana/assets/55978943/8a240420-3dae-4a35-b4ff-989bf14a0d68"> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
7850e3e
commit 50a6930
Showing
22 changed files
with
644 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
x-pack/plugins/infra/public/components/asset_details/tabs/profiling/threads.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* 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 { EmbeddableStackTraces } from '@kbn/observability-shared-plugin/public'; | ||
import React from 'react'; | ||
import { TopNType } from '@kbn/profiling-utils'; | ||
import { EuiSpacer } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { HOST_FIELD } from '../../../../../common/constants'; | ||
import { useAssetDetailsRenderPropsContext } from '../../hooks/use_asset_details_render_props'; | ||
import { useDatePickerContext } from '../../hooks/use_date_picker'; | ||
import { useKibanaContextForPlugin } from '../../../../hooks/use_kibana'; | ||
import { ProfilingLinks } from './profiling_links'; | ||
|
||
export function Threads() { | ||
const { services } = useKibanaContextForPlugin(); | ||
const { getDateRangeInTimestamp, dateRange, setDateRange } = useDatePickerContext(); | ||
const { from, to } = getDateRangeInTimestamp(); | ||
const { asset } = useAssetDetailsRenderPropsContext(); | ||
const stacktracesProfilingLinkLocator = | ||
services.observabilityShared.locators.profiling.stacktracesLocator; | ||
|
||
return ( | ||
<> | ||
<ProfilingLinks | ||
hostname={asset.name} | ||
from={dateRange.from} | ||
to={dateRange.to} | ||
profilingLinkLocator={stacktracesProfilingLinkLocator} | ||
profilingLinkLabel={i18n.translate('xpack.infra.flamegraph.profilingAppThreadsLink', { | ||
defaultMessage: 'Go to Universal Profiling Threads', | ||
})} | ||
/> | ||
<EuiSpacer /> | ||
<EmbeddableStackTraces | ||
type={TopNType.Threads} | ||
rangeFrom={from} | ||
rangeTo={to} | ||
kuery={`${HOST_FIELD}:"${asset.name}"`} | ||
onClick={(category) => { | ||
stacktracesProfilingLinkLocator.navigate({ | ||
type: TopNType.Traces, | ||
rangeFrom: dateRange.from, | ||
rangeTo: dateRange.to, | ||
kuery: `(${HOST_FIELD}:"${asset.name}" ) AND process.thread.name:"${category}"`, | ||
}); | ||
}} | ||
onChartBrushEnd={(range) => { | ||
setDateRange({ from: range.rangeFrom, to: range.rangeTo }); | ||
}} | ||
/> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
.../observability_shared/public/components/profiling/embeddables/embeddable_stack_traces.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* 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 from 'react'; | ||
import { TopNType } from '@kbn/profiling-utils'; | ||
import { EMBEDDABLE_STACK_TRACES } from '.'; | ||
import { ProfilingEmbeddable } from './profiling_embeddable'; | ||
|
||
interface Props { | ||
type: TopNType; | ||
kuery: string; | ||
rangeFrom: number; | ||
rangeTo: number; | ||
onClick: (category: string) => void; | ||
onChartBrushEnd: (range: { rangeFrom: string; rangeTo: string }) => void; | ||
} | ||
|
||
export function EmbeddableStackTraces(props: Props) { | ||
return <ProfilingEmbeddable {...props} embeddableFactoryId={EMBEDDABLE_STACK_TRACES} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.