-
Notifications
You must be signed in to change notification settings - Fork 11
feat: show exit calls break up on hover on exit calls cell in trace list #756
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 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c13757a
feat: show exit calls break up on hover on exit calls cell in trace list
itssharmasandeep 040f804
Merge branch 'main' into exit-calls
itssharmasandeep b92bbea
fix: addressing pull request comments
itssharmasandeep d56cb57
fix: lint errors
itssharmasandeep 1f2f9d1
fix: addressing review commnet
itssharmasandeep 5d5126d
Merge branch 'main' into exit-calls
itssharmasandeep 1c394d6
chore: using composite specification
itssharmasandeep 0584eb7
fix: lint errors and tests
itssharmasandeep 541751a
fix: lint errors
itssharmasandeep b0c8c46
Merge branch 'main' into exit-calls
itssharmasandeep 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,11 +14,10 @@ import { | |
| } from '@hypertrace/components'; | ||
| import { Trace } from '@hypertrace/distributed-tracing'; | ||
| import { ExploreValue } from '@hypertrace/observability'; | ||
|
|
||
| export const EXIT_CALLS_CELL = 'EXIT_CALLS_CELL'; | ||
| import { ObservabilityTableCellType } from '../../observability-table-cell-type'; | ||
|
|
||
| @Component({ | ||
| selector: 'exit-calls-table-cell-renderer', | ||
| selector: 'ht-exit-calls-table-cell-renderer', | ||
| styleUrls: ['./exit-calls-table-cell-renderer.component.scss'], | ||
| changeDetection: ChangeDetectionStrategy.OnPush, | ||
| template: ` | ||
|
|
@@ -27,15 +26,15 @@ export const EXIT_CALLS_CELL = 'EXIT_CALLS_CELL'; | |
|
|
||
| <ng-template #exitCallsTooltip> | ||
| <ng-container *ngIf="this.apiExitCalls > 0"> | ||
|
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. nit: This is an if-else use case. You can clean this up like below. There are many examples in the codebase. |
||
| <div *ngFor="let item of this.apiCalleeNameCount | keyvalue" class="api-callee-name-count"> | ||
| <span class="api-callee-name">{{ item.key }}</span> | ||
| <span class="api-callee-count">{{ item.value }}</span> | ||
| <div *ngFor="let item of this.apiCalleeNameCount" class="api-callee-name-count"> | ||
| <span class="api-callee-name">{{ item[0] }}</span> | ||
| <span class="api-callee-count">{{ item[1] }}</span> | ||
| </div> | ||
| <div | ||
| *ngIf="this.totalCountOfDifferentAPICallee > this.maxShowAPICalleeNameCount" | ||
| *ngIf="this.totalCountOfDifferentApiCallee > this.maxShowApiCalleeNameCount" | ||
| class="remaining-api-callee" | ||
| > | ||
| and {{ this.totalCountOfDifferentAPICallee - this.maxShowAPICalleeNameCount }} more | ||
| and {{ this.totalCountOfDifferentApiCallee - this.maxShowApiCalleeNameCount }} more | ||
| </div> | ||
| </ng-container> | ||
| <ng-container *ngIf="this.apiExitCalls <= 0" class="no-exit-calls">No exit calls</ng-container> | ||
|
|
@@ -44,15 +43,15 @@ export const EXIT_CALLS_CELL = 'EXIT_CALLS_CELL'; | |
| ` | ||
| }) | ||
| @TableCellRenderer({ | ||
| type: EXIT_CALLS_CELL, | ||
| type: ObservabilityTableCellType.ExitCalls, | ||
| alignment: TableCellAlignmentType.Left, | ||
| parser: CoreTableCellParserType.NoOp | ||
| }) | ||
| export class ExitCallsTableCellRendererComponent extends TableCellRendererBase<ExploreValue, any> implements OnInit { | ||
| public readonly apiCalleeNameCount: any; | ||
| export class ExitCallsTableCellRendererComponent extends TableCellRendererBase<ExploreValue, Trace> implements OnInit { | ||
| public readonly apiCalleeNameCount: string[][]; | ||
| public readonly apiExitCalls: number; | ||
| public readonly maxShowAPICalleeNameCount: number = 10; | ||
| public totalCountOfDifferentAPICallee!: number; | ||
| public readonly maxShowApiCalleeNameCount: number = 10; | ||
| public readonly totalCountOfDifferentApiCallee!: number; | ||
|
|
||
| public constructor( | ||
| @Inject(TABLE_COLUMN_CONFIG) columnConfig: TableColumnConfig, | ||
|
|
@@ -62,23 +61,9 @@ export class ExitCallsTableCellRendererComponent extends TableCellRendererBase<E | |
| @Inject(TABLE_ROW_DATA) rowData: Trace | ||
| ) { | ||
| super(columnConfig, index, parser, cellData, rowData); | ||
| this.apiCalleeNameCount = this.getMaxShowAPICalleeNameCount(rowData.apiCalleeNameCount); | ||
| const apiCalleeNameCount: string[][] = Object.entries(Object(rowData.apiCalleeNameCount)); | ||
aaron-steinfeld marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| this.totalCountOfDifferentApiCallee = apiCalleeNameCount.length; | ||
| this.apiCalleeNameCount = apiCalleeNameCount.slice(0, this.maxShowApiCalleeNameCount); | ||
| this.apiExitCalls = Number(rowData.apiExitCalls); | ||
aaron-steinfeld marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| public getMaxShowAPICalleeNameCount(apiCalleeNameCount: any): any { | ||
| if (apiCalleeNameCount) { | ||
| const showAPICalleeNameCount: any = {}; | ||
| let count = 0; | ||
| Object.keys(apiCalleeNameCount).forEach((key: string) => { | ||
| if (count < this.maxShowAPICalleeNameCount) { | ||
| showAPICalleeNameCount[key] = apiCalleeNameCount[key]; | ||
| count++; | ||
| } | ||
| }); | ||
| this.totalCountOfDifferentAPICallee = Object.keys(apiCalleeNameCount).length; | ||
| return showAPICalleeNameCount; | ||
| } | ||
| return {}; | ||
| } | ||
| } | ||
3 changes: 2 additions & 1 deletion
3
projects/observability/src/shared/components/table/observability-table-cell-type.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,4 +1,5 @@ | ||
| export const enum ObservabilityTableCellType { | ||
| Entity = 'entity', | ||
| BackendIcon = 'backend-icon' | ||
| BackendIcon = 'backend-icon', | ||
| ExitCalls = 'exit-calls' | ||
| } |
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.
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.
This test has value, but what would be even better would be to verify that this data renders - for example by querying for the rendered spans and checking their content (e.g.
expect(spectator.queryAll('.api-callee-name')[0]).toContainText('key1');)That checks both how the data is processed but also that the template is correctly binding what we expect.
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.
Okay, this change I can make.
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.
Nevermind, discussed offline - because this is a template that's not rendered in the scope of this component, it's ugly to test and not worth it.