query.ts 640 B

123456789101112131415161718
  1. import { from, Observable } from 'rxjs';
  2. import { ArrayDataFrame, DataQueryResponse, FieldType } from '@grafana/data';
  3. export function makeLogsQueryResponse(marker = ''): Observable<DataQueryResponse> {
  4. const df = new ArrayDataFrame([{ ts: Date.now(), line: `custom log line ${marker}` }]);
  5. df.meta = {
  6. preferredVisualisationType: 'logs',
  7. };
  8. df.fields[0].type = FieldType.time;
  9. return from([{ data: [df] }]);
  10. }
  11. export function makeMetricsQueryResponse(): Observable<DataQueryResponse> {
  12. const df = new ArrayDataFrame([{ ts: Date.now(), val: 1 }]);
  13. df.fields[0].type = FieldType.time;
  14. return from([{ data: [df] }]);
  15. }