-
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 7 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,12 @@ | ||||||
| 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 { ApiTraceDetails } from '../api-trace-detail/api-trace-detail.service'; | ||||||
| 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 +33,18 @@ 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> | ||||||
| <ht-explore-filter-link | ||||||
| class="filter-link" | ||||||
| [paramsOrUrl]="getExplorerNavigationParams | htMemoize: traceDetails | async" | ||||||
| htTooltip="See traces in Explorer" | ||||||
| > | ||||||
| <ht-summary-value | ||||||
| class="summary-value" | ||||||
| icon="${IconType.TraceId}" | ||||||
| label="Trace ID" | ||||||
| [value]="traceDetails.id" | ||||||
| ></ht-summary-value> | ||||||
| </ht-explore-filter-link> | ||||||
|
|
||||||
| <div class="separation"></div> | ||||||
|
|
||||||
|
|
@@ -72,7 +81,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 +92,9 @@ export class TraceDetailPageComponent { | |||||
| public onClickBack(): void { | ||||||
| this.navigationService.navigateBack(); | ||||||
| } | ||||||
|
|
||||||
| public getExplorerNavigationParams = (traceDetails: ApiTraceDetails | undefined): Observable<NavigationParams> => | ||||||
|
||||||
| public getExplorerNavigationParams = (traceDetails: ApiTraceDetails | undefined): Observable<NavigationParams> => | |
| public getExplorerNavigationParams = (traceDetails: TraceDetails): Observable<NavigationParams> => |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,19 @@ | ||
| import { CommonModule } from '@angular/common'; | ||
| import { NgModule } from '@angular/core'; | ||
| import { RouterModule } from '@angular/router'; | ||
| import { FormattingModule, HtRoute } from '@hypertrace/common'; | ||
| import { FormattingModule, HtRoute, MemoizeModule } from '@hypertrace/common'; | ||
| import { | ||
| CopyShareableLinkToClipboardModule, | ||
| DownloadJsonModule, | ||
| IconModule, | ||
| LabelModule, | ||
| LinkModule, | ||
| LoadAsyncModule, | ||
| NavigableTabModule, | ||
| SummaryValueModule, | ||
| TooltipModule | ||
| } from '@hypertrace/components'; | ||
| import { ExploreFilterLinkModule } from '../../shared/components/explore-filter-link/explore-filter-link.module'; | ||
| import { LogEventsTableModule } from '../../shared/components/log-events/log-events-table.module'; | ||
| import { NavigableDashboardModule } from '../../shared/dashboard/dashboard-wrapper/navigable-dashboard.module'; | ||
| import { TracingDashboardModule } from '../../shared/dashboard/tracing-dashboard.module'; | ||
|
|
@@ -47,10 +49,13 @@ const ROUTE_CONFIG: HtRoute[] = [ | |
| imports: [ | ||
| RouterModule.forChild(ROUTE_CONFIG), | ||
| CommonModule, | ||
| ExploreFilterLinkModule, | ||
| LabelModule, | ||
| TracingDashboardModule, | ||
| IconModule, | ||
| SummaryValueModule, | ||
| LinkModule, | ||
|
||
| MemoizeModule, | ||
| TooltipModule, | ||
| LoadAsyncModule, | ||
| FormattingModule, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,11 @@ | ||
| import { MemoizeModule } from '@hypertrace/common'; | ||
| import { LoadAsyncModule, OverlayService } from '@hypertrace/components'; | ||
| import { mockDashboardWidgetProviders } from '@hypertrace/dashboards/testing'; | ||
| import { createComponentFactory, mockProvider } from '@ngneat/spectator/jest'; | ||
| import { MockComponent } from 'ng-mocks'; | ||
| import { of } from 'rxjs'; | ||
| import { ExplorerService } from '../../../../pages/explorer/explorer-service'; | ||
| import { ExploreFilterLinkComponent } from '../../../components/explore-filter-link/explore-filter-link.component'; | ||
| import { WaterfallWidgetRendererComponent } from './waterfall-widget-renderer.component'; | ||
| import { WaterfallChartComponent } from './waterfall/waterfall-chart.component'; | ||
|
|
||
|
|
@@ -14,9 +17,13 @@ describe('Waterfall widget renderer component', () => { | |
| const createComponent = createComponentFactory<WaterfallWidgetRendererComponent>({ | ||
| component: WaterfallWidgetRendererComponent, | ||
| shallow: true, | ||
| imports: [LoadAsyncModule], | ||
| providers: [...mockDashboardWidgetProviders(mockModel), mockProvider(OverlayService)], | ||
| declarations: [MockComponent(WaterfallChartComponent)] | ||
| imports: [LoadAsyncModule, MemoizeModule], | ||
| providers: [ | ||
| ...mockDashboardWidgetProviders(mockModel), | ||
| mockProvider(OverlayService), | ||
| mockProvider(ExplorerService) | ||
| ], | ||
| declarations: [MockComponent(WaterfallChartComponent), MockComponent(ExploreFilterLinkComponent)] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add some tests for this? (and in the other components) |
||
| }); | ||
|
|
||
| test('renders the widget', () => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,12 +8,15 @@ import { | |
| ViewChild | ||
| } from '@angular/core'; | ||
| import { IconType } from '@hypertrace/assets-library'; | ||
| import { ButtonStyle, OverlayService, SheetRef, SheetSize } from '@hypertrace/components'; | ||
| import { NavigationParams } from '@hypertrace/common'; | ||
| import { ButtonStyle, FilterOperator, OverlayService, SheetRef, SheetSize } from '@hypertrace/components'; | ||
| import { WidgetRenderer } from '@hypertrace/dashboards'; | ||
| import { Renderer } from '@hypertrace/hyperdash'; | ||
| import { RendererApi, RENDERER_API } from '@hypertrace/hyperdash-angular'; | ||
| import { isEmpty } from 'lodash-es'; | ||
| import { Observable } from 'rxjs'; | ||
| import { ExplorerService } from '../../../../pages/explorer/explorer-service'; | ||
| import { ScopeQueryParam } from '../../../../pages/explorer/explorer.component'; | ||
| import { SpanDetailLayoutStyle } from '../../../components/span-detail/span-detail-layout-style'; | ||
| import { SpanDetailTab } from '../../../components/span-detail/span-detail-tab'; | ||
| import { WaterfallWidgetModel } from './waterfall-widget.model'; | ||
|
|
@@ -67,12 +70,18 @@ import { MarkerSelection, WaterfallChartComponent } from './waterfall/waterfall- | |
| [activeTabLabel]="this.activeTabLabel" | ||
| (closed)="this.closeSheet()" | ||
| > | ||
| <ht-summary-value | ||
| data-sensitive-pii | ||
| icon="${IconType.SpanId}" | ||
| label="Span ID" | ||
| [value]="this.selectedData!.id" | ||
| ></ht-summary-value> | ||
| <ht-explore-filter-link | ||
| class="filter-link" | ||
| [paramsOrUrl]="getExploreNavigationParams | htMemoize: this.selectedData | async" | ||
| htTooltip="See traces in Explorer" | ||
|
||
| > | ||
| <ht-summary-value | ||
| data-sensitive-pii | ||
| icon="${IconType.SpanId}" | ||
| label="Span ID" | ||
| [value]="this.selectedData!.id" | ||
| ></ht-summary-value> | ||
| </ht-explore-filter-link> | ||
| </ht-span-detail> | ||
| </div> | ||
| </ng-template> | ||
|
|
@@ -94,7 +103,8 @@ export class WaterfallWidgetRendererComponent | |
| public constructor( | ||
| @Inject(RENDERER_API) api: RendererApi<WaterfallWidgetModel>, | ||
| changeDetector: ChangeDetectorRef, | ||
| private readonly overlayService: OverlayService | ||
| private readonly overlayService: OverlayService, | ||
| private readonly explorerService: ExplorerService | ||
| ) { | ||
| super(api, changeDetector); | ||
| } | ||
|
|
@@ -141,4 +151,9 @@ export class WaterfallWidgetRendererComponent | |
| protected fetchData(): Observable<WaterfallData[]> { | ||
| return this.model.getData(); | ||
| } | ||
|
|
||
| public getExploreNavigationParams = (selectedData: WaterfallData | undefined): Observable<NavigationParams> => | ||
| this.explorerService.buildNavParamsWithFilters(ScopeQueryParam.Spans, [ | ||
| { field: 'id', operator: FilterOperator.Equals, value: selectedData!.id } | ||
| ]); | ||
| } | ||
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.
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