Skip to content

Commit 3b83b23

Browse files
authored
Merge branch 'main' into select-add-selected-label
2 parents 8be62ff + abcfcad commit 3b83b23

File tree

10 files changed

+187
-10
lines changed

10 files changed

+187
-10
lines changed

projects/distributed-tracing/src/shared/dashboard/dashboard-wrapper/navigable-dashboard.component.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
2-
import { TypedSimpleChanges } from '@hypertrace/common';
2+
import { Dictionary, TypedSimpleChanges } from '@hypertrace/common';
33
import { Filter } from '@hypertrace/components';
44
import { DashboardPersistenceService } from '@hypertrace/dashboards';
55
import { Dashboard, ModelJson } from '@hypertrace/hyperdash';
@@ -37,10 +37,13 @@ import { GraphQlFilterDataSourceModel } from '../data/graphql/filter/graphql-fil
3737
})
3838
export class NavigableDashboardComponent implements OnChanges {
3939
@Input()
40-
public readonly defaultJson?: ModelJson;
40+
public navLocation?: string | null;
4141

4242
@Input()
43-
public navLocation?: string | null;
43+
public defaultJson?: ModelJson;
44+
45+
@Input()
46+
public variables?: Dictionary<unknown>;
4447

4548
@Input()
4649
public filterConfig?: NavigableDashboardFilterConfig;
@@ -89,6 +92,7 @@ export class NavigableDashboardComponent implements OnChanges {
8992

9093
public onDashboardReady(dashboard: Dashboard): void {
9194
this.dashboard = dashboard;
95+
this.applyVariablesToDashboard(this.dashboard, this.variables);
9296
this.applyFiltersToDashboard(dashboard, this.explicitFilters);
9397
this.dashboardReady.emit(dashboard);
9498
}
@@ -100,6 +104,12 @@ export class NavigableDashboardComponent implements OnChanges {
100104
}
101105
}
102106

107+
public applyVariablesToDashboard(dashboard: Dashboard, variables: Dictionary<unknown> = {}): void {
108+
for (const key of Object.keys(variables)) {
109+
dashboard.setVariable(key, variables[key]);
110+
}
111+
}
112+
103113
public applyFiltersToDashboard(dashboard: Dashboard, explicitFilters: Filter[]): void {
104114
const rootDataSource = dashboard.getRootDataSource<GraphQlFilterDataSourceModel>();
105115
rootDataSource

projects/observability/src/pages/apis/api-detail/metrics/api-metrics.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ReplayObservable } from '@hypertrace/common';
33
import { NavigableDashboardFilterConfig } from '@hypertrace/distributed-tracing';
44
import { map } from 'rxjs/operators';
55
import { ApiDetailService } from '../api-detail.service';
6-
import { apiMetricsDashboard } from './api-metrics-dashboard';
6+
import { apiMetricsDashboard } from './api-metrics.dashboard';
77

88
@Component({
99
changeDetection: ChangeDetectionStrategy.OnPush,

projects/observability/src/pages/apis/api-detail/metrics/api-metrics-dashboard.ts renamed to projects/observability/src/pages/apis/api-detail/metrics/api-metrics.dashboard.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,22 @@ export const apiMetricsDashboard: DashboardDefaultConfiguration = {
200200
'color-palette': RED_COLOR_PALETTE,
201201
'selectable-interval': true,
202202
'legend-position': LegendPosition.TopLeft,
203+
bands: [
204+
{
205+
type: 'band',
206+
name: 'Average Baseline',
207+
'upper-bound-name': 'Average Upper Bound',
208+
'lower-bound-name': 'Average Lower Bound',
209+
data: {
210+
type: 'entity-metric-timeseries-data-source',
211+
metric: {
212+
type: 'metric-timeseries-band',
213+
metric: 'duration',
214+
aggregation: MetricAggregationType.Average
215+
}
216+
}
217+
}
218+
],
203219
series: [
204220
{
205221
type: 'series',
@@ -321,6 +337,22 @@ export const apiMetricsDashboard: DashboardDefaultConfiguration = {
321337
'legend-position': LegendPosition.None,
322338
'show-summary': true,
323339
title: 'Error Rate',
340+
bands: [
341+
{
342+
type: 'band',
343+
name: 'Baseline',
344+
'upper-bound-name': 'Upper Bound',
345+
'lower-bound-name': 'Lower Bound',
346+
data: {
347+
type: 'entity-metric-timeseries-data-source',
348+
metric: {
349+
type: 'metric-timeseries-band',
350+
metric: 'errorCount',
351+
aggregation: MetricAggregationType.AvgrateSecond
352+
}
353+
}
354+
}
355+
],
324356
series: [
325357
{
326358
type: 'series',

projects/observability/src/pages/apis/api-detail/metrics/api-metrics.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { NgModule } from '@angular/core';
33
import { FilterBarModule, LoadAsyncModule } from '@hypertrace/components';
44
import { NavigableDashboardModule } from '@hypertrace/distributed-tracing';
55
import { ObservabilityDashboardModule } from '../../../../shared/dashboard/observability-dashboard.module';
6-
import { apiMetricsDashboard } from './api-metrics-dashboard';
76
import { ApiMetricsComponent } from './api-metrics.component';
7+
import { apiMetricsDashboard } from './api-metrics.dashboard';
88

99
@NgModule({
1010
imports: [

projects/observability/src/pages/apis/api-detail/overview/api-overview.dashboard.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,22 @@ export const apiOverviewDashboard: DashboardDefaultConfiguration = {
211211
'min-upper-limit': 25
212212
},
213213
'max-series-data-points': 150,
214+
bands: [
215+
{
216+
type: 'band',
217+
name: 'P99 Baseline',
218+
'upper-bound-name': 'P99 Upper Bound',
219+
'lower-bound-name': 'P99 Lower Bound',
220+
data: {
221+
type: 'entity-metric-timeseries-data-source',
222+
metric: {
223+
type: 'metric-timeseries-band',
224+
metric: 'duration',
225+
aggregation: MetricAggregationType.P99
226+
}
227+
}
228+
}
229+
],
214230
series: [
215231
{
216232
type: 'series',
@@ -288,6 +304,22 @@ export const apiOverviewDashboard: DashboardDefaultConfiguration = {
288304
'min-upper-limit': 25
289305
},
290306
'max-series-data-points': 150,
307+
bands: [
308+
{
309+
type: 'band',
310+
name: 'Errors Baseline',
311+
'upper-bound-name': 'Errors Upper Bound',
312+
'lower-bound-name': 'Errors Lower Bound',
313+
data: {
314+
type: 'entity-metric-timeseries-data-source',
315+
metric: {
316+
type: 'metric-timeseries-band',
317+
metric: 'errorCount',
318+
aggregation: MetricAggregationType.Sum
319+
}
320+
}
321+
}
322+
],
291323
series: [
292324
{
293325
type: 'series',
@@ -366,6 +398,22 @@ export const apiOverviewDashboard: DashboardDefaultConfiguration = {
366398
'min-upper-limit': 25
367399
},
368400
'max-series-data-points': 150,
401+
bands: [
402+
{
403+
type: 'band',
404+
name: 'Calls Baseline',
405+
'upper-bound-name': 'Calls Upper Bound',
406+
'lower-bound-name': 'Calls Lower Bound',
407+
data: {
408+
type: 'entity-metric-timeseries-data-source',
409+
metric: {
410+
type: 'metric-timeseries-band',
411+
metric: 'numCalls',
412+
aggregation: MetricAggregationType.Sum
413+
}
414+
}
415+
}
416+
],
369417
series: [
370418
{
371419
type: 'series',

projects/observability/src/pages/apis/service-detail/metrics/service-metrics.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ import { serviceMetricsDashboard } from './service-metrics.dashboard';
1818
})
1919
export class ServiceMetricsComponent {
2020
public readonly filterConfig$: ReplayObservable<NavigableDashboardFilterConfig>;
21-
public constructor(serviceDetailService: ServiceDetailService) {
22-
this.filterConfig$ = serviceDetailService.entityFilter$.pipe(
21+
22+
public constructor(private readonly serviceDetailService: ServiceDetailService) {
23+
this.filterConfig$ = this.serviceDetailService.entityFilter$.pipe(
2324
map(filter => ({
2425
implicitFilters: [filter]
2526
}))

projects/observability/src/pages/apis/service-detail/metrics/service-metrics.dashboard.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,22 @@ export const serviceMetricsDashboard: DashboardDefaultConfiguration = {
200200
'color-palette': RED_COLOR_PALETTE,
201201
'selectable-interval': true,
202202
'legend-position': LegendPosition.TopLeft,
203+
bands: [
204+
{
205+
type: 'band',
206+
name: 'Average Baseline',
207+
'upper-bound-name': 'Average Upper Bound',
208+
'lower-bound-name': 'Average Lower Bound',
209+
data: {
210+
type: 'entity-metric-timeseries-data-source',
211+
metric: {
212+
type: 'metric-timeseries-band',
213+
metric: 'duration',
214+
aggregation: MetricAggregationType.Average
215+
}
216+
}
217+
}
218+
],
203219
series: [
204220
{
205221
type: 'series',
@@ -321,6 +337,22 @@ export const serviceMetricsDashboard: DashboardDefaultConfiguration = {
321337
'legend-position': LegendPosition.None,
322338
'show-summary': true,
323339
title: 'Error Rate',
340+
bands: [
341+
{
342+
type: 'band',
343+
name: 'Baseline',
344+
'upper-bound-name': 'Upper Bound',
345+
'lower-bound-name': 'Lower Bound',
346+
data: {
347+
type: 'entity-metric-timeseries-data-source',
348+
metric: {
349+
type: 'metric-timeseries-band',
350+
metric: 'errorCount',
351+
aggregation: MetricAggregationType.AvgrateSecond
352+
}
353+
}
354+
}
355+
],
324356
series: [
325357
{
326358
type: 'series',

projects/observability/src/pages/apis/service-detail/overview/service-overview.dashboard.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,22 @@ export const serviceOverviewDashboard: DashboardDefaultConfiguration = {
255255
'min-upper-limit': 25
256256
},
257257
'max-series-data-points': 150,
258+
bands: [
259+
{
260+
type: 'band',
261+
name: 'P99 Baseline',
262+
'upper-bound-name': 'P99 Upper Bound',
263+
'lower-bound-name': 'P99 Lower Bound',
264+
data: {
265+
type: 'entity-metric-timeseries-data-source',
266+
metric: {
267+
type: 'metric-timeseries-band',
268+
metric: 'duration',
269+
aggregation: MetricAggregationType.P99
270+
}
271+
}
272+
}
273+
],
258274
series: [
259275
{
260276
type: 'series',
@@ -332,6 +348,22 @@ export const serviceOverviewDashboard: DashboardDefaultConfiguration = {
332348
'min-upper-limit': 25
333349
},
334350
'max-series-data-points': 150,
351+
bands: [
352+
{
353+
type: 'band',
354+
name: 'Errors Baseline',
355+
'upper-bound-name': 'Errors Upper Bound',
356+
'lower-bound-name': 'Errors Lower Bound',
357+
data: {
358+
type: 'entity-metric-timeseries-data-source',
359+
metric: {
360+
type: 'metric-timeseries-band',
361+
metric: 'errorCount',
362+
aggregation: MetricAggregationType.Sum
363+
}
364+
}
365+
}
366+
],
335367
series: [
336368
{
337369
type: 'series',
@@ -410,6 +442,22 @@ export const serviceOverviewDashboard: DashboardDefaultConfiguration = {
410442
'min-upper-limit': 25
411443
},
412444
'max-series-data-points': 150,
445+
bands: [
446+
{
447+
type: 'band',
448+
name: 'Calls Baseline',
449+
'upper-bound-name': 'Calls Upper Bound',
450+
'lower-bound-name': 'Calls Lower Bound',
451+
data: {
452+
type: 'entity-metric-timeseries-data-source',
453+
metric: {
454+
type: 'metric-timeseries-band',
455+
metric: 'numCalls',
456+
aggregation: MetricAggregationType.Sum
457+
}
458+
}
459+
}
460+
],
413461
series: [
414462
{
415463
type: 'series',

projects/observability/src/public-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export * from './shared/components/topology/topology.module';
146146
export * from './shared/dashboard/data/graphql/waterfall/api-trace-waterfall-data-source.model';
147147

148148
// Dashboards
149-
export * from './pages/apis/api-detail/metrics/api-metrics-dashboard';
149+
export * from './pages/apis/api-detail/metrics/api-metrics.dashboard';
150150
export * from './pages/apis/api-detail/overview/api-overview.dashboard';
151151
export * from './pages/apis/service-detail/metrics/service-metrics.dashboard';
152152
export * from './pages/apis/service-detail/overview/service-overview.dashboard';

projects/observability/src/shared/dashboard/widgets/charts/cartesian-widget/cartesian-widget.model.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
STRING_PROPERTY
1111
} from '@hypertrace/hyperdash';
1212
import { ModelInject, MODEL_API } from '@hypertrace/hyperdash-angular';
13-
import { Observable } from 'rxjs';
13+
import { Observable, of } from 'rxjs';
1414
import { map } from 'rxjs/operators';
1515
import { Band, CartesianSeriesVisualizationType, Series } from '../../../../components/cartesian/chart';
1616
import { LegendPosition } from '../../../../components/legend/legend.component';
@@ -48,6 +48,12 @@ export class CartesianWidgetModel<TInterval> {
4848
})
4949
public bands: BandModel<TInterval>[] = [];
5050

51+
@ModelProperty({
52+
key: 'show-bands',
53+
type: BOOLEAN_PROPERTY.type
54+
})
55+
public showBands: boolean = false;
56+
5157
@ModelProperty({
5258
key: 'color-palette',
5359
displayName: 'Color Palette',
@@ -258,7 +264,7 @@ export class CartesianWidgetModel<TInterval> {
258264
bands: DecoratedBandDataFetcher<TInterval>[],
259265
interval: TimeDuration
260266
): Observable<MetricBand<TInterval>[]> {
261-
return forkJoinSafeEmpty(bands.map(fetcher => fetcher.getData(interval)));
267+
return this.showBands ? forkJoinSafeEmpty(bands.map(fetcher => fetcher.getData(interval))) : of([]);
262268
}
263269

264270
private getDecoratedSeriesDataFetchers(): Observable<DecoratedSeriesDataFetcher<TInterval>[]> {

0 commit comments

Comments
 (0)