Skip to content

Commit 185c6fd

Browse files
authored
refactor: migrating to new topology custom metric (#1000)
* feat: adding topology custom metric model and service * refactor: migrating to new topology custom metric * refactor: adding test * refactor: adding tests * refactor: fixing test
1 parent a75a8f5 commit 185c6fd

14 files changed

+682
-486
lines changed

projects/observability/src/pages/apis/topology/application-flow.component.ts

Lines changed: 180 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import { ChangeDetectionStrategy, Component } from '@angular/core';
22
import { MetricAggregationType } from '@hypertrace/distributed-tracing';
33
import { ModelJson } from '@hypertrace/hyperdash';
4+
import {
5+
defaultPrimaryEdgeMetricCategories,
6+
defaultSecondaryEdgeMetricCategories
7+
} from './../../../shared/dashboard/widgets/topology/metric/edge-metric-category';
8+
import {
9+
defaultPrimaryNodeMetricCategories,
10+
defaultSecondaryNodeMetricCategories
11+
} from './../../../shared/dashboard/widgets/topology/metric/node-metric-category';
412

513
@Component({
614
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -26,78 +34,182 @@ export class ApplicationFlowComponent {
2634
type: 'topology-data-source',
2735
entity: 'SERVICE',
2836
'downstream-entities': ['SERVICE', 'BACKEND'],
29-
'node-metrics': [
30-
{
31-
type: 'percentile-latency-metric-aggregation',
32-
'display-name': 'P99 Latency'
37+
'edge-metrics': {
38+
type: 'topology-metrics',
39+
primary: {
40+
type: 'topology-metric-with-category',
41+
specification: {
42+
type: 'percentile-latency-metric-aggregation',
43+
'display-name': 'P99 Latency'
44+
},
45+
categories: [
46+
{
47+
type: 'topology-metric-category',
48+
...defaultPrimaryEdgeMetricCategories[0]
49+
},
50+
{
51+
type: 'topology-metric-category',
52+
...defaultPrimaryEdgeMetricCategories[1]
53+
},
54+
{
55+
type: 'topology-metric-category',
56+
...defaultPrimaryEdgeMetricCategories[2]
57+
},
58+
{
59+
type: 'topology-metric-category',
60+
...defaultPrimaryEdgeMetricCategories[3]
61+
},
62+
{
63+
type: 'topology-metric-category',
64+
...defaultPrimaryEdgeMetricCategories[4]
65+
}
66+
]
3367
},
34-
{
35-
type: 'metric-aggregation',
36-
metric: 'duration',
37-
aggregation: MetricAggregationType.P50,
38-
'display-name': 'P50 Latency'
68+
secondary: {
69+
type: 'topology-metric-with-category',
70+
specification: {
71+
type: 'error-percentage-metric-aggregation',
72+
aggregation: MetricAggregationType.Average,
73+
'display-name': 'Error %'
74+
},
75+
categories: [
76+
{
77+
type: 'topology-metric-category',
78+
...defaultSecondaryEdgeMetricCategories[0]
79+
},
80+
{
81+
type: 'topology-metric-category',
82+
...defaultSecondaryEdgeMetricCategories[1]
83+
}
84+
]
3985
},
40-
{
41-
type: 'error-percentage-metric-aggregation',
42-
aggregation: MetricAggregationType.Average,
43-
'display-name': 'Error %'
86+
others: [
87+
{
88+
type: 'topology-metric-with-category',
89+
specification: {
90+
type: 'metric-aggregation',
91+
metric: 'duration',
92+
aggregation: MetricAggregationType.P50,
93+
'display-name': 'P50 Latency'
94+
}
95+
},
96+
{
97+
type: 'topology-metric-with-category',
98+
specification: {
99+
type: 'metric-aggregation',
100+
metric: 'errorCount',
101+
aggregation: MetricAggregationType.Sum,
102+
'display-name': 'Error Count'
103+
}
104+
},
105+
{
106+
type: 'topology-metric-with-category',
107+
specification: {
108+
type: 'metric-aggregation',
109+
metric: 'numCalls',
110+
aggregation: MetricAggregationType.AvgrateSecond,
111+
'display-name': 'Call Rate/sec'
112+
}
113+
},
114+
{
115+
type: 'topology-metric-with-category',
116+
specification: {
117+
type: 'metric-aggregation',
118+
metric: 'numCalls',
119+
aggregation: MetricAggregationType.Sum,
120+
'display-name': 'Call Count'
121+
}
122+
}
123+
]
124+
},
125+
'node-metrics': {
126+
type: 'topology-metrics',
127+
primary: {
128+
type: 'topology-metric-with-category',
129+
specification: {
130+
type: 'percentile-latency-metric-aggregation',
131+
'display-name': 'P99 Latency'
132+
},
133+
categories: [
134+
{
135+
type: 'topology-metric-category',
136+
...defaultPrimaryNodeMetricCategories[0]
137+
},
138+
{
139+
type: 'topology-metric-category',
140+
...defaultPrimaryNodeMetricCategories[1]
141+
},
142+
{
143+
type: 'topology-metric-category',
144+
...defaultPrimaryNodeMetricCategories[2]
145+
},
146+
{
147+
type: 'topology-metric-category',
148+
...defaultPrimaryNodeMetricCategories[3]
149+
},
150+
{
151+
type: 'topology-metric-category',
152+
...defaultPrimaryNodeMetricCategories[4]
153+
}
154+
]
44155
},
45-
46-
{
47-
type: 'metric-aggregation',
48-
metric: 'errorCount',
49-
aggregation: MetricAggregationType.Sum,
50-
'display-name': 'Error Count'
51-
},
52-
{
53-
type: 'metric-aggregation',
54-
metric: 'numCalls',
55-
aggregation: MetricAggregationType.AvgrateSecond,
56-
'display-name': 'Call Rate/sec'
57-
},
58-
{
59-
type: 'metric-aggregation',
60-
metric: 'numCalls',
61-
aggregation: MetricAggregationType.Sum,
62-
'display-name': 'Call Count'
63-
}
64-
],
65-
'edge-metrics': [
66-
{
67-
type: 'percentile-latency-metric-aggregation',
68-
'display-name': 'P99 Latency'
69-
},
70-
{
71-
type: 'metric-aggregation',
72-
metric: 'duration',
73-
aggregation: MetricAggregationType.P50,
74-
'display-name': 'P50 Latency'
75-
},
76-
{
77-
type: 'error-percentage-metric-aggregation',
78-
aggregation: MetricAggregationType.Average,
79-
'display-name': 'Error %'
80-
},
81-
82-
{
83-
type: 'metric-aggregation',
84-
metric: 'errorCount',
85-
aggregation: MetricAggregationType.Sum,
86-
'display-name': 'Error Count'
87-
},
88-
{
89-
type: 'metric-aggregation',
90-
metric: 'numCalls',
91-
aggregation: MetricAggregationType.AvgrateSecond,
92-
'display-name': 'Call Rate/sec'
156+
secondary: {
157+
type: 'topology-metric-with-category',
158+
specification: {
159+
type: 'error-percentage-metric-aggregation',
160+
aggregation: MetricAggregationType.Average,
161+
'display-name': 'Error %'
162+
},
163+
categories: [
164+
{
165+
type: 'topology-metric-category',
166+
...defaultSecondaryNodeMetricCategories[0]
167+
},
168+
{
169+
type: 'topology-metric-category',
170+
...defaultSecondaryNodeMetricCategories[1]
171+
}
172+
]
93173
},
94-
{
95-
type: 'metric-aggregation',
96-
metric: 'numCalls',
97-
aggregation: MetricAggregationType.Sum,
98-
'display-name': 'Call Count'
99-
}
100-
]
174+
others: [
175+
{
176+
type: 'topology-metric-with-category',
177+
specification: {
178+
type: 'metric-aggregation',
179+
metric: 'duration',
180+
aggregation: MetricAggregationType.P50,
181+
'display-name': 'P50 Latency'
182+
}
183+
},
184+
{
185+
type: 'topology-metric-with-category',
186+
specification: {
187+
type: 'metric-aggregation',
188+
metric: 'errorCount',
189+
aggregation: MetricAggregationType.Sum,
190+
'display-name': 'Error Count'
191+
}
192+
},
193+
{
194+
type: 'topology-metric-with-category',
195+
specification: {
196+
type: 'metric-aggregation',
197+
metric: 'numCalls',
198+
aggregation: MetricAggregationType.AvgrateSecond,
199+
'display-name': 'Call Rate/sec'
200+
}
201+
},
202+
{
203+
type: 'topology-metric-with-category',
204+
specification: {
205+
type: 'metric-aggregation',
206+
metric: 'numCalls',
207+
aggregation: MetricAggregationType.Sum,
208+
'display-name': 'Call Count'
209+
}
210+
}
211+
]
212+
}
101213
}
102214
}
103215
]

projects/observability/src/shared/dashboard/data/graphql/observability-graphql-data-source.module.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ import { PercentileLatencyAggregationSpecificationModel } from './specifiers/per
2828
import { EntityTableDataSourceModel } from './table/entity/entity-table-data-source.model';
2929
import { ExploreTableDataSourceModel } from './table/explore/explore-table-data-source.model';
3030
import { InteractionsTableDataSourceModel } from './table/interactions/interactions-table-data-source.model';
31+
import { TopologyMetricCategoryModel } from './topology/metrics/topology-metric-category.model';
32+
import { TopologyMetricWithCategoryModel } from './topology/metrics/topology-metric-with-category.model';
33+
import { TopologyMetricsModel } from './topology/metrics/topology-metrics.model';
3134
import { TopologyDataSourceModel } from './topology/topology-data-source.model';
3235
import { TraceMetricAggregationDataSourceModel } from './trace/aggregation/trace-metric-aggregation-data-source.model';
3336
import { TraceDonutDataSourceModel } from './trace/donut/trace-donut-data-source.model';
@@ -53,6 +56,9 @@ import { ApiTraceWaterfallDataSourceModel } from './waterfall/api-trace-waterfal
5356
EntityMetricTimeseriesDataSourceModel,
5457
EntityMetricAggregationDataSourceModel,
5558
TopologyDataSourceModel,
59+
TopologyMetricsModel,
60+
TopologyMetricWithCategoryModel,
61+
TopologyMetricCategoryModel,
5662
EntityTableDataSourceModel,
5763
InteractionsTableDataSourceModel,
5864
EntityAttributeDataSourceModel,

0 commit comments

Comments
 (0)