-
Notifications
You must be signed in to change notification settings - Fork 11
Trace drilldown to explorer screen #1098
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
df3b19b
b9719c4
68a4ea6
660e6fc
d00cf46
36d7814
51d9b3b
fa4ceb6
125cb26
3030d2b
97af327
58c5efd
484cc8f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
| import { IconType } from '@hypertrace/assets-library'; | ||
| import { NavigationService, SubscriptionLifecycle } from '@hypertrace/common'; | ||
| import { ButtonRole, ButtonStyle, IconSize } from '@hypertrace/components'; | ||
| import { NavigationParams, NavigationService, SubscriptionLifecycle } from '@hypertrace/common'; | ||
| import { ButtonRole, ButtonStyle, FilterOperator, IconSize } from '@hypertrace/components'; | ||
| import { Observable } from 'rxjs'; | ||
| import { LogEvent } from '../../shared/dashboard/widgets/waterfall/waterfall/waterfall-chart'; | ||
| import { ExplorerService } from '../explorer/explorer-service'; | ||
| import { ScopeQueryParam } from '../explorer/explorer.component'; | ||
| import { ApiTraceDetails, ApiTraceDetailService } from './api-trace-detail.service'; | ||
|
|
||
| @Component({ | ||
|
|
@@ -31,12 +33,19 @@ import { ApiTraceDetails, ApiTraceDetailService } from './api-trace-detail.servi | |
| icon="${IconType.Time}" | ||
| [value]="traceDetails.timeString" | ||
| ></ht-summary-value> | ||
| <ht-summary-value | ||
| class="summary-value" | ||
| icon="${IconType.TraceId}" | ||
| label="Trace ID" | ||
| [value]="traceDetails.traceId" | ||
| ></ht-summary-value> | ||
|
|
||
| <ng-container | ||
| *ngIf="this.getExploreNavigationParams(traceDetails.traceId) | async as exploreNavigationParams" | ||
| > | ||
| <ht-link class="link" [paramsOrUrl]="exploreNavigationParams"> | ||
|
||
| <ht-summary-value | ||
| class="summary-value" | ||
| icon="${IconType.TraceId}" | ||
| label="Trace ID" | ||
| [value]="traceDetails.traceId" | ||
| ></ht-summary-value> | ||
| </ht-link> | ||
| </ng-container> | ||
|
|
||
| <div class="separation"></div> | ||
|
|
||
|
|
@@ -73,7 +82,8 @@ export class ApiTraceDetailPageComponent { | |
|
|
||
| public constructor( | ||
| protected readonly navigationService: NavigationService, | ||
| private readonly apiTraceDetailService: ApiTraceDetailService | ||
| private readonly apiTraceDetailService: ApiTraceDetailService, | ||
| private readonly explorerService: ExplorerService | ||
| ) { | ||
| this.traceDetails$ = this.apiTraceDetailService.fetchTraceDetails(); | ||
| this.logEvents$ = this.apiTraceDetailService.fetchLogEvents(); | ||
|
|
@@ -86,4 +96,10 @@ export class ApiTraceDetailPageComponent { | |
| public navigateToFullTrace(traceId: string, startTime: string): void { | ||
| this.navigationService.navigateWithinApp(['/trace', traceId, { startTime: startTime }]); | ||
| } | ||
|
|
||
| public getExploreNavigationParams(traceId: string): Observable<NavigationParams> { | ||
| return this.explorerService.buildNavParamsWithFilters(ScopeQueryParam.EndpointTraces, [ | ||
| { field: 'traceId', operator: FilterOperator.Equals, value: traceId } | ||
| ]); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
| import { IconType } from '@hypertrace/assets-library'; | ||
| import { NavigationService, SubscriptionLifecycle } from '@hypertrace/common'; | ||
| import { IconSize } from '@hypertrace/components'; | ||
| import { NavigationParams, NavigationService, SubscriptionLifecycle } from '@hypertrace/common'; | ||
| import { FilterOperator, IconSize } from '@hypertrace/components'; | ||
| import { Observable } from 'rxjs'; | ||
| import { LogEvent } from '../../shared/dashboard/widgets/waterfall/waterfall/waterfall-chart'; | ||
| import { ExplorerService } from '../explorer/explorer-service'; | ||
| import { ScopeQueryParam } from '../explorer/explorer.component'; | ||
| import { TraceDetails, TraceDetailService } from './trace-detail.service'; | ||
| @Component({ | ||
| styleUrls: ['./trace-detail.page.component.scss'], | ||
|
|
@@ -30,12 +32,16 @@ import { TraceDetails, TraceDetailService } from './trace-detail.service'; | |
| icon="${IconType.Time}" | ||
| [value]="traceDetails.timeString" | ||
| ></ht-summary-value> | ||
| <ht-summary-value | ||
| class="summary-value" | ||
| icon="${IconType.TraceId}" | ||
| label="Trace ID" | ||
| [value]="traceDetails.id" | ||
| ></ht-summary-value> | ||
| <ng-container *ngIf="this.getExploreNavigationParams(traceDetails.id) | async as exploreNavigationParams"> | ||
|
||
| <ht-link class="link" [paramsOrUrl]="exploreNavigationParams"> | ||
| <ht-summary-value | ||
| class="summary-value" | ||
| icon="${IconType.TraceId}" | ||
| label="Trace ID" | ||
| [value]="traceDetails.id" | ||
| ></ht-summary-value> | ||
| </ht-link> | ||
| </ng-container> | ||
|
|
||
| <div class="separation"></div> | ||
|
|
||
|
|
@@ -72,7 +78,8 @@ export class TraceDetailPageComponent { | |
|
|
||
| public constructor( | ||
| private readonly navigationService: NavigationService, | ||
| private readonly traceDetailService: TraceDetailService | ||
| private readonly traceDetailService: TraceDetailService, | ||
| private readonly explorerService: ExplorerService | ||
| ) { | ||
| this.traceDetails$ = this.traceDetailService.fetchTraceDetails(); | ||
| this.exportSpans$ = this.traceDetailService.fetchExportSpans(); | ||
|
|
@@ -82,4 +89,10 @@ export class TraceDetailPageComponent { | |
| public onClickBack(): void { | ||
| this.navigationService.navigateBack(); | ||
| } | ||
|
|
||
| public getExploreNavigationParams(traceId: string): Observable<NavigationParams> { | ||
| return this.explorerService.buildNavParamsWithFilters(ScopeQueryParam.EndpointTraces, [ | ||
| { field: 'traceId', operator: FilterOperator.Equals, value: traceId } | ||
| ]); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ import { | |
| DownloadJsonModule, | ||
| IconModule, | ||
| LabelModule, | ||
| LinkModule, | ||
| LoadAsyncModule, | ||
| NavigableTabModule, | ||
| SummaryValueModule, | ||
|
|
@@ -51,6 +52,7 @@ const ROUTE_CONFIG: HtRoute[] = [ | |
| TracingDashboardModule, | ||
| IconModule, | ||
| SummaryValueModule, | ||
| LinkModule, | ||
|
||
| TooltipModule, | ||
| LoadAsyncModule, | ||
| FormattingModule, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 nit, 1 major here:
nit - the ngIf can move down onto the link, the extra container is unnecessary.
major - calling a function to return an observable will return a new observable each time - so every cycle will be treated as a change from the async pipe's perspective. Instead, you can either assign the observable to a variable and reference that here, or use
htMemoizepipe before the async one. My guess is the former will be clearer rather than chaining pipes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1. @jyothishjose6190 since
traceDetailsitself is coming from an observable,htMemoizewould be super useful here. It would only call the method if the parameter object changes. You will find few existing examples in the product.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both this comment and the one about the link component came up in the PR to add this support on span attributes, so you could use that PR as a reference too (although there, the decision was made for styling reasons to keep the filter link and value rendered separately - not sure if the same applies here):
https://github.com/hypertrace/hypertrace-ui/pull/1079/files#diff-8912ac915c8ff140908e47b3997b34e34b6eb5a0defd418b07953b86980ba4c5R19-R24