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 } } = {}) {
|
||||
await this._channel.tracingGroup({ name, options });
|
||||
await this._channel.tracingGroup({ name, location: options.location });
|
||||
}
|
||||
|
||||
async groupEnd() {
|
||||
|
|
|
|||
|
|
@ -26,13 +26,12 @@ scheme.StackFrame = tObject({
|
|||
column: tNumber,
|
||||
function: tOptional(tString),
|
||||
});
|
||||
scheme.Location = tObject({
|
||||
scheme.Metadata = tObject({
|
||||
location: tOptional(tObject({
|
||||
file: tString,
|
||||
line: tOptional(tNumber),
|
||||
column: tOptional(tNumber),
|
||||
});
|
||||
scheme.Metadata = tObject({
|
||||
location: tOptional(tType('Location')),
|
||||
})),
|
||||
apiName: tOptional(tString),
|
||||
internal: tOptional(tBoolean),
|
||||
stepId: tOptional(tString),
|
||||
|
|
@ -2281,9 +2280,6 @@ scheme.DialogAcceptParams = tObject({
|
|||
scheme.DialogAcceptResult = tOptional(tObject({}));
|
||||
scheme.DialogDismissParams = tOptional(tObject({}));
|
||||
scheme.DialogDismissResult = tOptional(tObject({}));
|
||||
scheme.TracingGroupOptions = tObject({
|
||||
location: tOptional(tType('Location')),
|
||||
});
|
||||
scheme.TracingInitializer = tOptional(tObject({}));
|
||||
scheme.TracingTracingStartParams = tObject({
|
||||
name: tOptional(tString),
|
||||
|
|
@ -2301,7 +2297,11 @@ scheme.TracingTracingStartChunkResult = tObject({
|
|||
});
|
||||
scheme.TracingTracingGroupParams = tObject({
|
||||
name: tString,
|
||||
options: tType('TracingGroupOptions'),
|
||||
location: tOptional(tObject({
|
||||
file: tString,
|
||||
line: tOptional(tNumber),
|
||||
column: tOptional(tNumber),
|
||||
})),
|
||||
});
|
||||
scheme.TracingTracingGroupResult = 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> {
|
||||
const { name, options } = params;
|
||||
await this._object.group(name, options, metadata);
|
||||
const { name, location } = params;
|
||||
await this._object.group(name, location, metadata);
|
||||
}
|
||||
|
||||
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 };
|
||||
}
|
||||
|
||||
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)
|
||||
return;
|
||||
const stackFrames: StackFrame[] = [];
|
||||
const { file, line, column } = options.location ?? metadata.location ?? {};
|
||||
const { file, line, column } = location ?? metadata.location ?? {};
|
||||
if (file) {
|
||||
stackFrames.push({
|
||||
file,
|
||||
|
|
|
|||
|
|
@ -144,14 +144,12 @@ export type StackFrame = {
|
|||
function?: string,
|
||||
};
|
||||
|
||||
export type Location = {
|
||||
export type Metadata = {
|
||||
location?: {
|
||||
file: string,
|
||||
line?: number,
|
||||
column?: number,
|
||||
};
|
||||
|
||||
export type Metadata = {
|
||||
location?: Location,
|
||||
},
|
||||
apiName?: string,
|
||||
internal?: boolean,
|
||||
stepId?: string,
|
||||
|
|
@ -4079,10 +4077,6 @@ export type DialogDismissResult = void;
|
|||
export interface DialogEvents {
|
||||
}
|
||||
|
||||
export type TracingGroupOptions = {
|
||||
location?: Location,
|
||||
};
|
||||
|
||||
// ----------- Tracing -----------
|
||||
export type TracingInitializer = {};
|
||||
export interface TracingEventTarget {
|
||||
|
|
@ -4122,10 +4116,18 @@ export type TracingTracingStartChunkResult = {
|
|||
};
|
||||
export type TracingTracingGroupParams = {
|
||||
name: string,
|
||||
options: TracingGroupOptions,
|
||||
location?: {
|
||||
file: string,
|
||||
line?: number,
|
||||
column?: number,
|
||||
},
|
||||
};
|
||||
export type TracingTracingGroupOptions = {
|
||||
|
||||
location?: {
|
||||
file: string,
|
||||
line?: number,
|
||||
column?: number,
|
||||
},
|
||||
};
|
||||
export type TracingTracingGroupResult = void;
|
||||
export type TracingTracingGroupEndParams = {};
|
||||
|
|
|
|||
|
|
@ -20,19 +20,17 @@ StackFrame:
|
|||
column: number
|
||||
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.
|
||||
|
||||
Metadata:
|
||||
type: object
|
||||
properties:
|
||||
location: Location?
|
||||
location:
|
||||
type: object?
|
||||
properties:
|
||||
file: string
|
||||
line: number?
|
||||
column: number?
|
||||
apiName: string?
|
||||
internal: boolean?
|
||||
# Test runner step id.
|
||||
|
|
@ -3178,12 +3176,6 @@ Dialog:
|
|||
|
||||
dismiss:
|
||||
|
||||
|
||||
TracingGroupOptions:
|
||||
type: object
|
||||
properties:
|
||||
location: Location?
|
||||
|
||||
Tracing:
|
||||
type: interface
|
||||
|
||||
|
|
@ -3206,7 +3198,12 @@ Tracing:
|
|||
tracingGroup:
|
||||
parameters:
|
||||
name: string
|
||||
options: TracingGroupOptions
|
||||
location:
|
||||
type: object?
|
||||
properties:
|
||||
file: string
|
||||
line: number?
|
||||
column: number?
|
||||
|
||||
tracingGroupEnd:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue