mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Upgrades rxjs to 7.3.0 (#37913)
* Chore: upgrades rxjs to 7.3.0 * Chore: replaces toPromise with lastValueFrom * Chore: removes unused mock that caused test error * Chore: fixes build error in PieChartPanel * Chore: fixed build error in requestAllIndices * Chore: fixes comment * Chore: trying to reduce docs errors * Chore: searches for explicit api extractor warnings * Chore: updates rxjs-spy to 8.0.0 * Chore: reverts to main * Chore: upgrade rxjs and rxjs-spy
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { lastValueFrom, Observable, of } from 'rxjs';
|
||||
import {
|
||||
DataFrame,
|
||||
dataFrameToJSON,
|
||||
@@ -8,10 +9,10 @@ import {
|
||||
MutableDataFrame,
|
||||
PluginType,
|
||||
} from '@grafana/data';
|
||||
import { Observable, of } from 'rxjs';
|
||||
|
||||
import { createFetchResponse } from 'test/helpers/createFetchResponse';
|
||||
import { TempoDatasource } from './datasource';
|
||||
import { FetchResponse, setBackendSrv, BackendDataSourceResponse, setDataSourceSrv } from '@grafana/runtime';
|
||||
import { BackendDataSourceResponse, FetchResponse, setBackendSrv, setDataSourceSrv } from '@grafana/runtime';
|
||||
import mockJson from './mockJsonResponse.json';
|
||||
|
||||
describe('Tempo data source', () => {
|
||||
@@ -33,7 +34,7 @@ describe('Tempo data source', () => {
|
||||
})
|
||||
);
|
||||
const ds = new TempoDatasource(defaultSettings);
|
||||
const response = await ds.query({ targets: [{ refId: 'refid1' }] } as any).toPromise();
|
||||
const response = await lastValueFrom(ds.query({ targets: [{ refId: 'refid1' }] } as any));
|
||||
|
||||
expect(
|
||||
(response.data[0] as DataFrame).fields.map((f) => ({
|
||||
@@ -89,9 +90,9 @@ describe('Tempo data source', () => {
|
||||
},
|
||||
});
|
||||
setDataSourceSrv(backendSrvWithPrometheus as any);
|
||||
const response = await ds
|
||||
.query({ targets: [{ queryType: 'serviceMap' }], range: getDefaultTimeRange() } as any)
|
||||
.toPromise();
|
||||
const response = await lastValueFrom(
|
||||
ds.query({ targets: [{ queryType: 'serviceMap' }], range: getDefaultTimeRange() } as any)
|
||||
);
|
||||
|
||||
expect(response.data).toHaveLength(2);
|
||||
expect(response.data[0].name).toBe('Nodes');
|
||||
@@ -106,11 +107,11 @@ describe('Tempo data source', () => {
|
||||
it('should handle json file upload', async () => {
|
||||
const ds = new TempoDatasource(defaultSettings);
|
||||
ds.uploadedJson = JSON.stringify(mockJson);
|
||||
const response = await ds
|
||||
.query({
|
||||
const response = await lastValueFrom(
|
||||
ds.query({
|
||||
targets: [{ queryType: 'upload', refId: 'A' }],
|
||||
} as any)
|
||||
.toPromise();
|
||||
);
|
||||
const field = response.data[0].fields[0];
|
||||
expect(field.name).toBe('traceID');
|
||||
expect(field.type).toBe(FieldType.string);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { groupBy } from 'lodash';
|
||||
import { from, lastValueFrom, merge, Observable, of, throwError } from 'rxjs';
|
||||
import { map, mergeMap, toArray } from 'rxjs/operators';
|
||||
import {
|
||||
DataQuery,
|
||||
DataQueryRequest,
|
||||
@@ -9,10 +11,9 @@ import {
|
||||
LoadingState,
|
||||
} from '@grafana/data';
|
||||
import { DataSourceWithBackend } from '@grafana/runtime';
|
||||
|
||||
import { TraceToLogsOptions } from 'app/core/components/TraceToLogsSettings';
|
||||
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||
import { from, merge, Observable, of, throwError } from 'rxjs';
|
||||
import { map, mergeMap, toArray } from 'rxjs/operators';
|
||||
import { LokiOptions, LokiQuery } from '../loki/types';
|
||||
import { transformTrace, transformTraceList, transformFromOTLP as transformFromOTEL } from './resultTransformer';
|
||||
import { PrometheusDatasource } from '../prometheus/datasource';
|
||||
@@ -119,7 +120,7 @@ export class TempoDatasource extends DataSourceWithBackend<TempoQuery, TempoJson
|
||||
|
||||
async testDatasource(): Promise<any> {
|
||||
// to test Tempo we send a dummy traceID and verify Tempo answers with 'trace not found'
|
||||
const response = await super.query({ targets: [{ query: '0' }] } as any).toPromise();
|
||||
const response = await lastValueFrom(super.query({ targets: [{ query: '0' }] } as any));
|
||||
|
||||
const errorMessage = response.error?.message;
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user