refactored review findings
Signed-off-by: René <snooz@posteo.de>
This commit is contained in:
parent
1894e28348
commit
01829d9a58
|
|
@ -52,7 +52,7 @@ export class Tracing extends ChannelOwner<channels.TracingChannel> implements ap
|
||||||
}
|
}
|
||||||
|
|
||||||
async group(name: string, options: { location?: { file: string, line?: number, column?: number } } = {}) {
|
async group(name: string, options: { location?: { file: string, line?: number, column?: number } } = {}) {
|
||||||
await this._channel.tracingGroup({ name, options });
|
await this._channel.tracingGroup({ name, location: options.location });
|
||||||
}
|
}
|
||||||
|
|
||||||
async groupEnd() {
|
async groupEnd() {
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,12 @@ scheme.StackFrame = tObject({
|
||||||
column: tNumber,
|
column: tNumber,
|
||||||
function: tOptional(tString),
|
function: tOptional(tString),
|
||||||
});
|
});
|
||||||
scheme.Location = tObject({
|
scheme.Metadata = tObject({
|
||||||
|
location: tOptional(tObject({
|
||||||
file: tString,
|
file: tString,
|
||||||
line: tOptional(tNumber),
|
line: tOptional(tNumber),
|
||||||
column: tOptional(tNumber),
|
column: tOptional(tNumber),
|
||||||
});
|
})),
|
||||||
scheme.Metadata = tObject({
|
|
||||||
location: tOptional(tType('Location')),
|
|
||||||
apiName: tOptional(tString),
|
apiName: tOptional(tString),
|
||||||
internal: tOptional(tBoolean),
|
internal: tOptional(tBoolean),
|
||||||
stepId: tOptional(tString),
|
stepId: tOptional(tString),
|
||||||
|
|
@ -2281,9 +2280,6 @@ scheme.DialogAcceptParams = tObject({
|
||||||
scheme.DialogAcceptResult = tOptional(tObject({}));
|
scheme.DialogAcceptResult = tOptional(tObject({}));
|
||||||
scheme.DialogDismissParams = tOptional(tObject({}));
|
scheme.DialogDismissParams = tOptional(tObject({}));
|
||||||
scheme.DialogDismissResult = tOptional(tObject({}));
|
scheme.DialogDismissResult = tOptional(tObject({}));
|
||||||
scheme.TracingGroupOptions = tObject({
|
|
||||||
location: tOptional(tType('Location')),
|
|
||||||
});
|
|
||||||
scheme.TracingInitializer = tOptional(tObject({}));
|
scheme.TracingInitializer = tOptional(tObject({}));
|
||||||
scheme.TracingTracingStartParams = tObject({
|
scheme.TracingTracingStartParams = tObject({
|
||||||
name: tOptional(tString),
|
name: tOptional(tString),
|
||||||
|
|
@ -2301,7 +2297,11 @@ scheme.TracingTracingStartChunkResult = tObject({
|
||||||
});
|
});
|
||||||
scheme.TracingTracingGroupParams = tObject({
|
scheme.TracingTracingGroupParams = tObject({
|
||||||
name: tString,
|
name: tString,
|
||||||
options: tType('TracingGroupOptions'),
|
location: tOptional(tObject({
|
||||||
|
file: tString,
|
||||||
|
line: tOptional(tNumber),
|
||||||
|
column: tOptional(tNumber),
|
||||||
|
})),
|
||||||
});
|
});
|
||||||
scheme.TracingTracingGroupResult = tOptional(tObject({}));
|
scheme.TracingTracingGroupResult = tOptional(tObject({}));
|
||||||
scheme.TracingTracingGroupEndParams = tOptional(tObject({}));
|
scheme.TracingTracingGroupEndParams = tOptional(tObject({}));
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,8 @@ export class TracingDispatcher extends Dispatcher<Tracing, channels.TracingChann
|
||||||
}
|
}
|
||||||
|
|
||||||
async tracingGroup(params: channels.TracingTracingGroupParams, metadata: CallMetadata): Promise<channels.TracingTracingGroupResult> {
|
async tracingGroup(params: channels.TracingTracingGroupParams, metadata: CallMetadata): Promise<channels.TracingTracingGroupResult> {
|
||||||
const { name, options } = params;
|
const { name, location } = params;
|
||||||
await this._object.group(name, options, metadata);
|
await this._object.group(name, location, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
async tracingGroupEnd(params: channels.TracingTracingGroupEndParams): Promise<channels.TracingTracingGroupEndResult> {
|
async tracingGroupEnd(params: channels.TracingTracingGroupEndParams): Promise<channels.TracingTracingGroupEndResult> {
|
||||||
|
|
|
||||||
|
|
@ -196,11 +196,11 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps
|
||||||
return { traceName: this._state.traceName };
|
return { traceName: this._state.traceName };
|
||||||
}
|
}
|
||||||
|
|
||||||
async group(name: string, options: { location?: { file: string, line?: number, column?: number } } = {}, metadata: CallMetadata): Promise<void> {
|
async group(name: string, location: { file: string, line?: number, column?: number } | undefined, metadata: CallMetadata): Promise<void> {
|
||||||
if (!this._state)
|
if (!this._state)
|
||||||
return;
|
return;
|
||||||
const stackFrames: StackFrame[] = [];
|
const stackFrames: StackFrame[] = [];
|
||||||
const { file, line, column } = options.location ?? metadata.location ?? {};
|
const { file, line, column } = location ?? metadata.location ?? {};
|
||||||
if (file) {
|
if (file) {
|
||||||
stackFrames.push({
|
stackFrames.push({
|
||||||
file,
|
file,
|
||||||
|
|
|
||||||
|
|
@ -144,14 +144,12 @@ export type StackFrame = {
|
||||||
function?: string,
|
function?: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Location = {
|
export type Metadata = {
|
||||||
|
location?: {
|
||||||
file: string,
|
file: string,
|
||||||
line?: number,
|
line?: number,
|
||||||
column?: number,
|
column?: number,
|
||||||
};
|
},
|
||||||
|
|
||||||
export type Metadata = {
|
|
||||||
location?: Location,
|
|
||||||
apiName?: string,
|
apiName?: string,
|
||||||
internal?: boolean,
|
internal?: boolean,
|
||||||
stepId?: string,
|
stepId?: string,
|
||||||
|
|
@ -4079,10 +4077,6 @@ export type DialogDismissResult = void;
|
||||||
export interface DialogEvents {
|
export interface DialogEvents {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TracingGroupOptions = {
|
|
||||||
location?: Location,
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------- Tracing -----------
|
// ----------- Tracing -----------
|
||||||
export type TracingInitializer = {};
|
export type TracingInitializer = {};
|
||||||
export interface TracingEventTarget {
|
export interface TracingEventTarget {
|
||||||
|
|
@ -4122,10 +4116,18 @@ export type TracingTracingStartChunkResult = {
|
||||||
};
|
};
|
||||||
export type TracingTracingGroupParams = {
|
export type TracingTracingGroupParams = {
|
||||||
name: string,
|
name: string,
|
||||||
options: TracingGroupOptions,
|
location?: {
|
||||||
|
file: string,
|
||||||
|
line?: number,
|
||||||
|
column?: number,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
export type TracingTracingGroupOptions = {
|
export type TracingTracingGroupOptions = {
|
||||||
|
location?: {
|
||||||
|
file: string,
|
||||||
|
line?: number,
|
||||||
|
column?: number,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
export type TracingTracingGroupResult = void;
|
export type TracingTracingGroupResult = void;
|
||||||
export type TracingTracingGroupEndParams = {};
|
export type TracingTracingGroupEndParams = {};
|
||||||
|
|
|
||||||
|
|
@ -20,19 +20,17 @@ StackFrame:
|
||||||
column: number
|
column: number
|
||||||
function: string?
|
function: string?
|
||||||
|
|
||||||
Location:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
file: string
|
|
||||||
line: number?
|
|
||||||
column: number?
|
|
||||||
|
|
||||||
# This object can be send with any rpc call in the "metadata" field.
|
# This object can be send with any rpc call in the "metadata" field.
|
||||||
|
|
||||||
Metadata:
|
Metadata:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
location: Location?
|
location:
|
||||||
|
type: object?
|
||||||
|
properties:
|
||||||
|
file: string
|
||||||
|
line: number?
|
||||||
|
column: number?
|
||||||
apiName: string?
|
apiName: string?
|
||||||
internal: boolean?
|
internal: boolean?
|
||||||
# Test runner step id.
|
# Test runner step id.
|
||||||
|
|
@ -3178,12 +3176,6 @@ Dialog:
|
||||||
|
|
||||||
dismiss:
|
dismiss:
|
||||||
|
|
||||||
|
|
||||||
TracingGroupOptions:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
location: Location?
|
|
||||||
|
|
||||||
Tracing:
|
Tracing:
|
||||||
type: interface
|
type: interface
|
||||||
|
|
||||||
|
|
@ -3206,7 +3198,12 @@ Tracing:
|
||||||
tracingGroup:
|
tracingGroup:
|
||||||
parameters:
|
parameters:
|
||||||
name: string
|
name: string
|
||||||
options: TracingGroupOptions
|
location:
|
||||||
|
type: object?
|
||||||
|
properties:
|
||||||
|
file: string
|
||||||
|
line: number?
|
||||||
|
column: number?
|
||||||
|
|
||||||
tracingGroupEnd:
|
tracingGroupEnd:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue