diff --git a/pkg/tsdb/parca/query.go b/pkg/tsdb/parca/query.go index 3cb8efe8031..a44ac6c2b94 100644 --- a/pkg/tsdb/parca/query.go +++ b/pkg/tsdb/parca/query.go @@ -24,7 +24,7 @@ const queryTypeProfile = "profile" const queryTypeMetrics = "metrics" const queryTypeBoth = "both" -// query processes single Fire query transforming the response to data.Frame packaged in DataResponse +// query processes single Parca query transforming the response to data.Frame packaged in DataResponse func (d *ParcaDatasource) query(ctx context.Context, pCtx backend.PluginContext, query backend.DataQuery) backend.DataResponse { var qm queryModel response := backend.DataResponse{} @@ -97,7 +97,7 @@ type CustomMeta struct { ProfileTypeID string } -// responseToDataFrames turns fire response to data.Frame. We encode the data into a nested set format where we have +// responseToDataFrames turns Parca response to data.Frame. We encode the data into a nested set format where we have // [level, value, label] columns and by ordering the items in a depth first traversal order we can recreate the whole // tree back. func responseToDataFrames(resp *connect.Response[v1alpha1.QueryResponse]) *data.Frame { diff --git a/pkg/tsdb/parca/service.go b/pkg/tsdb/parca/service.go index fa5c6cc0742..113dc5d4344 100644 --- a/pkg/tsdb/parca/service.go +++ b/pkg/tsdb/parca/service.go @@ -10,7 +10,7 @@ import ( "github.com/grafana/grafana/pkg/infra/log" ) -// Make sure FireDatasource implements required interfaces. This is important to do +// Make sure ParcaDatasource implements required interfaces. This is important to do // since otherwise we will only get a not implemented error response from plugin in // runtime. In this example datasource instance implements backend.QueryDataHandler, // backend.CheckHealthHandler, backend.StreamHandler interfaces. Plugin should not diff --git a/pkg/tsdb/phlare/query.go b/pkg/tsdb/phlare/query.go index 7abc80be5f1..fda9d4d1e4f 100644 --- a/pkg/tsdb/phlare/query.go +++ b/pkg/tsdb/phlare/query.go @@ -35,7 +35,7 @@ const ( queryTypeBoth = "both" ) -// query processes single Fire query transforming the response to data.Frame packaged in DataResponse +// query processes single Phlare query transforming the response to data.Frame packaged in DataResponse func (d *PhlareDatasource) query(ctx context.Context, pCtx backend.PluginContext, query backend.DataQuery) backend.DataResponse { var qm queryModel response := backend.DataResponse{} @@ -121,7 +121,7 @@ func makeRequest(qm queryModel, query backend.DataQuery) *connect.Request[querie } } -// responseToDataFrames turns fire response to data.Frame. We encode the data into a nested set format where we have +// responseToDataFrames turns Phlare response to data.Frame. We encode the data into a nested set format where we have // [level, value, label] columns and by ordering the items in a depth first traversal order we can recreate the whole // tree back. func responseToDataFrames(resp *connect.Response[querierv1.SelectMergeStacktracesResponse], profileTypeID string) *data.Frame { @@ -154,7 +154,7 @@ type ProfileTree struct { } // levelsToTree converts flamebearer format into a tree. This is needed to then convert it into nested set format -// dataframe. This should be temporary, and ideally we should get some sort of tree struct directly from Fire API. +// dataframe. This should be temporary, and ideally we should get some sort of tree struct directly from Phlare API. func levelsToTree(levels []*querierv1.Level, names []string) *ProfileTree { tree := &ProfileTree{ Start: 0, diff --git a/pkg/tsdb/phlare/service.go b/pkg/tsdb/phlare/service.go index e4ddc9b6afc..e604c1bf7c9 100644 --- a/pkg/tsdb/phlare/service.go +++ b/pkg/tsdb/phlare/service.go @@ -10,7 +10,7 @@ import ( "github.com/grafana/grafana/pkg/infra/log" ) -// Make sure FireDatasource implements required interfaces. This is important to do +// Make sure PhlareDatasource implements required interfaces. This is important to do // since otherwise we will only get a not implemented error response from plugin in // runtime. In this example datasource instance implements backend.QueryDataHandler, // backend.CheckHealthHandler, backend.StreamHandler interfaces. Plugin should not diff --git a/public/app/plugins/datasource/phlare/ConfigEditor.tsx b/public/app/plugins/datasource/phlare/ConfigEditor.tsx index 178467d7409..7e4843a2a83 100644 --- a/public/app/plugins/datasource/phlare/ConfigEditor.tsx +++ b/public/app/plugins/datasource/phlare/ConfigEditor.tsx @@ -3,9 +3,9 @@ import React from 'react'; import { DataSourcePluginOptionsEditorProps } from '@grafana/data'; import { DataSourceHttpSettings, EventsWithValidation, LegacyForms, regexValidation } from '@grafana/ui'; -import { FireDataSourceOptions } from './types'; +import { PhlareDataSourceOptions } from './types'; -interface Props extends DataSourcePluginOptionsEditorProps {} +interface Props extends DataSourcePluginOptionsEditorProps {} export const ConfigEditor = (props: Props) => { const { options, onOptionsChange } = props; @@ -51,7 +51,7 @@ export const ConfigEditor = (props: Props) => { }} /> } - tooltip="Minimal step used for metric query. Should be the same or higher as the scrape interval setting in the Fire database." + tooltip="Minimal step used for metric query. Should be the same or higher as the scrape interval setting in the Phlare database." /> diff --git a/public/app/plugins/datasource/phlare/QueryEditor/LabelsEditor.tsx b/public/app/plugins/datasource/phlare/QueryEditor/LabelsEditor.tsx index d5a09a69b47..4468ef83d0c 100644 --- a/public/app/plugins/datasource/phlare/QueryEditor/LabelsEditor.tsx +++ b/public/app/plugins/datasource/phlare/QueryEditor/LabelsEditor.tsx @@ -2,10 +2,9 @@ import { css } from '@emotion/css'; import React, { useEffect, useRef } from 'react'; import { useLatest } from 'react-use'; -import { GrafanaTheme2 } from '@grafana/data'; import { CodeEditor, Monaco, useStyles2, monacoTypes } from '@grafana/ui'; -import { languageDefinition } from '../fireql'; +import { languageDefinition } from '../phlareql'; import { SeriesMessage } from '../types'; import { CompletionProvider } from './autocomplete'; @@ -54,7 +53,7 @@ export function LabelsEditor(props: Props) { bottom: 6, }, }} - onBeforeEditorMount={ensureFireQL} + onBeforeEditorMount={ensurePhlareQL} onEditorDidMount={(editor, monaco) => { setupAutocompleteFn(editor, monaco); @@ -122,12 +121,12 @@ function useAutocomplete(series?: SeriesMessage) { } // we must only run the setup code once -let fireqlSetupDone = false; -const langId = 'fireql'; +let phlareqlSetupDone = false; +const langId = 'phlareql'; -function ensureFireQL(monaco: Monaco) { - if (fireqlSetupDone === false) { - fireqlSetupDone = true; +function ensurePhlareQL(monaco: Monaco) { + if (phlareqlSetupDone === false) { + phlareqlSetupDone = true; const { aliases, extensions, mimetypes, def } = languageDefinition; monaco.languages.register({ id: langId, aliases, extensions, mimetypes }); monaco.languages.setMonarchTokensProvider(langId, def.language); @@ -135,7 +134,7 @@ function ensureFireQL(monaco: Monaco) { } } -const getStyles = (theme: GrafanaTheme2) => { +const getStyles = () => { return { queryField: css` flex: 1; diff --git a/public/app/plugins/datasource/phlare/QueryEditor/QueryEditor.test.tsx b/public/app/plugins/datasource/phlare/QueryEditor/QueryEditor.test.tsx index 013c49f60db..88d73f848b2 100644 --- a/public/app/plugins/datasource/phlare/QueryEditor/QueryEditor.test.tsx +++ b/public/app/plugins/datasource/phlare/QueryEditor/QueryEditor.test.tsx @@ -5,7 +5,7 @@ import React from 'react'; import { CoreApp, PluginType } from '@grafana/data'; -import { FireDataSource } from '../datasource'; +import { PhlareDataSource } from '../datasource'; import { ProfileTypeMessage } from '../types'; import { Props, QueryEditor } from './QueryEditor'; @@ -44,7 +44,7 @@ async function openOptions() { function setup(options: { props: Partial } = { props: {} }) { const onChange = jest.fn(); - const ds = new FireDataSource({ + const ds = new PhlareDataSource({ name: 'test', uid: 'test', type: PluginType.datasource, diff --git a/public/app/plugins/datasource/phlare/QueryEditor/QueryEditor.tsx b/public/app/plugins/datasource/phlare/QueryEditor/QueryEditor.tsx index a4459206f12..e49c295f642 100644 --- a/public/app/plugins/datasource/phlare/QueryEditor/QueryEditor.tsx +++ b/public/app/plugins/datasource/phlare/QueryEditor/QueryEditor.tsx @@ -5,15 +5,15 @@ import { useAsync } from 'react-use'; import { CoreApp, QueryEditorProps } from '@grafana/data'; import { ButtonCascader, CascaderOption } from '@grafana/ui'; -import { FireDataSource } from '../datasource'; -import { defaultQuery, FireDataSourceOptions, ProfileTypeMessage, Query } from '../types'; +import { PhlareDataSource } from '../datasource'; +import { defaultQuery, PhlareDataSourceOptions, ProfileTypeMessage, Query } from '../types'; import { EditorRow } from './EditorRow'; import { EditorRows } from './EditorRows'; import { LabelsEditor } from './LabelsEditor'; import { QueryOptions } from './QueryOptions'; -export type Props = QueryEditorProps; +export type Props = QueryEditorProps; export function QueryEditor(props: Props) { const profileTypes = useProfileTypes(props.datasource); @@ -91,7 +91,7 @@ function useCascaderOptions(profileTypes: ProfileTypeMessage[]) { }, [profileTypes]); } -function useProfileTypes(datasource: FireDataSource) { +function useProfileTypes(datasource: PhlareDataSource) { const [profileTypes, setProfileTypes] = useState([]); useEffect(() => { (async () => { diff --git a/public/app/plugins/datasource/phlare/QueryEditor/autocomplete.ts b/public/app/plugins/datasource/phlare/QueryEditor/autocomplete.ts index f90cc7e0d1e..3e61a2d92f3 100644 --- a/public/app/plugins/datasource/phlare/QueryEditor/autocomplete.ts +++ b/public/app/plugins/datasource/phlare/QueryEditor/autocomplete.ts @@ -6,7 +6,7 @@ import { SeriesMessage } from '../types'; * Class that implements CompletionItemProvider interface and allows us to provide suggestion for the Monaco * autocomplete system. * - * At this moment we just pass it all the labels/values we get from Fire backend later on we may do something a bit + * At this moment we just pass it all the labels/values we get from Phlare backend later on we may do something a bit * smarter if there will be lots of labels. */ export class CompletionProvider implements monacoTypes.languages.CompletionItemProvider { @@ -169,7 +169,7 @@ const inLabelNameRegex = new RegExp(/[{,]\s*[a-zA-Z0-9_]*$/); /** * Figure out where is the cursor and what kind of suggestions are appropriate. - * As currently Fire handles just a simple {foo="bar", baz="zyx"} kind of values we can do with simple regex to figure + * As currently Phlare handles just a simple {foo="bar", baz="zyx"} kind of values we can do with simple regex to figure * out where we are with the cursor. * @param text * @param offset diff --git a/public/app/plugins/datasource/phlare/datasource.ts b/public/app/plugins/datasource/phlare/datasource.ts index 5ab85bc46dd..aa80869c12c 100644 --- a/public/app/plugins/datasource/phlare/datasource.ts +++ b/public/app/plugins/datasource/phlare/datasource.ts @@ -4,10 +4,10 @@ import { DataQueryRequest, DataQueryResponse, DataSourceInstanceSettings } from import { DataSourceWithBackend } from '@grafana/runtime'; import { normalizeQuery } from './QueryEditor/QueryEditor'; -import { FireDataSourceOptions, Query, ProfileTypeMessage, SeriesMessage } from './types'; +import { PhlareDataSourceOptions, Query, ProfileTypeMessage, SeriesMessage } from './types'; -export class FireDataSource extends DataSourceWithBackend { - constructor(instanceSettings: DataSourceInstanceSettings) { +export class PhlareDataSource extends DataSourceWithBackend { + constructor(instanceSettings: DataSourceInstanceSettings) { super(instanceSettings); } diff --git a/public/app/plugins/datasource/phlare/fireql/index.ts b/public/app/plugins/datasource/phlare/fireql/index.ts deleted file mode 100644 index 598e6809a55..00000000000 --- a/public/app/plugins/datasource/phlare/fireql/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { language, languageConfiguration } from './fireql'; - -export const languageDefinition = { - id: 'fireql', - extensions: ['.fireql'], - aliases: ['fire', 'fireql'], - mimetypes: [], - def: { - language, - languageConfiguration, - }, -}; diff --git a/public/app/plugins/datasource/phlare/module.ts b/public/app/plugins/datasource/phlare/module.ts index 90aaf946771..a8780fe88ab 100644 --- a/public/app/plugins/datasource/phlare/module.ts +++ b/public/app/plugins/datasource/phlare/module.ts @@ -2,9 +2,9 @@ import { DataSourcePlugin } from '@grafana/data'; import { ConfigEditor } from './ConfigEditor'; import { QueryEditor } from './QueryEditor/QueryEditor'; -import { FireDataSource } from './datasource'; -import { Query, FireDataSourceOptions } from './types'; +import { PhlareDataSource } from './datasource'; +import { Query, PhlareDataSourceOptions } from './types'; -export const plugin = new DataSourcePlugin(FireDataSource) +export const plugin = new DataSourcePlugin(PhlareDataSource) .setConfigEditor(ConfigEditor) .setQueryEditor(QueryEditor); diff --git a/public/app/plugins/datasource/phlare/phlareql/index.ts b/public/app/plugins/datasource/phlare/phlareql/index.ts new file mode 100644 index 00000000000..ce2ae322572 --- /dev/null +++ b/public/app/plugins/datasource/phlare/phlareql/index.ts @@ -0,0 +1,12 @@ +import { language, languageConfiguration } from './phlareql'; + +export const languageDefinition = { + id: 'phlareql', + extensions: ['.phlareql'], + aliases: ['phlare', 'phlareql'], + mimetypes: [], + def: { + language, + languageConfiguration, + }, +}; diff --git a/public/app/plugins/datasource/phlare/fireql/fireql.ts b/public/app/plugins/datasource/phlare/phlareql/phlareql.ts similarity index 98% rename from public/app/plugins/datasource/phlare/fireql/fireql.ts rename to public/app/plugins/datasource/phlare/phlareql/phlareql.ts index b5fddd473d1..385a1787405 100644 --- a/public/app/plugins/datasource/phlare/fireql/fireql.ts +++ b/public/app/plugins/datasource/phlare/phlareql/phlareql.ts @@ -20,7 +20,7 @@ export const languageConfiguration: languages.LanguageConfiguration = { export const language: languages.IMonarchLanguage = { ignoreCase: false, defaultToken: '', - tokenPostfix: '.fireql', + tokenPostfix: '.phlareql', keywords: [], operators: [], diff --git a/public/app/plugins/datasource/phlare/types.ts b/public/app/plugins/datasource/phlare/types.ts index a69e22465fe..67687ae197c 100644 --- a/public/app/plugins/datasource/phlare/types.ts +++ b/public/app/plugins/datasource/phlare/types.ts @@ -27,6 +27,6 @@ export const defaultQuery: Partial = { /** * These are options configured for each DataSource instance. */ -export interface FireDataSourceOptions extends DataSourceJsonData { +export interface PhlareDataSourceOptions extends DataSourceJsonData { minStep?: string; }