mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore: Add feature to open log sample in split view (#62097)
* Add tests * Implement split open to see logs functionality * Fix imports in test * Update packages/grafana-data/src/types/logs.ts Co-authored-by: Matias Chomicki <matyax@gmail.com> * Update packages/grafana-data/src/types/logs.ts Co-authored-by: Matias Chomicki <matyax@gmail.com> * Update default scneario to throw error * Exit early in getSupplementaryQuery * Update public/app/features/explore/LogsSamplePanel.tsx Co-authored-by: Matias Chomicki <matyax@gmail.com>
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
FieldType,
|
||||
MutableDataFrame,
|
||||
RawTimeRange,
|
||||
SupplementaryQueryType,
|
||||
TimeRange,
|
||||
toUtc,
|
||||
} from '@grafana/data';
|
||||
@@ -924,6 +925,56 @@ describe('ElasticDatasource', () => {
|
||||
|
||||
expect((interpolatedQuery.bucketAggs![0] as Filters).settings!.filters![0].query).toBe('*');
|
||||
});
|
||||
|
||||
describe('getSupplementaryQuery', () => {
|
||||
let ds: ElasticDatasource;
|
||||
beforeEach(() => {
|
||||
ds = getTestContext().ds;
|
||||
});
|
||||
|
||||
it('does not return logs volume query for metric query', () => {
|
||||
expect(
|
||||
ds.getSupplementaryQuery(SupplementaryQueryType.LogsVolume, {
|
||||
refId: 'A',
|
||||
metrics: [{ type: 'count', id: '1' }],
|
||||
bucketAggs: [{ type: 'filters', settings: { filters: [{ query: 'foo', label: '' }] }, id: '1' }],
|
||||
query: 'foo="bar"',
|
||||
})
|
||||
).toEqual(undefined);
|
||||
});
|
||||
|
||||
it('returns logs volume query for log query', () => {
|
||||
expect(
|
||||
ds.getSupplementaryQuery(SupplementaryQueryType.LogsVolume, {
|
||||
refId: 'A',
|
||||
metrics: [{ type: 'logs', id: '1' }],
|
||||
query: 'foo="bar"',
|
||||
})
|
||||
).toEqual({
|
||||
bucketAggs: [
|
||||
{
|
||||
field: '',
|
||||
id: '3',
|
||||
settings: {
|
||||
interval: 'auto',
|
||||
min_doc_count: '0',
|
||||
trimEdges: '0',
|
||||
},
|
||||
type: 'date_histogram',
|
||||
},
|
||||
],
|
||||
metrics: [
|
||||
{
|
||||
id: '1',
|
||||
type: 'count',
|
||||
},
|
||||
],
|
||||
query: 'foo="bar"',
|
||||
refId: 'log-volume-A',
|
||||
timeField: '',
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('getMultiSearchUrl', () => {
|
||||
|
||||
Reference in New Issue
Block a user