Skip to content

Commit

Permalink
chore: show channel name in trace viewer metadata (#26987)
Browse files Browse the repository at this point in the history
Fixes #26986
  • Loading branch information
mxschmitt committed Sep 11, 2023
1 parent 5811d65 commit 6bbc09c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps
this._snapshotter = new Snapshotter(context, this);
assert(tracesDir, 'tracesDir must be specified for BrowserContext');
this._contextCreatedEvent.browserName = context._browser.options.name;
this._contextCreatedEvent.channel = context._browser.options.channel;
this._contextCreatedEvent.options = context._options;
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/trace-viewer/src/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export type ContextEntry = {
startTime: number;
endTime: number;
browserName: string;
channel?: string;
platform?: string;
wallTime?: number;
sdkLanguage?: Language;
Expand Down
1 change: 1 addition & 0 deletions packages/trace-viewer/src/traceModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export class TraceModel {
this._version = event.version;
contextEntry.isPrimary = true;
contextEntry.browserName = event.browserName;
contextEntry.channel = event.channel;
contextEntry.title = event.title;
contextEntry.platform = event.platform;
contextEntry.wallTime = event.wallTime;
Expand Down
1 change: 1 addition & 0 deletions packages/trace-viewer/src/ui/metadataView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const MetadataView: React.FunctionComponent<{
<div className='call-line'>duration:<span className='call-value number' title={msToString(model.endTime - model.startTime)}>{msToString(model.endTime - model.startTime)}</span></div>
<div className='call-section'>Browser</div>
<div className='call-line'>engine:<span className='call-value string' title={model.browserName}>{model.browserName}</span></div>
{model.channel && <div className='call-line'>channel:<span className='call-value string' title={model.channel}>{model.channel}</span></div>}
{model.platform && <div className='call-line'>platform:<span className='call-value string' title={model.platform}>{model.platform}</span></div>}
{model.options.userAgent && <div className='call-line'>user agent:<span className='call-value datetime' title={model.options.userAgent}>{model.options.userAgent}</span></div>}
<div className='call-section'>Viewport</div>
Expand Down
2 changes: 2 additions & 0 deletions packages/trace-viewer/src/ui/modelUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export class MultiTraceModel {
readonly startTime: number;
readonly endTime: number;
readonly browserName: string;
readonly channel?: string;
readonly platform?: string;
readonly wallTime?: number;
readonly title?: string;
Expand All @@ -72,6 +73,7 @@ export class MultiTraceModel {

this.browserName = primaryContext?.browserName || '';
this.sdkLanguage = primaryContext?.sdkLanguage;
this.channel = primaryContext?.channel;
this.testIdAttributeName = primaryContext?.testIdAttributeName;
this.platform = primaryContext?.platform || '';
this.title = primaryContext?.title || '';
Expand Down
1 change: 1 addition & 0 deletions packages/trace/src/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export type ContextCreatedTraceEvent = {
version: number,
type: 'context-options',
browserName: string,
channel?: string,
platform: string,
wallTime: number,
title?: string,
Expand Down

0 comments on commit 6bbc09c

Please sign in to comment.