Skip to content

Commit 47f9ce4

Browse files
[8.19] [Profiling] Add colors for new frame types (process name, thread name, root) (#204977) (#219979)
# Backport This will backport the following commits from `main` to `8.19`: - [[Profiling] Add colors for new frame types (process name, thread name, root) (#204977)](#204977) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Tim Rühsen","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-08T09:24:43Z","message":"[Profiling] Add colors for new frame types (process name, thread name, root) (#204977)\n\n## Summary\r\nThis PR is a pre-requisite for adding aggregation by process name and by\r\nthread name to the Universal Profiling flamegraph view.\r\n\r\nIt adds three artificial node types to the flamegraph including color\r\ncodes.\r\n\r\nAs a side-effect, the root node now has its own color code. Previously,\r\nit (accidentally) used the color code of \"unknown\" type frames.\r\n\r\nThe PR is backwards compatible, so it doesn't change anything in the UI\r\nwhen connecting with current Elasticsearch.\r\nAs soon as [the PR for\r\nES](elastic/elasticsearch#119115) is merged, the\r\nnew aggregations show up.","sha":"bc5d8db237bdef481de9e4ce37d9e460755ae418","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","release_note:skip","backport:skip","v9.0.0","ci:project-deploy-observability","Team:obs-ux-infra_services"],"title":"[Profiling] Add colors for new frame types (process name, thread name, root)","number":204977,"url":"https://github.com/elastic/kibana/pull/204977","mergeCommit":{"message":"[Profiling] Add colors for new frame types (process name, thread name, root) (#204977)\n\n## Summary\r\nThis PR is a pre-requisite for adding aggregation by process name and by\r\nthread name to the Universal Profiling flamegraph view.\r\n\r\nIt adds three artificial node types to the flamegraph including color\r\ncodes.\r\n\r\nAs a side-effect, the root node now has its own color code. Previously,\r\nit (accidentally) used the color code of \"unknown\" type frames.\r\n\r\nThe PR is backwards compatible, so it doesn't change anything in the UI\r\nwhen connecting with current Elasticsearch.\r\nAs soon as [the PR for\r\nES](elastic/elasticsearch#119115) is merged, the\r\nnew aggregations show up.","sha":"bc5d8db237bdef481de9e4ce37d9e460755ae418"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/204977","number":204977,"mergeCommit":{"message":"[Profiling] Add colors for new frame types (process name, thread name, root) (#204977)\n\n## Summary\r\nThis PR is a pre-requisite for adding aggregation by process name and by\r\nthread name to the Universal Profiling flamegraph view.\r\n\r\nIt adds three artificial node types to the flamegraph including color\r\ncodes.\r\n\r\nAs a side-effect, the root node now has its own color code. Previously,\r\nit (accidentally) used the color code of \"unknown\" type frames.\r\n\r\nThe PR is backwards compatible, so it doesn't change anything in the UI\r\nwhen connecting with current Elasticsearch.\r\nAs soon as [the PR for\r\nES](elastic/elasticsearch#119115) is merged, the\r\nnew aggregations show up.","sha":"bc5d8db237bdef481de9e4ce37d9e460755ae418"}}]}] BACKPORT--> Co-authored-by: Tim Rühsen <[email protected]>
1 parent 23ed452 commit 47f9ce4

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)