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

[Profiling] Remove deprecated methods #165282

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions x-pack/plugins/profiling/common/base64.ts

This file was deleted.

12 changes: 0 additions & 12 deletions x-pack/plugins/profiling/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,6 @@ export function timeRangeFromRequest(request: any): [number, number] {
return [timeFrom, timeTo];
}

// Converts from a Map object to a Record object since Map objects are not
// serializable to JSON by default
export function fromMapToRecord<K extends string, V>(m: Map<K, V>): Record<string, V> {
const output: Record<string, V> = {};

for (const [key, value] of m) {
output[key] = value;
}

return output;
}

export const NOT_AVAILABLE_LABEL = i18n.translate('xpack.profiling.notAvailableLabel', {
defaultMessage: 'N/A',
});
11 changes: 0 additions & 11 deletions x-pack/plugins/profiling/common/profiling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,15 @@
*/

import {
createStackFrameID,
createStackFrameMetadata,
FrameSymbolStatus,
FrameType,
getAddressFromStackFrameID,
getCalleeFunction,
getCalleeSource,
getFileIDFromStackFrameID,
getFrameSymbolStatus,
getLanguageType,
} from './profiling';

describe('Stack frame operations', () => {
test('decode stack frame ID', () => {
const frameID = createStackFrameID('ABCDEFGHIJKLMNOPQRSTUw', 123456789);
expect(getAddressFromStackFrameID(frameID)).toEqual(123456789);
expect(getFileIDFromStackFrameID(frameID)).toEqual('ABCDEFGHIJKLMNOPQRSTUw');
});
});

describe('Stack frame metadata operations', () => {
test('metadata has executable and function names', () => {
const metadata = createStackFrameMetadata({
Expand Down
40 changes: 0 additions & 40 deletions x-pack/plugins/profiling/common/profiling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,10 @@
* 2.0.
*/

import { charCodeAt, safeBase64Encoder } from './base64';

export type StackTraceID = string;
export type StackFrameID = string;
export type FileID = string;

export function createStackFrameID(fileID: FileID, addressOrLine: number): StackFrameID {
const buf = Buffer.alloc(24);
Buffer.from(fileID, 'base64url').copy(buf);
buf.writeBigUInt64BE(BigInt(addressOrLine), 16);
return buf.toString('base64url');
}

/* eslint no-bitwise: ["error", { "allow": ["&"] }] */
export function getFileIDFromStackFrameID(frameID: StackFrameID): FileID {
return frameID.slice(0, 21) + safeBase64Encoder[frameID.charCodeAt(21) & 0x30];
}

/* eslint no-bitwise: ["error", { "allow": ["<<=", "&"] }] */
export function getAddressFromStackFrameID(frameID: StackFrameID): number {
let address = charCodeAt(frameID, 21) & 0xf;
address <<= 6;
address += charCodeAt(frameID, 22);
address <<= 6;
address += charCodeAt(frameID, 23);
address <<= 6;
address += charCodeAt(frameID, 24);
address <<= 6;
address += charCodeAt(frameID, 25);
address <<= 6;
address += charCodeAt(frameID, 26);
address <<= 6;
address += charCodeAt(frameID, 27);
address <<= 6;
address += charCodeAt(frameID, 28);
address <<= 6;
address += charCodeAt(frameID, 29);
address <<= 6;
address += charCodeAt(frameID, 30);
address <<= 6;
address += charCodeAt(frameID, 31);
return address;
}

export enum FrameType {
Unsymbolized = 0,
Python,
Expand Down
170 changes: 0 additions & 170 deletions x-pack/plugins/profiling/common/run_length_encoding.test.ts

This file was deleted.

Loading