Skip to content

Commit 748a438

Browse files
Expose generated profiling types
1 parent db64c0f commit 748a438

9 files changed

Lines changed: 546 additions & 4 deletions

File tree

lib/cjs/generated/profiling.d.ts

Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
/**
2+
* DO NOT MODIFY IT BY HAND. Run `yarn generate` instead.
3+
*/
4+
/**
5+
* Schema of RUM Profiling.
6+
*/
7+
export declare type RumProfiling = BrowserProfileEventPayload | MobileProfileEvent;
8+
/**
9+
* Mobile SDK profiling event.
10+
*/
11+
export declare type MobileProfileEvent = ProfileEvent & {
12+
/**
13+
* The RUM Vital this profile event is associated with.
14+
*/
15+
readonly vital: {
16+
/**
17+
* Unique identifier of RUM Vital in the UUID format.
18+
*/
19+
readonly id: string;
20+
[k: string]: unknown;
21+
};
22+
[k: string]: unknown;
23+
};
24+
/**
25+
* Browser SDK profiling payload.
26+
*/
27+
export interface BrowserProfileEventPayload {
28+
/**
29+
* Profile event metadata.
30+
*/
31+
readonly event: ProfileEvent & {
32+
/**
33+
* Profile data format.
34+
*/
35+
readonly format: 'json';
36+
/**
37+
* Datadog internal metadata.
38+
*/
39+
readonly _dd: {
40+
/**
41+
* Clock drift value. Used by Browser SDK.
42+
*/
43+
readonly clock_drift: number;
44+
[k: string]: unknown;
45+
};
46+
[k: string]: unknown;
47+
};
48+
readonly 'wall-time.json': RumProfilerTrace;
49+
[k: string]: unknown;
50+
}
51+
/**
52+
* Schema of a Profile Event metadata. Contains attributes shared by all profiles.
53+
*/
54+
export interface ProfileEvent {
55+
/**
56+
* Application properties.
57+
*/
58+
readonly application: {
59+
/**
60+
* Application ID.
61+
*/
62+
readonly id: string;
63+
[k: string]: unknown;
64+
};
65+
/**
66+
* Session properties.
67+
*/
68+
readonly session?: {
69+
/**
70+
* Session ID.
71+
*/
72+
readonly id: string;
73+
[k: string]: unknown;
74+
};
75+
/**
76+
* View properties.
77+
*/
78+
readonly view?: {
79+
/**
80+
* Array of view IDs.
81+
*/
82+
readonly id: string[];
83+
/**
84+
* Array of view names.
85+
*/
86+
readonly name: string[];
87+
[k: string]: unknown;
88+
};
89+
/**
90+
* Long task properties.
91+
*/
92+
readonly long_task?: {
93+
/**
94+
* Array of long task IDs.
95+
*/
96+
readonly id: string[];
97+
[k: string]: unknown;
98+
};
99+
/**
100+
* List of attachment filenames.
101+
*/
102+
readonly attachments: string[];
103+
/**
104+
* Start time as ISO 8601 date string (yyyy-MM-dd'T'HH:mm:ss.SSS'Z').
105+
*/
106+
readonly start: string;
107+
/**
108+
* End time marking when the profile ended, as ISO 8601 date string (yyyy-MM-dd'T'HH:mm:ss.SSS'Z').
109+
*/
110+
readonly end: string;
111+
/**
112+
* Profiler family.
113+
*/
114+
readonly family: 'android' | 'chrome' | 'ios';
115+
/**
116+
* Runtime environment.
117+
*/
118+
readonly runtime: 'android' | 'chrome' | 'ios';
119+
/**
120+
* Profile ingestion event version.
121+
*/
122+
readonly version: number;
123+
/**
124+
* Comma-separated profiler tags.
125+
*/
126+
readonly tags_profiler: string;
127+
[k: string]: unknown;
128+
}
129+
/**
130+
* The profiler trace data (wall-time profile).
131+
*/
132+
export interface RumProfilerTrace {
133+
/**
134+
* An array of profiler resources.
135+
*/
136+
readonly resources: string[];
137+
/**
138+
* An array of profiler frames.
139+
*/
140+
readonly frames: ProfilerFrame[];
141+
/**
142+
* An array of profiler stacks.
143+
*/
144+
readonly stacks: ProfilerStack[];
145+
/**
146+
* An array of profiler samples.
147+
*/
148+
readonly samples: ProfilerSample[];
149+
startClocks: ClocksState;
150+
endClocks: ClocksState;
151+
clocksOrigin: ClocksState;
152+
/**
153+
* Sample interval in milliseconds.
154+
*/
155+
readonly sampleInterval: number;
156+
/**
157+
* List of detected long tasks.
158+
*/
159+
readonly longTasks: RumProfilerLongTaskEntry[];
160+
/**
161+
* List of detected navigation entries.
162+
*/
163+
readonly views: RumViewEntry[];
164+
[k: string]: unknown;
165+
}
166+
/**
167+
* Schema of a profiler frame from the JS Self-Profiling API.
168+
*/
169+
export interface ProfilerFrame {
170+
/**
171+
* A function instance name.
172+
*/
173+
readonly name: string;
174+
/**
175+
* Index in the trace.resources array.
176+
*/
177+
readonly resourceId?: number;
178+
/**
179+
* 1-based index of the line.
180+
*/
181+
readonly line?: number;
182+
/**
183+
* 1-based index of the column.
184+
*/
185+
readonly column?: number;
186+
[k: string]: unknown;
187+
}
188+
/**
189+
* Schema of a profiler stack from the JS Self-Profiling API.
190+
*/
191+
export interface ProfilerStack {
192+
/**
193+
* Index in the trace.stacks array.
194+
*/
195+
readonly parentId?: number;
196+
/**
197+
* Index in the trace.frames array.
198+
*/
199+
readonly frameId: number;
200+
[k: string]: unknown;
201+
}
202+
/**
203+
* Schema of a profiler sample from the JS Self-Profiling API.
204+
*/
205+
export interface ProfilerSample {
206+
/**
207+
* High resolution time relative to the profiling session's time origin.
208+
*/
209+
readonly timestamp: number;
210+
/**
211+
* Index in the trace.stacks array.
212+
*/
213+
readonly stackId?: number;
214+
[k: string]: unknown;
215+
}
216+
/**
217+
* Schema of timing state with both relative and absolute timestamps.
218+
*/
219+
export interface ClocksState {
220+
/**
221+
* Time relative to navigation start in milliseconds.
222+
*/
223+
readonly relative: number;
224+
/**
225+
* Epoch time in milliseconds.
226+
*/
227+
readonly timeStamp: number;
228+
[k: string]: unknown;
229+
}
230+
/**
231+
* Schema of a long task entry recorded during profiling.
232+
*/
233+
export interface RumProfilerLongTaskEntry {
234+
/**
235+
* RUM Long Task id.
236+
*/
237+
readonly id?: string;
238+
/**
239+
* Duration in ns of the long task or long animation frame.
240+
*/
241+
readonly duration: number;
242+
/**
243+
* Type of the event: long task or long animation frame
244+
*/
245+
readonly entryType: 'longtask' | 'long-animation-frame';
246+
startClocks: ClocksState;
247+
[k: string]: unknown;
248+
}
249+
/**
250+
* Schema of a RUM view entry recorded during profiling.
251+
*/
252+
export interface RumViewEntry {
253+
startClocks: ClocksState;
254+
/**
255+
* RUM view id.
256+
*/
257+
readonly viewId: string;
258+
/**
259+
* RUM view name.
260+
*/
261+
readonly viewName?: string;
262+
[k: string]: unknown;
263+
}

lib/cjs/generated/profiling.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"use strict";
2+
/* eslint-disable */
3+
/**
4+
* DO NOT MODIFY IT BY HAND. Run `yarn generate` instead.
5+
*/
6+
Object.defineProperty(exports, "__esModule", { value: true });

lib/cjs/src/profiling.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import * as BrowserProfiling from '../generated/browserProfiling';
22
import * as MobileProfiling from '../generated/mobileProfiling';
3+
export * from '../generated/profiling';
34
export { BrowserProfiling, MobileProfiling };
4-
export declare type ProfileEvent = BrowserProfiling.ProfileEvent | MobileProfiling.ProfileEvent;

lib/cjs/src/profiling.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
2222
__setModuleDefault(result, mod);
2323
return result;
2424
};
25+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
26+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27+
};
2528
Object.defineProperty(exports, "__esModule", { value: true });
2629
exports.MobileProfiling = exports.BrowserProfiling = void 0;
2730
var BrowserProfiling = __importStar(require("../generated/browserProfiling"));
2831
exports.BrowserProfiling = BrowserProfiling;
2932
var MobileProfiling = __importStar(require("../generated/mobileProfiling"));
3033
exports.MobileProfiling = MobileProfiling;
34+
__exportStar(require("../generated/profiling"), exports);

0 commit comments

Comments
 (0)