mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Query Caching: Add per-panel query caching TTL (#61968)
* *Create Caching Config interface and OSS impl
*Create front-end facing DS Cache config
*Populate Caching Config on Datasource DTO
*Update OSS wire deps
* fix unit test
* handle query caching TTL override on the frontend
* Make sure the override works with pubdash
* move caching config to the right place in the ds info
* move caching config logic to enterprise index hook
* move queryCachingTTL to pubdash query payload
* Remove from metadata (not needed)
* rename struct and add comment
* remove invalid wire dependency
* manual revert of 395c74b
* fix frontend test
* fix backend test
* fix tests for real this time
* truly fix frontend test
* fix back end unit test for real
This commit is contained in:
@@ -145,6 +145,10 @@ interface PluginMetaQueryOptions {
|
||||
maxDataPoints?: boolean;
|
||||
minInterval?: boolean;
|
||||
}
|
||||
interface PluginQueryCachingConfig {
|
||||
enabled?: boolean;
|
||||
TTLMs?: number;
|
||||
}
|
||||
|
||||
export interface DataSourcePluginComponents<
|
||||
DSType extends DataSourceApi<TQuery, TOptions>,
|
||||
@@ -224,6 +228,7 @@ abstract class DataSourceApi<
|
||||
this.id = instanceSettings.id;
|
||||
this.type = instanceSettings.type;
|
||||
this.meta = instanceSettings.meta;
|
||||
this.cachingConfig = instanceSettings.cachingConfig;
|
||||
this.uid = instanceSettings.uid;
|
||||
}
|
||||
|
||||
@@ -301,6 +306,12 @@ abstract class DataSourceApi<
|
||||
*/
|
||||
meta: DataSourcePluginMeta;
|
||||
|
||||
/**
|
||||
* Information about the datasource's query caching configuration
|
||||
* When the caching feature is disabled, this config will always be falsy
|
||||
*/
|
||||
cachingConfig?: PluginQueryCachingConfig;
|
||||
|
||||
/**
|
||||
* Used by alerting to check if query contains template variables
|
||||
*/
|
||||
@@ -487,6 +498,7 @@ export interface DataQueryRequest<TQuery extends DataQuery = DataQuery> {
|
||||
app: CoreApp | string;
|
||||
|
||||
cacheTimeout?: string | null;
|
||||
queryCachingTTL?: number | null;
|
||||
rangeRaw?: RawTimeRange;
|
||||
timeInfo?: string; // The query time description (blue text in the upper right)
|
||||
panelId?: number;
|
||||
@@ -586,6 +598,7 @@ export interface DataSourceInstanceSettings<T extends DataSourceJsonData = DataS
|
||||
type: string;
|
||||
name: string;
|
||||
meta: DataSourcePluginMeta;
|
||||
cachingConfig?: PluginQueryCachingConfig;
|
||||
readOnly: boolean;
|
||||
url?: string;
|
||||
jsonData: T;
|
||||
|
||||
@@ -23,6 +23,7 @@ export interface QueryRunnerOptions {
|
||||
minInterval: string | undefined | null;
|
||||
scopedVars?: ScopedVars;
|
||||
cacheTimeout?: string;
|
||||
queryCachingTTL?: number;
|
||||
app?: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user