Skip to content

Commit a15f0f4

Browse files
authored
feat: additional dependencies for time agnostic apis (#612)
* feat: additional dependencies for time agnostic apis * fix: clean up undefined checks
1 parent 9dd42c5 commit a15f0f4

File tree

7 files changed

+22
-12
lines changed

7 files changed

+22
-12
lines changed

projects/common/src/utilities/formatters/numeric/display-number.pipe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class DisplayNumberPipe implements PipeTransform {
99
private static readonly FLOAT_FORMATTER: NumericFormatter = floatFormatter;
1010

1111
public transform(value: unknown, style: FormatterStyle = FormatterStyle.Auto): string {
12-
if (value === null) {
12+
if (value === null || value === undefined) {
1313
return '-';
1414
}
1515

projects/distributed-tracing/src/shared/components/table/data-cell/metric/metric-table-cell-parser.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class MetricTableCellParser extends TableCellParserBase<number, CellValue
2525
case 'number':
2626
return cellData;
2727
case 'object':
28-
return cellData === null ? undefined : cellData.value;
28+
return cellData?.value ?? undefined;
2929
default:
3030
return undefined;
3131
}
@@ -36,12 +36,16 @@ export class MetricTableCellParser extends TableCellParserBase<number, CellValue
3636
case 'number':
3737
return undefined;
3838
case 'object':
39-
return cellData === null ? undefined : cellData.units;
39+
return cellData?.units ?? undefined;
4040
default:
4141
return undefined;
4242
}
4343
}
4444
}
4545

46-
type CellData = number | null | Partial<MetricAggregation>;
46+
type CellData = number | null | Partial<NullableValueMetricAggregation>;
4747
type CellValue = number | undefined;
48+
49+
interface NullableValueMetricAggregation extends Omit<MetricAggregation, 'value'> {
50+
value: number | null;
51+
}

projects/distributed-tracing/src/shared/components/table/data-cell/metric/metric-table-cell-renderer.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
TABLE_DATA_PARSER,
1414
TABLE_ROW_DATA
1515
} from '@hypertrace/components';
16-
import { MetricAggregation } from '../../../../../shared/graphql/model/metrics/metric-aggregation';
16+
import { MetricAggregation } from '../../../../graphql/model/metrics/metric-aggregation';
1717
import { TracingTableCellType } from '../../tracing-table-cell-type';
1818

1919
@Component({
@@ -23,10 +23,10 @@ import { TracingTableCellType } from '../../tracing-table-cell-type';
2323
template: `
2424
<div class="metric-cell" [htTooltip]="this.tooltip">
2525
<!-- This displays as "<value> <unit>", e.g. 120 ms -->
26-
<span
27-
>{{ this.value | htDisplayNumber: this.formatter }}
28-
<span *ngIf="this.value !== undefined && this.units">{{ this.units }}</span></span
26+
<span *ngIf="this.value !== undefined"
27+
>{{ this.value | htDisplayNumber: this.formatter }} <span *ngIf="this.units">{{ this.units }}</span></span
2928
>
29+
<span *ngIf="this.value === undefined">-</span>
3030
</div>
3131
`
3232
})

projects/observability/src/shared/components/entity-renderer/entity-renderer.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { EntityNavigationService } from '../../services/navigation/entity/entity
1515
class="ht-entity-renderer"
1616
[ngClass]="{ navigable: this.navigable }"
1717
[htTooltip]="this.name"
18-
(click)="this.onClickNavigate()"
18+
(click)="this.navigable && this.onClickNavigate()"
1919
>
2020
<ht-icon
2121
[icon]="this.entityIconType"

projects/observability/src/shared/components/table/data-cell/entity/entity-table-cell-parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { TableCellParser, TableCellParserBase, TableRow } from '@hypertrace/components';
22
import { Entity, entityIdKey } from '../../../../graphql/model/schema/entity';
33
import { ObservabilityTableCellType } from '../../observability-table-cell-type';
4-
import { parseEntityFromTableRow } from '../entity/entity-table-cell-renderer-util';
4+
import { parseEntityFromTableRow } from './entity-table-cell-renderer-util';
55

66
@TableCellParser({
77
type: ObservabilityTableCellType.Entity

projects/observability/src/shared/graphql/request/handlers/entities/query/entity/entity-graphql-query-handler.service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from '@hypertrace/graphql-client';
99
import { Observable } from 'rxjs';
1010
import { map, throwIfEmpty } from 'rxjs/operators';
11-
import { Entity, EntityType } from '../../../../../model/schema/entity';
11+
import { Entity, EntityType, ObservabilityEntityType } from '../../../../../model/schema/entity';
1212
import { GraphQlEntityFilter } from '../../../../../model/schema/filter/entity/graphql-entity-filter';
1313
import { EntitiesGraphqlQueryBuilderService } from '../entities-graphql-query-builder.service';
1414
import {
@@ -56,7 +56,9 @@ export class EntityGraphQlQueryHandlerService implements GraphQlQueryHandler<Gra
5656
limit: 1,
5757
timeRange: request.timeRange,
5858
properties: request.properties,
59-
filters: [new GraphQlEntityFilter(request.id, request.entityType)]
59+
filters: [new GraphQlEntityFilter(request.id, request.entityType)],
60+
// If querying for a single API, then always want to includeInactive
61+
includeInactive: request.entityType === ObservabilityEntityType.Api
6062
};
6163
}
6264
}

projects/observability/src/shared/graphql/request/handlers/entities/query/interactions/interactions-graphql-query-handler.service.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ describe('Interactions graphql query handler', () => {
9292
idType: new GraphQlEnumArgument(ObservabilityEntityType.Backend)
9393
}
9494
]
95+
},
96+
{
97+
name: 'includeInactive',
98+
value: false
9599
}
96100
],
97101
children: [

0 commit comments

Comments
 (0)