Skip to content

Commit bc5d8db

Browse files
authored
[Profiling] Add colors for new frame types (process name, thread name, root) (#204977)
## Summary This PR is a pre-requisite for adding aggregation by process name and by thread name to the Universal Profiling flamegraph view. It adds three artificial node types to the flamegraph including color codes. As a side-effect, the root node now has its own color code. Previously, it (accidentally) used the color code of "unknown" type frames. The PR is backwards compatible, so it doesn't change anything in the UI when connecting with current Elasticsearch. As soon as [the PR for ES](elastic/elasticsearch#119115) is merged, the new aggregations show up.
1 parent 7363f03 commit bc5d8db

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/platform/packages/shared/kbn-profiling-utils/common/profiling.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ export enum FrameType {
3737
DotNET,
3838
ErrorFlag = 0x80,
3939
Error = 0xff,
40+
41+
// Artificial frame types for grouping, set by the ES profiling plugin
42+
Root = 0x100,
43+
ProcessName = 0x101,
44+
ThreadName = 0x102,
4045
}
4146

4247
const frameTypeDescriptions = {
@@ -53,6 +58,9 @@ const frameTypeDescriptions = {
5358
[FrameType.DotNET]: '.NET',
5459
[FrameType.ErrorFlag]: 'ErrorFlag',
5560
[FrameType.Error]: 'Error',
61+
[FrameType.Root]: 'Root',
62+
[FrameType.ProcessName]: 'Process', // Due to OTEL semconv issues, "process name" is currently more correct than "executable name"
63+
[FrameType.ThreadName]: 'Thread',
5664
};
5765

5866
export function isErrorFrame(ft: FrameType): boolean {

x-pack/solutions/observability/plugins/profiling/common/frame_type_colors.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ import { FrameType, normalizeFrameType } from '@kbn/profiling-utils';
2828
*
2929
* Taken originally from prodfiler_ui/src/helpers/Pixi/frameTypeToColors.tsx
3030
*/
31+
const RED = 0xfd8484;
32+
const ORANGE = 0xffaa00;
33+
const YELLOW = 0xe1e100;
34+
3135
export const FRAME_TYPE_COLOR_MAP = {
3236
[FrameType.Unsymbolized]: [0xfd8484, 0xfd9d9d, 0xfeb5b5, 0xfecece],
3337
[FrameType.Python]: [0xfcae6b, 0xfdbe89, 0xfdcea6, 0xfedfc4],
@@ -42,6 +46,9 @@ export const FRAME_TYPE_COLOR_MAP = {
4246
[FrameType.DotNET]: [0x6c60e1, 0x8075e5, 0x948be9, 0xa8a0ed],
4347
[FrameType.ErrorFlag]: [0x0, 0x0, 0x0, 0x0], // This is a special case, it's not a real frame type
4448
[FrameType.Error]: [0xfd8484, 0xfd9d9d, 0xfeb5b5, 0xfecece],
49+
[FrameType.Root]: [RED, RED, RED, RED],
50+
[FrameType.ProcessName]: [ORANGE, ORANGE, ORANGE, ORANGE],
51+
[FrameType.ThreadName]: [YELLOW, YELLOW, YELLOW, YELLOW],
4552
};
4653

4754
export function frameTypeToRGB(frameType: FrameType, x: number): number {

0 commit comments

Comments
 (0)