-
Notifications
You must be signed in to change notification settings - Fork 11
feat: add navigation handling for inactive entities #815
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 1 commit
4a47b52
911a4d2
bcd3d81
52781da
3fc1d42
20fafb4
f33a635
03abe7d
85604f8
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,19 +1,32 @@ | ||
| import { TableCellParser, TableCellParserBase, TableRow } from '@hypertrace/components'; | ||
| import { Entity, entityIdKey } from '../../../../graphql/model/schema/entity'; | ||
| import { ObservabilityTableCellType } from '../../observability-table-cell-type'; | ||
| import { parseEntityFromTableRow } from './entity-table-cell-renderer-util'; | ||
| import { isInactiveEntity, parseEntityFromTableRow } from './entity-table-cell-renderer-util'; | ||
|
|
||
| @TableCellParser({ | ||
| type: ObservabilityTableCellType.Entity | ||
| }) | ||
| export class EntityTableCellParser extends TableCellParserBase<CellData, CellData, string | undefined> { | ||
| public parseValue(cellData: CellData, row: TableRow): CellData { | ||
| return parseEntityFromTableRow(cellData, row); | ||
| const entity = parseEntityFromTableRow(cellData, row); | ||
|
|
||
| if (entity === undefined) { | ||
| return undefined; | ||
| } | ||
|
|
||
| return { | ||
| ...entity, | ||
| isInactive: isInactiveEntity(row) === true | ||
jake-bassett marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
| } | ||
|
|
||
| public parseFilterValue(cellData: CellData): string | undefined { | ||
| return cellData !== undefined ? cellData[entityIdKey] : undefined; | ||
| } | ||
| } | ||
|
|
||
| type CellData = Entity | undefined; | ||
| type CellData = MaybeInactiveEntity | undefined; | ||
|
|
||
| export interface MaybeInactiveEntity extends Entity { | ||
| isInactive: boolean; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,7 @@ | ||
| import { Dictionary } from '@hypertrace/common'; | ||
| import { TableRow } from '@hypertrace/components'; | ||
| import { MetricAggregation } from '@hypertrace/distributed-tracing'; | ||
| import { isNumber } from 'lodash-es'; | ||
| import { Entity, Interaction } from '../../../../graphql/model/schema/entity'; | ||
| import { EntitySpecificationBuilder } from '../../../../graphql/request/builders/specification/entity/entity-specification-builder'; | ||
|
|
||
|
|
@@ -27,3 +30,22 @@ export const parseEntityFromTableRow = (cell: Entity | undefined, row: Dictionar | |
| }; | ||
|
|
||
| const isInteraction = (neighbor: unknown): neighbor is Interaction => typeof neighbor === 'object'; | ||
|
|
||
| export const isInactiveEntity = (row: TableRow): boolean | undefined => { | ||
| const maxEndTimeAggregation = row['max(endTime)']; // Ew. | ||
|
||
|
|
||
| if (!includesMaxEndTimeAggregation(maxEndTimeAggregation)) { | ||
| // If the aggregation wasn't fetched, we have no way of knowing if this Entity is inactive. | ||
| return undefined; | ||
| } | ||
|
|
||
| return !hasValidMaxEndTimeTimestamp(maxEndTimeAggregation.value); | ||
| }; | ||
|
|
||
| const includesMaxEndTimeAggregation = (maxEndTimeAggregation?: unknown): maxEndTimeAggregation is MetricAggregation => { | ||
| return maxEndTimeAggregation !== undefined; | ||
| }; | ||
|
|
||
| const hasValidMaxEndTimeTimestamp = (maxEndTime?: unknown): maxEndTime is number => { | ||
| return maxEndTime !== undefined && isNumber(maxEndTime); | ||
| }; | ||
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.
What does inactive do? why do we need this?
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.
If an entity is inactive, it means we haven't seen any spans in the time range. Therefore, some of the screens won't show any data available and we may want to navigate to alternative pages instead for those APIs when drilled in to.
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.
So is it same as under discovery entity?
The name is not clear honestly.
navigationFunction(entityId, sourceRoute, isInactive)i guess this alternate url would be defined in the entity map?