UNPKG

3.53 kBTypeScriptView Raw
1import type { Client } from './client';
2import type { DebugImage } from './debugMeta';
3import type { Integration } from './integration';
4import type { MeasurementUnit } from './measurement';
5export interface ContinuousProfiler<T extends Client> {
6 initialize(client: T): void;
7 start(): void;
8 stop(): void;
9}
10export interface ProfilingIntegration<T extends Client> extends Integration {
11 _profiler: ContinuousProfiler<T>;
12}
13export interface Profiler {
14 startProfiler(): void;
15 stopProfiler(): void;
16}
17export type ThreadId = string;
18export type FrameId = number;
19export type StackId = number;
20export interface ThreadCpuSample {
21 stack_id: StackId;
22 thread_id: ThreadId;
23 queue_address?: string;
24 elapsed_since_start_ns: string;
25}
26export interface ContinuousThreadCpuSample {
27 stack_id: StackId;
28 thread_id: ThreadId;
29 queue_address?: string;
30 timestamp: number;
31}
32export type ThreadCpuStack = FrameId[];
33export type ThreadCpuFrame = {
34 function?: string;
35 file?: string;
36 lineno?: number;
37 colno?: number;
38 abs_path?: string;
39 platform?: string;
40 instruction_addr?: string;
41 module?: string;
42 in_app?: boolean;
43};
44export interface ThreadCpuProfile {
45 samples: ThreadCpuSample[];
46 stacks: ThreadCpuStack[];
47 frames: ThreadCpuFrame[];
48 thread_metadata: Record<ThreadId, {
49 name?: string;
50 priority?: number;
51 }>;
52 queue_metadata?: Record<string, {
53 label: string;
54 }>;
55}
56export interface ContinuousThreadCpuProfile {
57 samples: ContinuousThreadCpuSample[];
58 stacks: ThreadCpuStack[];
59 frames: ThreadCpuFrame[];
60 thread_metadata: Record<ThreadId, {
61 name?: string;
62 priority?: number;
63 }>;
64 queue_metadata?: Record<string, {
65 label: string;
66 }>;
67}
68interface BaseProfile<T> {
69 version: string;
70 release: string;
71 environment: string;
72 platform: string;
73 profile: T;
74 debug_meta?: {
75 images: DebugImage[];
76 };
77 measurements?: Record<string, {
78 unit: MeasurementUnit;
79 values: {
80 elapsed_since_start_ns: number;
81 value: number;
82 }[];
83 }>;
84}
85export interface Profile extends BaseProfile<ThreadCpuProfile> {
86 event_id: string;
87 version: string;
88 os: {
89 name: string;
90 version: string;
91 build_number?: string;
92 };
93 runtime: {
94 name: string;
95 version: string;
96 };
97 device: {
98 architecture: string;
99 is_emulator: boolean;
100 locale: string;
101 manufacturer: string;
102 model: string;
103 };
104 timestamp: string;
105 release: string;
106 environment: string;
107 platform: string;
108 profile: ThreadCpuProfile;
109 debug_meta?: {
110 images: DebugImage[];
111 };
112 transaction?: {
113 name: string;
114 id: string;
115 trace_id: string;
116 active_thread_id: string;
117 };
118 transactions?: {
119 name: string;
120 id: string;
121 trace_id: string;
122 active_thread_id: string;
123 relative_start_ns: string;
124 relative_end_ns: string;
125 }[];
126 measurements?: Record<string, {
127 unit: MeasurementUnit;
128 values: {
129 elapsed_since_start_ns: number;
130 value: number;
131 }[];
132 }>;
133}
134export interface ProfileChunk extends BaseProfile<ContinuousThreadCpuProfile> {
135 chunk_id: string;
136 profiler_id: string;
137 client_sdk: {
138 name: string;
139 version: string;
140 };
141}
142export {};
143//# sourceMappingURL=profiling.d.ts.map
\No newline at end of file