chore: reduce Loki barrel files (#114888)
This commit is contained in:
@@ -4080,11 +4080,6 @@
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/loki/types.ts": {
|
||||
"no-barrel-files/no-barrel-files": {
|
||||
"count": 3
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/mixed/module.ts": {
|
||||
"no-barrel-files/no-barrel-files": {
|
||||
"count": 2
|
||||
|
||||
@@ -36,7 +36,7 @@ import { getShiftedTimeRange } from 'app/core/utils/timePicker';
|
||||
import { getCorrelationsBySourceUIDs } from 'app/features/correlations/utils';
|
||||
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||
import { getFiscalYearStartMonth, getTimeZone } from 'app/features/profile/state/selectors';
|
||||
import { SupportingQueryType } from 'app/plugins/datasource/loki/types';
|
||||
import { SupportingQueryType } from 'app/plugins/datasource/loki/dataquery.gen';
|
||||
import { MIXED_DATASOURCE_NAME } from 'app/plugins/datasource/mixed/MixedDataSource';
|
||||
import {
|
||||
ExploreItemState,
|
||||
|
||||
@@ -44,7 +44,7 @@ import { t } from '@grafana/i18n';
|
||||
import { BarAlignment, GraphDrawStyle, StackingMode } from '@grafana/schema';
|
||||
import { colors } from '@grafana/ui';
|
||||
import { getThemeColor } from 'app/core/utils/colors';
|
||||
import { LokiQueryDirection } from 'app/plugins/datasource/loki/types';
|
||||
import { LokiQueryDirection } from 'app/plugins/datasource/loki/dataquery.gen';
|
||||
|
||||
import { LogsFrame, parseLogsFrame } from './logsFrame';
|
||||
import { createLogRowsMap, getLogLevel, getLogLevelFromKey, sortInAscendingOrder } from './utils';
|
||||
|
||||
@@ -2,6 +2,7 @@ import { AbstractLabelOperator, DataFrame, TimeRange, dateTime, ScopedVars } fro
|
||||
import { config } from '@grafana/runtime';
|
||||
|
||||
import LanguageProvider from './LanguageProvider';
|
||||
import { LokiQueryType } from './dataquery.gen';
|
||||
import { DEFAULT_MAX_LINES_SAMPLE, LokiDatasource } from './datasource';
|
||||
import { createDetectedFieldValuesMetadataRequest } from './mocks/createDetectedFieldValuesMetadataRequest';
|
||||
import { createDetectedFieldsMetadataRequest } from './mocks/createDetectedFieldsMetadataRequest';
|
||||
@@ -12,7 +13,7 @@ import {
|
||||
extractLabelKeysFromDataFrame,
|
||||
extractUnwrapLabelKeysFromDataFrame,
|
||||
} from './responseUtils';
|
||||
import { DetectedFieldsResult, LabelType, LokiQueryType } from './types';
|
||||
import { DetectedFieldsResult, LabelType } from './types';
|
||||
|
||||
jest.mock('./responseUtils');
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { LRUCache } from 'lru-cache';
|
||||
import { AbstractQuery, getDefaultTimeRange, KeyValue, LanguageProvider, ScopedVars, TimeRange } from '@grafana/data';
|
||||
import { BackendSrvRequest, config } from '@grafana/runtime';
|
||||
|
||||
import { LokiQueryType } from './dataquery.gen';
|
||||
import { DEFAULT_MAX_LINES_SAMPLE, LokiDatasource } from './datasource';
|
||||
import { abstractQueryToExpr, mapAbstractOperatorsToOp, processLabels } from './languageUtils';
|
||||
import { getStreamSelectorsFromQuery } from './queryUtils';
|
||||
@@ -13,7 +14,7 @@ import {
|
||||
extractLogParserFromDataFrame,
|
||||
extractUnwrapLabelKeysFromDataFrame,
|
||||
} from './responseUtils';
|
||||
import { DetectedFieldsResult, LabelType, LokiQuery, LokiQueryType, ParserAndLabelKeysResult } from './types';
|
||||
import { DetectedFieldsResult, LabelType, LokiQuery, ParserAndLabelKeysResult } from './types';
|
||||
|
||||
const NS_IN_MS = 1000000;
|
||||
const EMPTY_SELECTOR = '{}';
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
import { LabelParser, LabelFilter, LineFilters, PipelineStage, Logfmt, Json } from '@grafana/lezer-logql';
|
||||
|
||||
import { LokiContextUi } from './components/LokiContextUi';
|
||||
import { LokiQueryDirection, LokiQueryType } from './dataquery.gen';
|
||||
import { LokiDatasource, makeRequest, REF_ID_STARTER_LOG_ROW_CONTEXT } from './datasource';
|
||||
import { escapeLabelValueInExactSelector, getLabelTypeFromFrame } from './languageUtils';
|
||||
import { addLabelToQuery, addParserToQuery } from './modifyQuery';
|
||||
@@ -29,7 +30,7 @@ import {
|
||||
isQueryWithParser,
|
||||
} from './queryUtils';
|
||||
import { sortDataFrameByTime, SortDirection } from './sortDataFrame';
|
||||
import { ContextFilter, LabelType, LokiQuery, LokiQueryDirection, LokiQueryType } from './types';
|
||||
import { ContextFilter, LabelType, LokiQuery } from './types';
|
||||
|
||||
export const LOKI_LOG_CONTEXT_PRESERVED_LABELS = 'lokiLogContextPreservedLabels';
|
||||
export const SHOULD_INCLUDE_PIPELINE_OPERATIONS = 'lokiLogContextShouldIncludePipelineOperations';
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { DataQueryResponse, DataFrame, isDataFrame, FieldType, QueryResultMeta, DataQueryError } from '@grafana/data';
|
||||
|
||||
import { LokiQueryType } from './dataquery.gen';
|
||||
import { getDerivedFields } from './getDerivedFields';
|
||||
import { makeTableFrames } from './makeTableFrames';
|
||||
import { getExpressionFromExecutedQuery, getHighlighterExpressionsFromQuery } from './queryUtils';
|
||||
import { dataFrameHasLokiError } from './responseUtils';
|
||||
import { DerivedFieldConfig, LokiQuery, LokiQueryType } from './types';
|
||||
import { DerivedFieldConfig, LokiQuery } from './types';
|
||||
|
||||
function isMetricFrame(frame: DataFrame): boolean {
|
||||
return frame.fields.every((field) => field.type === FieldType.time || field.type === FieldType.number);
|
||||
|
||||
@@ -5,7 +5,8 @@ import { SelectableValue } from '@grafana/data';
|
||||
import { config, reportInteraction } from '@grafana/runtime';
|
||||
import { InlineField, Input, Stack } from '@grafana/ui';
|
||||
|
||||
import { LokiQuery, LokiQueryDirection, LokiQueryType } from '../types';
|
||||
import { LokiQueryType, LokiQueryDirection } from '../dataquery.gen';
|
||||
import { LokiQuery } from '../types';
|
||||
|
||||
export interface LokiOptionFieldsProps {
|
||||
lineLimitValue: string;
|
||||
|
||||
@@ -5,9 +5,10 @@ import { cloneDeep, defaultsDeep } from 'lodash';
|
||||
import { CoreApp } from '@grafana/data';
|
||||
import { QueryEditorMode } from '@grafana/plugin-ui';
|
||||
|
||||
import { LokiQueryType } from '../dataquery.gen';
|
||||
import { createLokiDatasource } from '../mocks/datasource';
|
||||
import { EXPLAIN_LABEL_FILTER_CONTENT } from '../querybuilder/components/LokiQueryBuilderExplained';
|
||||
import { LokiQuery, LokiQueryType } from '../types';
|
||||
import { LokiQuery } from '../types';
|
||||
|
||||
import { LokiQueryEditor } from './LokiQueryEditor';
|
||||
import { LokiQueryEditorProps } from './types';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { dateTime, getDefaultTimeRange } from '@grafana/data';
|
||||
|
||||
import { LokiQueryType } from '../types';
|
||||
import { LokiQueryType } from '../dataquery.gen';
|
||||
|
||||
import { shouldUpdateStats } from './stats';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { DateTime, isDateTime, TimeRange } from '@grafana/data';
|
||||
|
||||
import { LokiQueryType } from '../types';
|
||||
import { LokiQueryType } from '../dataquery.gen';
|
||||
|
||||
/**
|
||||
* This function compares two time values. If the first is absolute, it compares them using `DateTime.isSame`.
|
||||
|
||||
@@ -33,11 +33,12 @@ import {
|
||||
} from '@grafana/runtime';
|
||||
|
||||
import { LokiVariableSupport } from './LokiVariableSupport';
|
||||
import { LokiQueryType, SupportingQueryType } from './dataquery.gen';
|
||||
import { LokiDatasource, REF_ID_DATA_SAMPLES } from './datasource';
|
||||
import { createLokiDatasource } from './mocks/datasource';
|
||||
import { createMetadataRequest } from './mocks/metadataRequest';
|
||||
import { runSplitQuery } from './querySplitting';
|
||||
import { LokiOptions, LokiQuery, LokiQueryType, LokiVariableQueryType, SupportingQueryType } from './types';
|
||||
import { LokiOptions, LokiQuery, LokiVariableQueryType } from './types';
|
||||
|
||||
jest.mock('@grafana/runtime', () => {
|
||||
return {
|
||||
|
||||
@@ -54,6 +54,7 @@ import { LokiVariableSupport } from './LokiVariableSupport';
|
||||
import { transformBackendResult } from './backendResultTransformer';
|
||||
import { LokiAnnotationsQueryEditor } from './components/AnnotationsQueryEditor';
|
||||
import { placeHolderScopedVars } from './components/monaco-query-field/monaco-completion-provider/validation';
|
||||
import { LokiQueryType, SupportingQueryType } from './dataquery.gen';
|
||||
import { escapeLabelValueInSelector, isRegexSelector, getLabelTypeFromFrame } from './languageUtils';
|
||||
import { labelNamesRegex, labelValuesRegex } from './migrations/variableQueryMigrations';
|
||||
import {
|
||||
@@ -88,15 +89,7 @@ import { replaceVariables, returnVariables } from './querybuilder/parsingUtils';
|
||||
import { runShardSplitQuery } from './shardQuerySplitting';
|
||||
import { convertToWebSocketUrl, doLokiChannelStream } from './streaming';
|
||||
import { trackQuery } from './tracking';
|
||||
import {
|
||||
LokiOptions,
|
||||
LokiQuery,
|
||||
LokiQueryType,
|
||||
LokiVariableQuery,
|
||||
LokiVariableQueryType,
|
||||
QueryStats,
|
||||
SupportingQueryType,
|
||||
} from './types';
|
||||
import { LokiOptions, LokiQuery, LokiVariableQuery, LokiVariableQueryType, QueryStats } from './types';
|
||||
|
||||
export type RangeQueryOptions = DataQueryRequest<LokiQuery> | AnnotationQueryRequest<LokiQuery>;
|
||||
export const DEFAULT_MAX_LINES = 1000;
|
||||
|
||||
@@ -3,13 +3,14 @@ import { of } from 'rxjs';
|
||||
import { DataQueryError, DataQueryRequest, DataQueryResponse, dateTime, LoadingState } from '@grafana/data';
|
||||
import { config } from '@grafana/runtime';
|
||||
|
||||
import { LokiQueryType, LokiQueryDirection } from './dataquery.gen';
|
||||
import { LokiDatasource } from './datasource';
|
||||
import { createLokiDatasource } from './mocks/datasource';
|
||||
import { getMockFrames } from './mocks/frames';
|
||||
import { runSplitQuery } from './querySplitting';
|
||||
import { LOKI_MAX_QUERY_BYTES_READ_ERROR_MSG_PREFIX, LOKI_TIMEOUT_ERROR_MSG } from './responseUtils';
|
||||
import { trackGroupedQueries } from './tracking';
|
||||
import { LokiQuery, LokiQueryDirection, LokiQueryType } from './types';
|
||||
import { LokiQuery } from './types';
|
||||
|
||||
jest.mock('./tracking');
|
||||
jest.mock('uuid', () => ({
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
} from '@grafana/data';
|
||||
import { config } from '@grafana/runtime';
|
||||
|
||||
import { LokiQueryType, LokiQueryDirection } from './dataquery.gen';
|
||||
import { LokiDatasource } from './datasource';
|
||||
import { splitTimeRange as splitLogsTimeRange } from './logsTimeSplitting';
|
||||
import { combineResponses } from './mergeResponses';
|
||||
@@ -22,7 +23,7 @@ import { splitTimeRange as splitMetricTimeRange } from './metricTimeSplitting';
|
||||
import { addQueryLimitsContext, isLogsQuery, isQueryWithRangeVariable } from './queryUtils';
|
||||
import { isRetriableError } from './responseUtils';
|
||||
import { trackGroupedQueries } from './tracking';
|
||||
import { LokiGroupedRequest, LokiQuery, LokiQueryDirection, LokiQueryType } from './types';
|
||||
import { LokiGroupedRequest, LokiQuery } from './types';
|
||||
|
||||
export function partitionTimeRange(
|
||||
isLogsQuery: boolean,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { String } from '@grafana/lezer-logql';
|
||||
|
||||
import { LokiQueryType, LokiQueryDirection } from './dataquery.gen';
|
||||
import {
|
||||
getHighlighterExpressionsFromQuery,
|
||||
getLokiQueryType,
|
||||
@@ -20,7 +21,7 @@ import {
|
||||
interpolateShardingSelector,
|
||||
requestSupportsSharding,
|
||||
} from './queryUtils';
|
||||
import { LokiQuery, LokiQueryDirection, LokiQueryType } from './types';
|
||||
import { LokiQuery } from './types';
|
||||
|
||||
describe('getHighlighterExpressionsFromQuery', () => {
|
||||
it('returns no expressions for empty query', () => {
|
||||
|
||||
@@ -29,9 +29,10 @@ import {
|
||||
} from '@grafana/lezer-logql';
|
||||
import { DataQuery } from '@grafana/schema';
|
||||
|
||||
import { LokiQueryType, LokiQueryDirection } from './dataquery.gen';
|
||||
import { addDropToQuery, addLabelToQuery, getStreamSelectorPositions, NodePosition } from './modifyQuery';
|
||||
import { ErrorId } from './querybuilder/parsingUtils';
|
||||
import { LabelType, LokiQuery, LokiQueryDirection, LokiQueryType } from './types';
|
||||
import { LabelType, LokiQuery } from './types';
|
||||
|
||||
/**
|
||||
* Returns search terms from a LogQL query.
|
||||
|
||||
+2
-1
@@ -4,8 +4,9 @@ import userEvent from '@testing-library/user-event';
|
||||
import { CoreApp, LogSortOrderChangeEvent, LogsSortOrder, store } from '@grafana/data';
|
||||
import { config, getAppEvents } from '@grafana/runtime';
|
||||
|
||||
import { LokiQueryType, LokiQueryDirection } from '../../dataquery.gen';
|
||||
import { createLokiDatasource } from '../../mocks/datasource';
|
||||
import { LokiQuery, LokiQueryDirection, LokiQueryType } from '../../types';
|
||||
import { LokiQuery } from '../../types';
|
||||
|
||||
import { LokiQueryBuilderOptions, Props } from './LokiQueryBuilderOptions';
|
||||
|
||||
|
||||
+2
-1
@@ -14,9 +14,10 @@ import {
|
||||
queryTypeOptions,
|
||||
} from '../../components/LokiOptionFields';
|
||||
import { placeHolderScopedVars } from '../../components/monaco-query-field/monaco-completion-provider/validation';
|
||||
import { LokiQueryDirection, LokiQueryType } from '../../dataquery.gen';
|
||||
import { LokiDatasource } from '../../datasource';
|
||||
import { getLokiQueryType, isLogsQuery } from '../../queryUtils';
|
||||
import { LokiQuery, LokiQueryDirection, LokiQueryType, QueryStats } from '../../types';
|
||||
import { LokiQuery, QueryStats } from '../../types';
|
||||
|
||||
export interface Props {
|
||||
query: LokiQuery;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { QueryEditorMode } from '@grafana/plugin-ui';
|
||||
|
||||
import { LokiQuery, LokiQueryType } from '../types';
|
||||
import { LokiQueryType } from '../dataquery.gen';
|
||||
import { LokiQuery } from '../types';
|
||||
|
||||
const queryEditorModeDefaultLocalStorageKey = 'LokiQueryEditorModeDefault';
|
||||
|
||||
|
||||
@@ -3,12 +3,13 @@ import { of } from 'rxjs';
|
||||
import { DataQueryRequest, DataQueryResponse, dateTime, LoadingState } from '@grafana/data';
|
||||
import { config } from '@grafana/runtime';
|
||||
|
||||
import { LokiQueryDirection, LokiQueryType } from './dataquery.gen';
|
||||
import { LokiDatasource } from './datasource';
|
||||
import { createLokiDatasource } from './mocks/datasource';
|
||||
import { getMockFrames } from './mocks/frames';
|
||||
import { LOKI_MAX_QUERY_BYTES_READ_ERROR_MSG_PREFIX, LOKI_TIMEOUT_ERROR_MSG } from './responseUtils';
|
||||
import { runShardSplitQuery } from './shardQuerySplitting';
|
||||
import { LokiQuery, LokiQueryDirection, LokiQueryType } from './types';
|
||||
import { LokiQuery } from './types';
|
||||
|
||||
jest.mock('uuid', () => ({
|
||||
v4: jest.fn().mockReturnValue('uuid'),
|
||||
|
||||
@@ -2,6 +2,7 @@ import { CoreApp, DashboardLoadedEvent, DataQueryRequest, DataQueryResponse } fr
|
||||
import { QueryEditorMode } from '@grafana/plugin-ui';
|
||||
import { reportInteraction, config } from '@grafana/runtime';
|
||||
|
||||
import { LokiQueryType } from './dataquery.gen';
|
||||
import {
|
||||
REF_ID_STARTER_ANNOTATION,
|
||||
REF_ID_DATA_SAMPLES,
|
||||
@@ -12,7 +13,7 @@ import {
|
||||
import pluginJson from './plugin.json';
|
||||
import { getNormalizedLokiQuery, isLogsQuery, obfuscate } from './queryUtils';
|
||||
import { variableRegex } from './querybuilder/parsingUtils';
|
||||
import { LokiGroupedRequest, LokiQuery, LokiQueryType } from './types';
|
||||
import { LokiGroupedRequest, LokiQuery } from './types';
|
||||
|
||||
type LokiOnDashboardLoadedTrackingEvent = {
|
||||
grafana_version?: string;
|
||||
|
||||
@@ -7,8 +7,6 @@ import {
|
||||
LokiQueryDirection,
|
||||
} from './dataquery.gen';
|
||||
|
||||
export { LokiQueryDirection, LokiQueryType, SupportingQueryType };
|
||||
|
||||
export enum LokiResultType {
|
||||
Stream = 'streams',
|
||||
Vector = 'vector',
|
||||
|
||||
Reference in New Issue
Block a user