-
Notifications
You must be signed in to change notification settings - Fork 11
feat: display exit calls breakup in span detail #724
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
eccbce7
feat: show exit calls breakup in span detail
arjunlalb e50fc26
fix: update waterfall data source
arjunlalb 6f2fc3b
fix: fix test
arjunlalb c477f9f
fix: update test
arjunlalb ecc534f
fix: fix test
arjunlalb fb59931
fix: updates
arjunlalb e634aa3
fix: update test
arjunlalb febefcf
fix: remove comment line
arjunlalb 2268f38
Merge branch 'main' into exit-calls-breakup
arjunlalb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
...ed-tracing/src/shared/components/span-detail/exit-calls/span-exit-calls.component.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
| import { fakeAsync } from '@angular/core/testing'; | ||
| import { ActivatedRoute } from '@angular/router'; | ||
| import { IconLibraryTestingModule } from '@hypertrace/assets-library'; | ||
| import { NavigationService } from '@hypertrace/common'; | ||
| import { runFakeRxjs } from '@hypertrace/test-utils'; | ||
| import { createHostFactory, mockProvider, Spectator } from '@ngneat/spectator/jest'; | ||
| import { EMPTY } from 'rxjs'; | ||
| import { SpanExitCallsComponent } from './span-exit-calls.component'; | ||
| import { SpanExitCallsModule } from './span-exit-calls.module'; | ||
|
|
||
| describe('SpanExitCallsComponent', () => { | ||
| let spectator: Spectator<SpanExitCallsComponent>; | ||
|
|
||
| const createHost = createHostFactory({ | ||
| component: SpanExitCallsComponent, | ||
| imports: [SpanExitCallsModule, HttpClientTestingModule, IconLibraryTestingModule], | ||
| declareComponent: false, | ||
| providers: [ | ||
| mockProvider(ActivatedRoute, { | ||
| queryParamMap: EMPTY | ||
| }), | ||
| mockProvider(NavigationService, { | ||
| navigation$: EMPTY | ||
| }) | ||
| ] | ||
| }); | ||
|
|
||
| it('should render data correctly', fakeAsync(() => { | ||
| spectator = createHost(`<ht-span-exit-calls [exitCalls]="exitCalls"></ht-span-exit-calls>`, { | ||
| hostProps: { exitCalls: { 'name 1': '10', 'name 2': '11' } } | ||
| }); | ||
|
|
||
| runFakeRxjs(({ expectObservable }) => { | ||
| expect(spectator.component.dataSource).toBeDefined(); | ||
| expectObservable(spectator.component.dataSource!.getData(undefined!)).toBe('(x|)', { | ||
| x: { | ||
| data: [ | ||
| { name: 'name 1', calls: '10' }, | ||
| { name: 'name 2', calls: '11' } | ||
| ], | ||
| totalCount: 2 | ||
| } | ||
| }); | ||
| }); | ||
| })); | ||
| }); | ||
52 changes: 52 additions & 0 deletions
52
...ributed-tracing/src/shared/components/span-detail/exit-calls/span-exit-calls.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; | ||
| import { Dictionary } from '@hypertrace/common'; | ||
| import { TableColumnConfig, TableDataResponse, TableDataSource, TableRow } from '@hypertrace/components'; | ||
| import { Observable, of } from 'rxjs'; | ||
|
|
||
| @Component({ | ||
| selector: 'ht-span-exit-calls', | ||
| changeDetection: ChangeDetectionStrategy.OnPush, | ||
| template: `<div class="span-exit-calls"> | ||
| <ht-table [columnConfigs]="this.columnConfigs" [data]="this.dataSource" [pageable]="false"></ht-table> | ||
| </div> ` | ||
| }) | ||
| export class SpanExitCallsComponent implements OnInit { | ||
| @Input() | ||
| public exitCalls?: Dictionary<string>; | ||
|
|
||
| public dataSource?: TableDataSource<TableRow>; | ||
| public columnConfigs: TableColumnConfig[] = [ | ||
| { | ||
| id: 'name', | ||
| name: 'name', | ||
| title: 'Service', | ||
| visible: true, | ||
| width: '80%', | ||
| sortable: false, | ||
| filterable: false | ||
| }, | ||
| { | ||
| id: 'calls', | ||
| name: 'calls', | ||
| title: 'Calls', | ||
| visible: true, | ||
| sortable: false, | ||
| filterable: false | ||
| } | ||
| ]; | ||
|
|
||
| public ngOnInit(): void { | ||
| this.buildDataSource(); | ||
| } | ||
|
|
||
| private buildDataSource(): void { | ||
| this.dataSource = { | ||
| getData: (): Observable<TableDataResponse<TableRow>> => | ||
| of({ | ||
| data: Object.entries(this.exitCalls ?? {}).map(item => ({ name: item[0], calls: item[1] })), | ||
| totalCount: Object.keys(this.exitCalls ?? {}).length | ||
| }), | ||
| getScope: () => undefined | ||
| }; | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
...istributed-tracing/src/shared/components/span-detail/exit-calls/span-exit-calls.module.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { CommonModule } from '@angular/common'; | ||
| import { NgModule } from '@angular/core'; | ||
| import { TableModule } from '@hypertrace/components'; | ||
| import { SpanExitCallsComponent } from './span-exit-calls.component'; | ||
|
|
||
| @NgModule({ | ||
| declarations: [SpanExitCallsComponent], | ||
| exports: [SpanExitCallsComponent], | ||
| imports: [CommonModule, TableModule] | ||
| }) | ||
| export class SpanExitCallsModule {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
...cing/src/shared/dashboard/widgets/trace-detail/data/api-trace-detail-data-source.model.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,29 @@ | ||
| import { Model } from '@hypertrace/hyperdash'; | ||
| import { Trace, traceIdKey } from '../../../../graphql/model/schema/trace'; | ||
|
|
||
| import { Dictionary } from '@hypertrace/common'; | ||
| import { TraceDetailData, TraceDetailDataSourceModel } from './trace-detail-data-source.model'; | ||
|
|
||
| @Model({ | ||
| type: 'api-trace-detail-data-source' | ||
| }) | ||
| export class ApiTraceDetailDataSourceModel extends TraceDetailDataSourceModel { | ||
| protected getTraceAttributes(): string[] { | ||
| // TODO : request for 'apiCalleeNameCount' here | ||
arjunlalb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return [...super.getTraceAttributes(), 'traceId']; | ||
| } | ||
|
|
||
| protected constructTraceDetailData(trace: Trace): ApiTraceDetailData { | ||
| return { | ||
| ...super.constructTraceDetailData(trace), | ||
| traceId: trace.traceId as string, // For API Trace traceId is real Trace ID. NOT Symbol('traceId'). | ||
| entrySpanId: trace[traceIdKey] // API Trace Symbol('traceId') same as apiTraceId which is actually Entry Span ID | ||
| entrySpanId: trace[traceIdKey], // API Trace Symbol('traceId') same as apiTraceId which is actually Entry Span ID, | ||
| exitCallsBreakup: trace.exitCallsBreakup as Dictionary<string> | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| export interface ApiTraceDetailData extends TraceDetailData { | ||
| entrySpanId: string; | ||
| exitCallsBreakup: Dictionary<string>; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.