Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import {
dataSourceMarker,
ModelApi,
ModelEventPublisher,
ModelProperty
ModelModelPropertyTypeInstance,
ModelProperty,
ModelPropertyType
} from '@hypertrace/hyperdash';
import { ModelInject, MODEL_API } from '@hypertrace/hyperdash-angular';
import { GraphQlRequestOptionsModel } from './request-option/graphql-request-options.model';

import {
GraphQlQueryHandler,
Expand All @@ -32,6 +35,15 @@ export abstract class GraphQlDataSourceModel<TData> implements DataSource<TData>
})
public filters: GraphQlFilter[] = [];

@ModelProperty({
// tslint:disable-next-line: no-object-literal-type-assertion
type: {
key: ModelPropertyType.TYPE
} as ModelModelPropertyTypeInstance,
key: 'request-options'
})
public requestOptions?: GraphQlRequestOptionsModel;

@ModelInject(MODEL_API)
public api!: ModelApi;
public abstract getData(): Observable<TData>;
Expand Down Expand Up @@ -61,7 +73,7 @@ export abstract class GraphQlDataSourceModel<TData> implements DataSource<TData>

this.querySubject.next({
buildRequest: this.convertToBuilder(requestOrBuilder),
requestOptions: requestOptions,
requestOptions: requestOptions ?? this.requestOptions,
responseObserver: resultSubject as Observer<unknown>
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { GraphQlFilterDataSourceModel } from './filter/graphql-filter-data-sourc
import { GraphqlIdScopeFilterModel } from './filter/graphql-id-scope-filter.model';
import { GraphQlKeyValueFilterModel } from './filter/graphql-key-value-filter.model';
import { GRAPHQL_DATA_SOURCE_HANDLER_PROVIDERS } from './graphql-handler-configuration';
import { GraphQlRequestOptionsModel } from './request-option/graphql-request-options.model';
import { SpanDataSourceModel } from './span/span-data-source.model';
import { AttributeSpecificationModel } from './specifiers/attribute-specification.model';
import { CompositeSpecificationModel } from './specifiers/composite-specification.model';
Expand All @@ -30,6 +31,7 @@ import { TraceWaterfallDataSourceModel } from './waterfall/trace-waterfall-data-
GraphQlFilterDataSourceModel,
GraphQlKeyValueFilterModel,
GraphqlIdScopeFilterModel,
GraphQlRequestOptionsModel,
SpansTableDataSourceModel,
TracesTableDataSourceModel,
SpanDataSourceModel,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { BOOLEAN_PROPERTY, Model, ModelProperty } from '@hypertrace/hyperdash';

import { EnumPropertyTypeInstance, ENUM_TYPE } from '@hypertrace/dashboards';
import { GraphQlRequestCacheability } from '@hypertrace/graphql-client';

@Model({
type: 'request-options'
})
export class GraphQlRequestOptionsModel {
@ModelProperty({
key: 'cacheability',
required: false,
// tslint:disable-next-line: no-object-literal-type-assertion
type: {
key: ENUM_TYPE.type,
values: [
GraphQlRequestCacheability.NotCacheable,
GraphQlRequestCacheability.RefreshCache,
GraphQlRequestCacheability.Cacheable
]
} as EnumPropertyTypeInstance
})
public cacheability?: GraphQlRequestCacheability;

@ModelProperty({
key: 'isolated',
type: BOOLEAN_PROPERTY.type
})
public isolated?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export abstract class TableDataSourceModel extends GraphQlDataSourceModel<TableD
});
}

protected buildGraphqlRequestOptions(): GraphQlRequestOptions {
return {};
protected buildGraphqlRequestOptions(): GraphQlRequestOptions | undefined {
return undefined;
}

public abstract getScope(): string | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class TopologyDataSourceModel extends GraphQlDataSourceModel<TopologyData
public edgeMetricsModel!: TopologyMetricsModel;

private readonly specBuilder: SpecificationBuilder = new SpecificationBuilder();
private readonly requestOptions: GraphQlRequestOptions = {
public readonly requestOptions: GraphQlRequestOptions = {
cacheability: GraphQlRequestCacheability.Cacheable,
isolated: true
};
Expand Down