mirror of
https://github.com/grafana/grafana.git
synced 2024-11-28 03:34:15 -06:00
Prometheus: Show only graph for range queries in Explore (#32489)
* Remove showing of table for range query * Improve comment
This commit is contained in:
parent
71e8a03c46
commit
61d3900b54
@ -284,7 +284,6 @@ export class PrometheusDatasource extends DataSourceApi<PromQuery, PromOptions>
|
||||
|
||||
private exploreQuery(queries: PromQueryRequest[], activeTargets: PromQuery[], end: number) {
|
||||
let runningQueriesCount = queries.length;
|
||||
const mixedQueries = activeTargets.some((t) => t.range) && activeTargets.some((t) => t.instant);
|
||||
|
||||
const subQueries = queries.map((query, index) => {
|
||||
const target = activeTargets[index];
|
||||
@ -299,7 +298,6 @@ export class PrometheusDatasource extends DataSourceApi<PromQuery, PromOptions>
|
||||
query,
|
||||
target,
|
||||
responseListLength: queries.length,
|
||||
mixedQueries,
|
||||
exemplarTraceIdDestinations: this.exemplarTraceIdDestinations,
|
||||
});
|
||||
return {
|
||||
|
@ -45,7 +45,6 @@ export function transform(
|
||||
target: PromQuery;
|
||||
responseListLength: number;
|
||||
scopedVars?: ScopedVars;
|
||||
mixedQueries?: boolean;
|
||||
}
|
||||
) {
|
||||
// Create options object from transformOptions
|
||||
@ -61,14 +60,8 @@ export function transform(
|
||||
refId: transformOptions.target.refId,
|
||||
valueWithRefId: transformOptions.target.valueWithRefId,
|
||||
meta: {
|
||||
/**
|
||||
* Fix for showing of Prometheus results in Explore table.
|
||||
* We want to show result of instant query always in table and result of range query based on target.runAll;
|
||||
*/
|
||||
preferredVisualisationType: getPreferredVisualisationType(
|
||||
transformOptions.query.instant,
|
||||
transformOptions.mixedQueries
|
||||
),
|
||||
// Fix for showing of Prometheus results in Explore table
|
||||
preferredVisualisationType: transformOptions.query.instant ? 'table' : 'graph',
|
||||
},
|
||||
};
|
||||
const prometheusResult = response.data.data;
|
||||
@ -228,14 +221,6 @@ function sampleExemplars(events: TimeAndValue[], options: TransformOptions) {
|
||||
return sampledExemplars;
|
||||
}
|
||||
|
||||
function getPreferredVisualisationType(isInstantQuery?: boolean, mixedQueries?: boolean) {
|
||||
if (isInstantQuery) {
|
||||
return 'table';
|
||||
}
|
||||
|
||||
return mixedQueries ? 'graph' : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms matrix and vector result from Prometheus result to DataFrame
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user