mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* Add phlare datasource * Rename * Add parca * Add self field to parca * Make sure phlare works with add to dashboard flow * Add profiling category and hide behind feature flag * Update description and logos * Update phlare icon * Cleanup logging * Clean up logging * Fix for shift+enter * onRunQuery to set label * Update type naming * Fix lint * Fix test and quality issues Co-authored-by: Joey Tawadrous <joey.tawadrous@grafana.com>
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { Observable, of } from 'rxjs';
|
|
|
|
import { DataQueryRequest, DataQueryResponse, DataSourceInstanceSettings } from '@grafana/data';
|
|
import { DataSourceWithBackend } from '@grafana/runtime';
|
|
|
|
import { ParcaDataSourceOptions, Query, ProfileTypeMessage } from './types';
|
|
|
|
export class ParcaDataSource extends DataSourceWithBackend<Query, ParcaDataSourceOptions> {
|
|
constructor(instanceSettings: DataSourceInstanceSettings<ParcaDataSourceOptions>) {
|
|
super(instanceSettings);
|
|
}
|
|
|
|
query(request: DataQueryRequest<Query>): Observable<DataQueryResponse> {
|
|
if (!request.targets.every((q) => q.profileTypeId)) {
|
|
// When changing data source in explore, firs query can be sent without filled in profileTypeId
|
|
return of({ data: [] });
|
|
}
|
|
|
|
return super.query(request);
|
|
}
|
|
|
|
async getProfileTypes(): Promise<ProfileTypeMessage[]> {
|
|
return await super.getResource('profileTypes');
|
|
}
|
|
|
|
async getLabelNames(): Promise<string[]> {
|
|
return await super.getResource('labelNames');
|
|
}
|
|
|
|
async getLabelValues(labelName: string): Promise<string[]> {
|
|
return await super.getResource('labelValues', { label: labelName });
|
|
}
|
|
}
|