mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore: Support mixed data sources for supplementary query (#63036)
* Consolidate logs volume logic (full range and limited) * Fix showing limited histogram message * Test passing meta data to logs volume provider * Improve readability * Clean up types * Add basic support for multiple log volumes * Move the comment back to the right place * Improve readability * Clean up the logic to support Logs Samples * Update docs * Sort log volumes * Provide title to logs volume panel * Move logs volume cache to the provider factory * Add helper functions * Reuse only if queries are the same * Fix alphabetical sorting * Move caching out of the provider * Support errors and loading state * Remove unused code * Consolidate supplementary query utils * Add tests for supplementaryQueries * Update tests * Simplify logs volume extra info * Update tests * Remove comment * Update tests * Fix hiding the histogram for hidden queries * Simplify loading message * Update tests * Wait for full fallback histogram to load before showing it * Fix a typo * Add feedback comments * Move feedback comments to github * Do not filter out hidden queries as they may be used as references in other queries * Group log volume by refId * Support showing fallback histograms per query to avoid duplicates * Improve type-checking * Fix supplementaryQueries.test.ts * Fix logsModel.test.ts * Fix loading fallback results * Fix unit tests * WIP * Update deprecated styles * Simplify test * Simplify rendering zoom info * Update deprecated styles * Simplify getLogsVolumeDataSourceInfo * Simplify isLogsVolumeLimited() * Simplify rendering zoom info
This commit is contained in:
@@ -87,6 +87,7 @@ export interface LogsModel {
|
||||
// visibleRange is time range for histogram created from log results
|
||||
visibleRange?: AbsoluteTimeRange;
|
||||
queries?: DataQuery[];
|
||||
bucketSize?: number;
|
||||
}
|
||||
|
||||
export interface LogSearchMatch {
|
||||
@@ -194,6 +195,40 @@ export enum LogsVolumeType {
|
||||
Limited = 'Limited',
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom meta information required by Logs Volume responses
|
||||
*/
|
||||
export type LogsVolumeCustomMetaData = {
|
||||
absoluteRange: AbsoluteTimeRange;
|
||||
logsVolumeType: LogsVolumeType;
|
||||
datasourceName: string;
|
||||
sourceQuery: DataQuery;
|
||||
};
|
||||
|
||||
export const getLogsVolumeAbsoluteRange = (
|
||||
dataFrames: DataFrame[],
|
||||
defaultRange: AbsoluteTimeRange
|
||||
): AbsoluteTimeRange => {
|
||||
return dataFrames[0].meta?.custom?.absoluteRange || defaultRange;
|
||||
};
|
||||
|
||||
export const getLogsVolumeDataSourceInfo = (dataFrames: DataFrame[]): { name: string; refId: string } | null => {
|
||||
const customMeta = dataFrames[0]?.meta?.custom;
|
||||
|
||||
if (customMeta && customMeta.datasourceName && customMeta.sourceQuery?.refId) {
|
||||
return {
|
||||
name: customMeta.datasourceName,
|
||||
refId: customMeta.sourceQuery.refId,
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
export const isLogsVolumeLimited = (dataFrames: DataFrame[]) => {
|
||||
return dataFrames[0]?.meta?.custom?.logsVolumeType === LogsVolumeType.Limited;
|
||||
};
|
||||
|
||||
/**
|
||||
* Data sources that support supplementary queries in Explore.
|
||||
* This will enable users to see additional data when running original queries.
|
||||
|
||||
Reference in New Issue
Block a user