Skip to content

Commit

Permalink
Remove unused ES fields from Profiling UI (elastic#205499)
Browse files Browse the repository at this point in the history
Closes elastic#204024

## Summary

This PR removes unused ES fields from Profiling UI.
  • Loading branch information
miloszmarcinkowski authored Jan 13, 2025
1 parent b328fe8 commit fbdc54e
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ export const baseFlamegraph: BaseFlameGraph = {
Size: 35,
SamplingRate: 1,
SelfCPU: 7,
TotalCPU: 245,
TotalSamples: 7,
TotalSeconds: 4.980000019073486,
};
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,5 @@ export const stacktraces: StackTraceResponse = {
},
executables: { '5JfXt00O17Yra2Rwh8HT8Q': 'vmlinux', fwIcP8qXDOl7k0VhWU8z9Q: 'metricbeat' },
stack_trace_events: { ['c2TovSbgCECd_RtKHxMtyQ']: 7 },
total_frames: 34,
sampling_rate: 1,
};
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export interface BaseFlameGraph {
/** sampling rate */
SamplingRate: number;
TotalSamples: number;
TotalCPU: number;
SelfCPU: number;
AnnualCO2TonsExclusive: number[];
AnnualCO2TonsInclusive: number[];
Expand Down Expand Up @@ -125,7 +124,6 @@ export function createFlameGraph(
TotalSeconds: base.TotalSeconds,
TotalSamples: base.TotalSamples,
SelfCPU: base.SelfCPU,
TotalCPU: base.TotalCPU,
SelfAnnualCO2KgsItems: base.AnnualCO2TonsExclusive.map(convertTonsToKgs),
TotalAnnualCO2KgsItems: base.AnnualCO2TonsInclusive.map(convertTonsToKgs),
SelfAnnualCostsUSDItems: base.AnnualCostsUSDExclusive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
describe('Stack trace response operations', () => {
test('empty stack trace response', () => {
const original: StackTraceResponse = {
total_frames: 0,
sampling_rate: 1.0,
};

Expand All @@ -26,7 +25,6 @@ describe('Stack trace response operations', () => {
stackTraces: new Map(),
stackFrames: new Map(),
executables: new Map(),
totalFrames: 0,
samplingRate: 1.0,
};

Expand All @@ -43,9 +41,6 @@ describe('Stack trace response operations', () => {

expect(decoded.events.size).toEqual(expected.events.size);
expect(decoded.events.size).toEqual(0);

expect(decoded.totalFrames).toEqual(expected.totalFrames);
expect(decoded.totalFrames).toEqual(0);
});

test('stack trace response without undefineds', () => {
Expand Down Expand Up @@ -82,7 +77,6 @@ describe('Stack trace response operations', () => {
abc: 'pthread.c',
def: 'def.c',
},
total_frames: 1,
sampling_rate: 1.0,
};

Expand Down Expand Up @@ -138,7 +132,6 @@ describe('Stack trace response operations', () => {
['abc', { FileName: 'pthread.c' }],
['def', { FileName: 'def.c' }],
]),
totalFrames: 1,
samplingRate: 1.0,
};

Expand All @@ -155,9 +148,6 @@ describe('Stack trace response operations', () => {

expect(decoded.events.size).toEqual(expected.events.size);
expect(decoded.events.size).toEqual(1);

expect(decoded.totalFrames).toEqual(expected.totalFrames);
expect(decoded.totalFrames).toEqual(1);
});

test('stack trace response with undefineds', () => {
Expand Down Expand Up @@ -188,7 +178,6 @@ describe('Stack trace response operations', () => {
executables: {
abc: 'pthread.c',
},
total_frames: 1,
};

const expected: DecodedStackTraceResponse = {
Expand Down Expand Up @@ -220,7 +209,6 @@ describe('Stack trace response operations', () => {
],
]),
executables: new Map([['abc', { FileName: 'pthread.c' }]]),
totalFrames: 1,
samplingRate: 1.0,
};

Expand All @@ -237,8 +225,5 @@ describe('Stack trace response operations', () => {

expect(decoded.events.size).toEqual(expected.events.size);
expect(decoded.events.size).toEqual(1);

expect(decoded.totalFrames).toEqual(expected.totalFrames);
expect(decoded.totalFrames).toEqual(1);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ export interface StackTraceResponse {
['stack_frames']?: ProfilingStackFrames;
/** executables */
['executables']?: ProfilingExecutables;
/** total frames */
['total_frames']: number;
/** sampling rate */
['sampling_rate']: number;
}
Expand All @@ -95,8 +93,6 @@ export interface DecodedStackTraceResponse {
stackFrames: Map<StackFrameID, StackFrame>;
/** Map of file ID and Executables */
executables: Map<FileID, Executable>;
/** Total number of frames */
totalFrames: number;
/** sampling rate */
samplingRate: number;
}
Expand Down Expand Up @@ -207,7 +203,6 @@ export function decodeStackTraceResponse(
stackTraces,
stackFrames,
executables,
totalFrames: response.total_frames,
samplingRate: response.sampling_rate,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ export const baseFlamegraph: BaseFlameGraph = {
Size: 35,
SamplingRate: 1,
SelfCPU: 7,
TotalCPU: 245,
TotalSamples: 7,
TotalSeconds: 4.980000019073486,
};
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,20 @@ function mergeStackTracesByDepth(response) {
}
});

let totalFrames = 0;
const stackTraceEvents = {};
const stackTraces = {};

Object.keys(eventsByFrameDepth).forEach((depth) => {
const { event, count } = eventsByFrameDepth[depth];
stackTraces[event] = response.stack_traces[event];
stackTraceEvents[event] = count;
totalFrames += stackTraces[event].frame_ids.length * count;
});

return {
stack_trace_events: stackTraceEvents,
stack_traces: stackTraces,
stack_frames: response.stack_frames,
executables: response.executables,
total_frames: totalFrames,
sampling_rate: response.sampling_rate,
};
}
Expand Down Expand Up @@ -97,7 +94,6 @@ function purgeUnusedFramesAndExecutables(response) {
stack_traces: response.stack_traces,
stack_frames: stackFrames,
executables: executables,
total_frames: response.total_frames,
sampling_rate: response.sampling_rate,
};
}
Expand Down

0 comments on commit fbdc54e

Please sign in to comment.