Submit
Path:
~
/
/
usr
/
share
/
grafana
/
public
/
build
/
File Content:
6587.bfb1ca0c32c6f325b0df.js.map
{"version":3,"file":"6587.bfb1ca0c32c6f325b0df.js","mappings":"8LAMA,SAASA,EAAS,CAAE,MAAAC,EAAO,SAAAC,EAAU,UAAAC,CAAU,EAAG,CAChD,MAAMC,KAAQ,OAAU,EAClBC,EAASC,EAAUF,CAAK,EACxBG,EAAc,cAAgBN,EAAOC,EAAS,QAASA,EAAS,IAAI,EAC1E,OAAuB,gBACrB,MACA,CACE,aAAW,MAAGG,EAAO,YAAa,yBAA0BF,CAAS,EACrE,aAAc,WACd,wBAAyB,CAAE,OAAQ,KAAS,SAASI,CAAW,CAAE,CACpE,CACF,CACF,CACA,MAAMD,EAAaF,IACV,CACL,eAAa,OAAI,CACf,WAAYA,EAAM,WAAW,oBAC7B,SAAUA,EAAM,WAAW,UAAU,QACvC,CAAC,CACH,E,6MCHK,MAAMI,EAA0D,CACrE,CAAE,MAAO,KAAc,MAAO,MAAO,QAAS,YAAa,iCAAkC,EAC7F,CACE,MAAO,KAAc,QACrB,MAAO,UACP,YAAa,kFACf,CACF,EAEI,IAAO,eAAe,2BACxBA,EAAiB,KAAK,CACpB,MAAO,KAAc,OACrB,MAAO,SACP,YAAa,qDACf,CAAC,EAQI,MAAMC,GAAqD,CALP,CACzD,MAAO,EACP,MAAO,KACT,CAEqF,EAAE,UACrF,QAAI,CAAC,EAAG,EAAG,EAAG,EAAG,EAAE,EAAIC,IAAmB,CACxC,MAAAA,EACA,MAAO,KAAOA,CAChB,EAAE,CACJ,EAEO,SAASC,GAAiBC,EAA8B,CAC7D,KAAM,CAAE,eAAAC,EAAgB,WAAAC,EAAY,WAAAC,EAAY,UAAAC,GAAW,SAAAC,EAAS,EAAIL,EAClEX,EAAQW,EAAM,OAAS,CAAC,EACxBM,MAAY,MAAiBjB,CAAK,EAExC,SAASkB,GAAmBT,EAAe,CACzC,MAAMU,EAAY,CAAE,GAAGnB,EAAO,SAAUo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AAO6+B,IAAQ7+B,EAAK,QAAQ,QAAQ,KAAK,KAAOkkC,IAItE,OAAQlkC,EAAK,KAAK,GAAI,CACpB,KAAKoiC,GACH,OAAAtT,EAAYkZ,GAAiBhoC,EAAM5D,CAAK,EACjC,GAET,KAAK0iC,GACH,OAAAhQ,EAAYqX,EAAcnmC,EAAM5D,CAAK,EAC9B,EACX,CACF,CACF,CAAC,EAEMkpC,EAAcxW,CAAS,CAChC,C","sources":["webpack://grafana/./node_modules/@grafana/experimental/dist/esm/VisualQueryBuilder/components/RawQuery.js","webpack://grafana/./public/app/plugins/datasource/loki/components/LokiOptionFields.tsx","webpack://grafana/./public/app/plugins/datasource/loki/components/monaco-query-field/MonacoQueryFieldLazy.tsx","webpack://grafana/./public/app/plugins/datasource/loki/components/monaco-query-field/MonacoQueryFieldWrapper.tsx","webpack://grafana/./public/app/plugins/datasource/loki/components/LokiQueryField.tsx","webpack://grafana/./public/app/plugins/datasource/loki/components/monaco-query-field/monaco-completion-provider/validation.ts","webpack://grafana/./node_modules/lru-cache/dist/esm/index.js","webpack://grafana/./public/app/plugins/datasource/loki/LanguageProvider.ts","webpack://grafana/./node_modules/rxjs/dist/esm5/internal/observable/dom/WebSocketSubject.js","webpack://grafana/./node_modules/rxjs/dist/esm5/internal/observable/dom/webSocket.js","webpack://grafana/./node_modules/uuid/dist/esm-browser/parse.js","webpack://grafana/./node_modules/uuid/dist/esm-browser/v35.js","webpack://grafana/./node_modules/uuid/dist/esm-browser/sha1.js","webpack://grafana/./node_modules/uuid/dist/esm-browser/v5.js","webpack://grafana/./public/app/plugins/datasource/loki/liveStreamsResultTransformer.ts","webpack://grafana/./public/app/plugins/datasource/loki/LiveStreams.ts","webpack://grafana/./public/app/plugins/datasource/loki/components/LokiContextUi.tsx","webpack://grafana/./public/app/plugins/datasource/loki/sortDataFrame.ts","webpack://grafana/./public/app/plugins/datasource/loki/LogContextProvider.ts","webpack://grafana/./public/app/plugins/datasource/loki/migrations/variableQueryMigrations.ts","webpack://grafana/./public/app/plugins/datasource/loki/components/VariableQueryEditor.tsx","webpack://grafana/./public/app/plugins/datasource/loki/LokiVariableSupport.ts","webpack://grafana/./public/app/plugins/datasource/loki/getDerivedFields.ts","webpack://grafana/./public/app/plugins/datasource/loki/makeTableFrames.ts","webpack://grafana/./public/app/plugins/datasource/loki/backendResultTransformer.ts","webpack://grafana/./public/app/plugins/datasource/loki/components/AnnotationsQueryEditor.tsx","webpack://grafana/./public/app/plugins/datasource/loki/queryHints.ts","webpack://grafana/./public/app/plugins/datasource/loki/logsTimeSplitting.ts","webpack://grafana/./public/app/plugins/datasource/loki/metricTimeSplitting.ts","webpack://grafana/./public/app/plugins/datasource/loki/querySplitting.ts","webpack://grafana/./public/app/plugins/datasource/loki/streaming.ts","webpack://grafana/./public/app/plugins/datasource/loki/datasource.ts","webpack://grafana/./public/app/plugins/datasource/loki/modifyQuery.ts","webpack://grafana/./public/app/plugins/datasource/loki/queryUtils.ts","webpack://grafana/./node_modules/@grafana/experimental/dist/esm/VisualQueryBuilder/QueryModellerBase.js","webpack://grafana/./public/app/plugins/datasource/loki/querybuilder/LokiQueryModeller.ts","webpack://grafana/./public/app/plugins/datasource/loki/querybuilder/binaryScalarOperations.ts","webpack://grafana/./public/app/plugins/datasource/loki/querybuilder/components/UnwrapParamEditor.tsx","webpack://grafana/./public/app/plugins/datasource/loki/querybuilder/operations.ts","webpack://grafana/./public/app/plugins/datasource/loki/querybuilder/parsing.ts","webpack://grafana/./public/app/plugins/datasource/loki/querybuilder/parsingUtils.ts","webpack://grafana/./public/app/plugins/datasource/loki/lineParser.ts","webpack://grafana/./public/app/plugins/datasource/loki/responseUtils.ts","webpack://grafana/./public/app/plugins/datasource/loki/tracking.ts","webpack://grafana/./node_modules/uuid/dist/esm-browser/regex.js","webpack://grafana/./node_modules/uuid/dist/esm-browser/validate.js","webpack://grafana/./node_modules/@grafana/lezer-logql/index.es.js"],"sourcesContent":["import { cx, css } from '@emotion/css';\nimport Prism from 'prismjs';\nimport React__default from 'react';\nimport { textUtil } from '@grafana/data';\nimport { useTheme2 } from '@grafana/ui';\n\nfunction RawQuery({ query, language, className }) {\n const theme = useTheme2();\n const styles = getStyles(theme);\n const highlighted = Prism.highlight(query, language.grammar, language.name);\n return /* @__PURE__ */ React__default.createElement(\n \"div\",\n {\n className: cx(styles.editorField, \"prism-syntax-highlight\", className),\n \"aria-label\": \"selector\",\n dangerouslySetInnerHTML: { __html: textUtil.sanitize(highlighted) }\n }\n );\n}\nconst getStyles = (theme) => {\n return {\n editorField: css({\n fontFamily: theme.typography.fontFamilyMonospace,\n fontSize: theme.typography.bodySmall.fontSize\n })\n };\n};\n\nexport { RawQuery };\n//# sourceMappingURL=RawQuery.js.map\n","// Libraries\nimport { css, cx } from '@emotion/css';\nimport { map } from 'lodash';\nimport React, { memo } from 'react';\n\n// Types\nimport { SelectableValue } from '@grafana/data';\nimport { config } from '@grafana/runtime';\nimport { InlineFormLabel, RadioButtonGroup, InlineField, Input, Select } from '@grafana/ui';\n\nimport { getLokiQueryType } from '../queryUtils';\nimport { LokiQuery, LokiQueryType } from '../types';\n\nexport interface LokiOptionFieldsProps {\n lineLimitValue: string;\n resolution: number;\n query: LokiQuery;\n onChange: (value: LokiQuery) => void;\n onRunQuery: () => void;\n runOnBlur?: boolean;\n}\n\nexport const queryTypeOptions: Array<SelectableValue<LokiQueryType>> = [\n { value: LokiQueryType.Range, label: 'Range', description: 'Run query over a range of time.' },\n {\n value: LokiQueryType.Instant,\n label: 'Instant',\n description: 'Run query against a single point in time. For this query, the \"To\" time is used.',\n },\n];\n\nif (config.featureToggles.lokiExperimentalStreaming) {\n queryTypeOptions.push({\n value: LokiQueryType.Stream,\n label: 'Stream',\n description: 'Run a query and keep sending results on an interval',\n });\n}\n\nexport const DEFAULT_RESOLUTION: SelectableValue<number> = {\n value: 1,\n label: '1/1',\n};\n\nexport const RESOLUTION_OPTIONS: Array<SelectableValue<number>> = [DEFAULT_RESOLUTION].concat(\n map([2, 3, 4, 5, 10], (value: number) => ({\n value,\n label: '1/' + value,\n }))\n);\n\nexport function LokiOptionFields(props: LokiOptionFieldsProps) {\n const { lineLimitValue, resolution, onRunQuery, runOnBlur, onChange } = props;\n const query = props.query ?? {};\n const queryType = getLokiQueryType(query);\n\n function onChangeQueryLimit(value: string) {\n const nextQuery = { ...query, maxLines: preprocessMaxLines(value) };\n onChange(nextQuery);\n }\n\n function onQueryTypeChange(queryType: LokiQueryType) {\n const { instant, range, ...rest } = query;\n onChange({ ...rest, queryType });\n }\n\n function onMaxLinesChange(e: React.SyntheticEvent<HTMLInputElement>) {\n if (query.maxLines !== preprocessMaxLines(e.currentTarget.value)) {\n onChangeQueryLimit(e.currentTarget.value);\n }\n }\n\n function onReturnKeyDown(e: React.KeyboardEvent<HTMLInputElement>) {\n if (e.key === 'Enter') {\n onRunQuery();\n }\n }\n\n function onResolutionChange(option: SelectableValue<number>) {\n const nextQuery = { ...query, resolution: option.value };\n onChange(nextQuery);\n }\n\n return (\n <div aria-label=\"Loki extra field\" className=\"gf-form-inline\">\n {/*Query type field*/}\n <div\n data-testid=\"queryTypeField\"\n className={cx(\n 'gf-form explore-input-margin',\n css`\n flex-wrap: nowrap;\n `\n )}\n aria-label=\"Query type field\"\n >\n <InlineFormLabel width=\"auto\">Query type</InlineFormLabel>\n\n <RadioButtonGroup\n options={queryTypeOptions}\n value={queryType}\n onChange={(type: LokiQueryType) => {\n onQueryTypeChange(type);\n if (runOnBlur) {\n onRunQuery();\n }\n }}\n />\n </div>\n {/*Line limit field*/}\n <div\n data-testid=\"lineLimitField\"\n className={cx(\n 'gf-form',\n css`\n flex-wrap: nowrap;\n `\n )}\n aria-label=\"Line limit field\"\n >\n <InlineField label=\"Line limit\" tooltip={'Upper limit for number of log lines returned by query.'}>\n <Input\n className=\"width-4\"\n placeholder=\"auto\"\n type=\"number\"\n min={0}\n onChange={onMaxLinesChange}\n onKeyDown={onReturnKeyDown}\n value={lineLimitValue}\n onBlur={() => {\n if (runOnBlur) {\n onRunQuery();\n }\n }}\n />\n </InlineField>\n <InlineField\n label=\"Resolution\"\n tooltip={\n 'Resolution 1/1 sets step parameter of Loki metrics range queries such that each pixel corresponds to one data point. For better performance, lower resolutions can be picked. 1/2 only retrieves a data point for every other pixel, and 1/10 retrieves one data point per 10 pixels.'\n }\n >\n <Select\n isSearchable={false}\n onChange={onResolutionChange}\n options={RESOLUTION_OPTIONS}\n value={resolution}\n aria-label=\"Select resolution\"\n />\n </InlineField>\n </div>\n </div>\n );\n}\n\nexport default memo(LokiOptionFields);\n\nexport function preprocessMaxLines(value: string): number | undefined {\n const maxLines = parseInt(value, 10);\n if (isNaN(maxLines) || maxLines < 0) {\n return undefined;\n }\n\n return maxLines;\n}\n","import React, { Suspense } from 'react';\n\nimport { Props } from './MonacoQueryFieldProps';\n\nconst Field = React.lazy(() => import(/* webpackChunkName: \"loki-query-field\" */ './MonacoQueryField'));\n\nexport const MonacoQueryFieldLazy = (props: Props) => {\n return (\n <Suspense fallback={null}>\n <Field {...props} />\n </Suspense>\n );\n};\n","import React, { useRef } from 'react';\n\nimport { MonacoQueryFieldLazy } from './MonacoQueryFieldLazy';\nimport { Props as MonacoProps } from './MonacoQueryFieldProps';\n\nexport type Props = Omit<MonacoProps, 'onRunQuery' | 'onBlur'> & {\n onChange: (query: string) => void;\n onRunQuery: () => void;\n onQueryType?: (query: string) => void;\n};\n\nexport const MonacoQueryFieldWrapper = (props: Props) => {\n const lastRunValueRef = useRef<string | null>(null);\n const { onRunQuery, onChange, ...rest } = props;\n\n const handleRunQuery = (value: string) => {\n lastRunValueRef.current = value;\n onChange(value);\n onRunQuery();\n };\n\n const handleBlur = (value: string) => {\n onChange(value);\n };\n\n return <MonacoQueryFieldLazy onRunQuery={handleRunQuery} onBlur={handleBlur} onChange={onChange} {...rest} />;\n};\n","import React, { ReactNode } from 'react';\n\nimport { QueryEditorProps } from '@grafana/data';\n\nimport { LokiDatasource } from '../datasource';\nimport { shouldRefreshLabels } from '../languageUtils';\nimport { LokiQuery, LokiOptions } from '../types';\n\nimport { MonacoQueryFieldWrapper } from './monaco-query-field/MonacoQueryFieldWrapper';\n\nexport interface LokiQueryFieldProps extends QueryEditorProps<LokiDatasource, LokiQuery, LokiOptions> {\n ExtraFieldElement?: ReactNode;\n placeholder?: string;\n 'data-testid'?: string;\n}\n\ninterface LokiQueryFieldState {\n labelsLoaded: boolean;\n}\n\nexport class LokiQueryField extends React.PureComponent<LokiQueryFieldProps, LokiQueryFieldState> {\n _isMounted = false;\n\n constructor(props: LokiQueryFieldProps) {\n super(props);\n\n this.state = { labelsLoaded: false };\n }\n\n async componentDidMount() {\n this._isMounted = true;\n await this.props.datasource.languageProvider.start(this.props.range);\n if (this._isMounted) {\n this.setState({ labelsLoaded: true });\n }\n }\n\n componentWillUnmount() {\n this._isMounted = false;\n }\n\n componentDidUpdate(prevProps: LokiQueryFieldProps) {\n const {\n range,\n datasource: { languageProvider },\n } = this.props;\n const refreshLabels = shouldRefreshLabels(range, prevProps.range);\n // We want to refresh labels when range changes (we round up intervals to a minute)\n if (refreshLabels) {\n languageProvider.fetchLabels({ timeRange: range });\n }\n }\n\n onChangeQuery = (value: string, override?: boolean) => {\n // Send text change to parent\n const { query, onChange, onRunQuery } = this.props;\n if (onChange) {\n const nextQuery = { ...query, expr: value };\n onChange(nextQuery);\n\n if (override && onRunQuery) {\n onRunQuery();\n }\n }\n };\n\n render() {\n const { ExtraFieldElement, query, datasource, history, onRunQuery, range } = this.props;\n const placeholder = this.props.placeholder ?? 'Enter a Loki query (run with Shift+Enter)';\n\n return (\n <>\n <div\n className=\"gf-form-inline gf-form-inline--xs-view-flex-column flex-grow-1\"\n data-testid={this.props['data-testid']}\n >\n <div className=\"gf-form--grow flex-shrink-1 min-width-15\">\n <MonacoQueryFieldWrapper\n datasource={datasource}\n history={history ?? []}\n onChange={this.onChangeQuery}\n onRunQuery={onRunQuery}\n initialValue={query.expr ?? ''}\n placeholder={placeholder}\n timeRange={range}\n />\n </div>\n </div>\n {ExtraFieldElement}\n </>\n );\n }\n}\n","import { SyntaxNode } from '@lezer/common';\nimport { LRParser } from '@lezer/lr';\n\nimport { ErrorId } from '../../../querybuilder/parsingUtils';\n\ninterface ParserErrorBoundary {\n startLineNumber: number;\n startColumn: number;\n endLineNumber: number;\n endColumn: number;\n error: string;\n}\n\ninterface ParseError {\n text: string;\n node: SyntaxNode;\n}\n\n/**\n * Conceived to work in combination with the MonacoQueryField component.\n * Given an original query, and it's interpolated version, it will return an array of ParserErrorBoundary\n * objects containing nodes which are actual errors. The interpolated version (even with placeholder variables)\n * is required because variables look like errors for Lezer.\n * @internal\n */\nexport function validateQuery(\n query: string,\n interpolatedQuery: string,\n queryLines: string[],\n parser: LRParser\n): ParserErrorBoundary[] | false {\n if (!query) {\n return false;\n }\n\n /**\n * To provide support to variable interpolation in query validation, we run the parser in the interpolated\n * query. If there are errors there, we trace them back to the original unparsed query, so we can more\n * accurately highlight the error in the query, since it's likely that the variable name and variable value\n * have different lengths. With this, we also exclude irrelevant parser errors that are produced by\n * lezer not understanding $variables and $__variables, which usually generate 2 or 3 error SyntaxNode.\n */\n const interpolatedErrors: ParseError[] = parseQuery(interpolatedQuery, parser);\n if (!interpolatedErrors.length) {\n return false;\n }\n\n let parseErrors: ParseError[] = interpolatedErrors;\n if (query !== interpolatedQuery) {\n const queryErrors: ParseError[] = parseQuery(query, parser);\n parseErrors = interpolatedErrors.flatMap(\n (interpolatedError) =>\n queryErrors.filter((queryError) => interpolatedError.text === queryError.text) || interpolatedError\n );\n }\n\n return parseErrors.map((parseError) => findErrorBoundary(query, queryLines, parseError)).filter(isErrorBoundary);\n}\n\nfunction parseQuery(query: string, parser: LRParser) {\n const parseErrors: ParseError[] = [];\n const tree = parser.parse(query);\n tree.iterate({\n enter: (nodeRef): false | void => {\n if (nodeRef.type.id === ErrorId) {\n const node = nodeRef.node;\n parseErrors.push({\n node: node,\n text: query.substring(node.from, node.to),\n });\n }\n },\n });\n return parseErrors;\n}\n\nfunction findErrorBoundary(query: string, queryLines: string[], parseError: ParseError): ParserErrorBoundary | null {\n if (queryLines.length === 1) {\n const isEmptyString = parseError.node.from === parseError.node.to;\n const errorNode = isEmptyString && parseError.node.parent ? parseError.node.parent : parseError.node;\n const error = isEmptyString ? query.substring(errorNode.from, errorNode.to) : parseError.text;\n return {\n startLineNumber: 1,\n startColumn: errorNode.from + 1,\n endLineNumber: 1,\n endColumn: errorNode.to + 1,\n error,\n };\n }\n\n let startPos = 0,\n endPos = 0;\n for (let line = 0; line < queryLines.length; line++) {\n endPos = startPos + queryLines[line].length;\n\n if (parseError.node.from > endPos) {\n startPos += queryLines[line].length + 1;\n continue;\n }\n\n return {\n startLineNumber: line + 1,\n startColumn: parseError.node.from - startPos + 1,\n endLineNumber: line + 1,\n endColumn: parseError.node.to - startPos + 1,\n error: parseError.text,\n };\n }\n\n return null;\n}\n\nfunction isErrorBoundary(boundary: ParserErrorBoundary | null): boundary is ParserErrorBoundary {\n return boundary !== null;\n}\n\nexport const placeHolderScopedVars = {\n __interval: { text: '1s', value: '1s' },\n __rate_interval: { text: '1s', value: '1s' },\n __auto: { text: '1s', value: '1s' },\n __interval_ms: { text: '1000', value: 1000 },\n __range_ms: { text: '1000', value: 1000 },\n __range_s: { text: '1', value: 1 },\n __range: { text: '1s', value: '1s' },\n};\n","/**\n * @module LRUCache\n */\nconst perf = typeof performance === 'object' &&\n performance &&\n typeof performance.now === 'function'\n ? performance\n : Date;\nconst warned = new Set();\n/* c8 ignore start */\nconst PROCESS = (typeof process === 'object' && !!process ? process : {});\n/* c8 ignore start */\nconst emitWarning = (msg, type, code, fn) => {\n typeof PROCESS.emitWarning === 'function'\n ? PROCESS.emitWarning(msg, type, code, fn)\n : console.error(`[${code}] ${type}: ${msg}`);\n};\nlet AC = globalThis.AbortController;\nlet AS = globalThis.AbortSignal;\n/* c8 ignore start */\nif (typeof AC === 'undefined') {\n //@ts-ignore\n AS = class AbortSignal {\n onabort;\n _onabort = [];\n reason;\n aborted = false;\n addEventListener(_, fn) {\n this._onabort.push(fn);\n }\n };\n //@ts-ignore\n AC = class AbortController {\n constructor() {\n warnACPolyfill();\n }\n signal = new AS();\n abort(reason) {\n if (this.signal.aborted)\n return;\n //@ts-ignore\n this.signal.reason = reason;\n //@ts-ignore\n this.signal.aborted = true;\n //@ts-ignore\n for (const fn of this.signal._onabort) {\n fn(reason);\n }\n this.signal.onabort?.(reason);\n }\n };\n let printACPolyfillWarning = PROCESS.env?.LRU_CACHE_IGNORE_AC_WARNING !== '1';\n const warnACPolyfill = () => {\n if (!printACPolyfillWarning)\n return;\n printACPolyfillWarning = false;\n emitWarning('AbortController is not defined. If using lru-cache in ' +\n 'node 14, load an AbortController polyfill from the ' +\n '`node-abort-controller` package. A minimal polyfill is ' +\n 'provided for use by LRUCache.fetch(), but it should not be ' +\n 'relied upon in other contexts (eg, passing it to other APIs that ' +\n 'use AbortController/AbortSignal might have undesirable effects). ' +\n 'You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.', 'NO_ABORT_CONTROLLER', 'ENOTSUP', warnACPolyfill);\n };\n}\n/* c8 ignore stop */\nconst shouldWarn = (code) => !warned.has(code);\nconst TYPE = Symbol('type');\nconst isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n);\n/* c8 ignore start */\n// This is a little bit ridiculous, tbh.\n// The maximum array length is 2^32-1 or thereabouts on most JS impls.\n// And well before that point, you're caching the entire world, I mean,\n// that's ~32GB of just integers for the next/prev links, plus whatever\n// else to hold that many keys and values. Just filling the memory with\n// zeroes at init time is brutal when you get that big.\n// But why not be complete?\n// Maybe in the future, these limits will have expanded.\nconst getUintArray = (max) => !isPosInt(max)\n ? null\n : max <= Math.pow(2, 8)\n ? Uint8Array\n : max <= Math.pow(2, 16)\n ? Uint16Array\n : max <= Math.pow(2, 32)\n ? Uint32Array\n : max <= Number.MAX_SAFE_INTEGER\n ? ZeroArray\n : null;\n/* c8 ignore stop */\nclass ZeroArray extends Array {\n constructor(size) {\n super(size);\n this.fill(0);\n }\n}\nclass Stack {\n heap;\n length;\n // private constructor\n static #constructing = false;\n static create(max) {\n const HeapCls = getUintArray(max);\n if (!HeapCls)\n return [];\n Stack.#constructing = true;\n const s = new Stack(max, HeapCls);\n Stack.#constructing = false;\n return s;\n }\n constructor(max, HeapCls) {\n /* c8 ignore start */\n if (!Stack.#constructing) {\n throw new TypeError('instantiate Stack using Stack.create(n)');\n }\n /* c8 ignore stop */\n this.heap = new HeapCls(max);\n this.length = 0;\n }\n push(n) {\n this.heap[this.length++] = n;\n }\n pop() {\n return this.heap[--this.length];\n }\n}\n/**\n * Default export, the thing you're using this module to get.\n *\n * All properties from the options object (with the exception of\n * {@link OptionsBase.max} and {@link OptionsBase.maxSize}) are added as\n * normal public members. (`max` and `maxBase` are read-only getters.)\n * Changing any of these will alter the defaults for subsequent method calls,\n * but is otherwise safe.\n */\nexport class LRUCache {\n // properties coming in from the options of these, only max and maxSize\n // really *need* to be protected. The rest can be modified, as they just\n // set defaults for various methods.\n #max;\n #maxSize;\n #dispose;\n #disposeAfter;\n #fetchMethod;\n /**\n * {@link LRUCache.OptionsBase.ttl}\n */\n ttl;\n /**\n * {@link LRUCache.OptionsBase.ttlResolution}\n */\n ttlResolution;\n /**\n * {@link LRUCache.OptionsBase.ttlAutopurge}\n */\n ttlAutopurge;\n /**\n * {@link LRUCache.OptionsBase.updateAgeOnGet}\n */\n updateAgeOnGet;\n /**\n * {@link LRUCache.OptionsBase.updateAgeOnHas}\n */\n updateAgeOnHas;\n /**\n * {@link LRUCache.OptionsBase.allowStale}\n */\n allowStale;\n /**\n * {@link LRUCache.OptionsBase.noDisposeOnSet}\n */\n noDisposeOnSet;\n /**\n * {@link LRUCache.OptionsBase.noUpdateTTL}\n */\n noUpdateTTL;\n /**\n * {@link LRUCache.OptionsBase.maxEntrySize}\n */\n maxEntrySize;\n /**\n * {@link LRUCache.OptionsBase.sizeCalculation}\n */\n sizeCalculation;\n /**\n * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}\n */\n noDeleteOnFetchRejection;\n /**\n * {@link LRUCache.OptionsBase.noDeleteOnStaleGet}\n */\n noDeleteOnStaleGet;\n /**\n * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}\n */\n allowStaleOnFetchAbort;\n /**\n * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}\n */\n allowStaleOnFetchRejection;\n /**\n * {@link LRUCache.OptionsBase.ignoreFetchAbort}\n */\n ignoreFetchAbort;\n // computed properties\n #size;\n #calculatedSize;\n #keyMap;\n #keyList;\n #valList;\n #next;\n #prev;\n #head;\n #tail;\n #free;\n #disposed;\n #sizes;\n #starts;\n #ttls;\n #hasDispose;\n #hasFetchMethod;\n #hasDisposeAfter;\n /**\n * Do not call this method unless you need to inspect the\n * inner workings of the cache. If anything returned by this\n * object is modified in any way, strange breakage may occur.\n *\n * These fields are private for a reason!\n *\n * @internal\n */\n static unsafeExposeInternals(c) {\n return {\n // properties\n starts: c.#starts,\n ttls: c.#ttls,\n sizes: c.#sizes,\n keyMap: c.#keyMap,\n keyList: c.#keyList,\n valList: c.#valList,\n next: c.#next,\n prev: c.#prev,\n get head() {\n return c.#head;\n },\n get tail() {\n return c.#tail;\n },\n free: c.#free,\n // methods\n isBackgroundFetch: (p) => c.#isBackgroundFetch(p),\n backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context),\n moveToTail: (index) => c.#moveToTail(index),\n indexes: (options) => c.#indexes(options),\n rindexes: (options) => c.#rindexes(options),\n isStale: (index) => c.#isStale(index),\n };\n }\n // Protected read-only members\n /**\n * {@link LRUCache.OptionsBase.max} (read-only)\n */\n get max() {\n return this.#max;\n }\n /**\n * {@link LRUCache.OptionsBase.maxSize} (read-only)\n */\n get maxSize() {\n return this.#maxSize;\n }\n /**\n * The total computed size of items in the cache (read-only)\n */\n get calculatedSize() {\n return this.#calculatedSize;\n }\n /**\n * The number of items stored in the cache (read-only)\n */\n get size() {\n return this.#size;\n }\n /**\n * {@link LRUCache.OptionsBase.fetchMethod} (read-only)\n */\n get fetchMethod() {\n return this.#fetchMethod;\n }\n /**\n * {@link LRUCache.OptionsBase.dispose} (read-only)\n */\n get dispose() {\n return this.#dispose;\n }\n /**\n * {@link LRUCache.OptionsBase.disposeAfter} (read-only)\n */\n get disposeAfter() {\n return this.#disposeAfter;\n }\n constructor(options) {\n const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort, } = options;\n if (max !== 0 && !isPosInt(max)) {\n throw new TypeError('max option must be a nonnegative integer');\n }\n const UintArray = max ? getUintArray(max) : Array;\n if (!UintArray) {\n throw new Error('invalid max value: ' + max);\n }\n this.#max = max;\n this.#maxSize = maxSize;\n this.maxEntrySize = maxEntrySize || this.#maxSize;\n this.sizeCalculation = sizeCalculation;\n if (this.sizeCalculation) {\n if (!this.#maxSize && !this.maxEntrySize) {\n throw new TypeError('cannot set sizeCalculation without setting maxSize or maxEntrySize');\n }\n if (typeof this.sizeCalculation !== 'function') {\n throw new TypeError('sizeCalculation set to non-function');\n }\n }\n if (fetchMethod !== undefined &&\n typeof fetchMethod !== 'function') {\n throw new TypeError('fetchMethod must be a function if specified');\n }\n this.#fetchMethod = fetchMethod;\n this.#hasFetchMethod = !!fetchMethod;\n this.#keyMap = new Map();\n this.#keyList = new Array(max).fill(undefined);\n this.#valList = new Array(max).fill(undefined);\n this.#next = new UintArray(max);\n this.#prev = new UintArray(max);\n this.#head = 0;\n this.#tail = 0;\n this.#free = Stack.create(max);\n this.#size = 0;\n this.#calculatedSize = 0;\n if (typeof dispose === 'function') {\n this.#dispose = dispose;\n }\n if (typeof disposeAfter === 'function') {\n this.#disposeAfter = disposeAfter;\n this.#disposed = [];\n }\n else {\n this.#disposeAfter = undefined;\n this.#disposed = undefined;\n }\n this.#hasDispose = !!this.#dispose;\n this.#hasDisposeAfter = !!this.#disposeAfter;\n this.noDisposeOnSet = !!noDisposeOnSet;\n this.noUpdateTTL = !!noUpdateTTL;\n this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;\n this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;\n this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;\n this.ignoreFetchAbort = !!ignoreFetchAbort;\n // NB: maxEntrySize is set to maxSize if it's set\n if (this.maxEntrySize !== 0) {\n if (this.#maxSize !== 0) {\n if (!isPosInt(this.#maxSize)) {\n throw new TypeError('maxSize must be a positive integer if specified');\n }\n }\n if (!isPosInt(this.maxEntrySize)) {\n throw new TypeError('maxEntrySize must be a positive integer if specified');\n }\n this.#initializeSizeTracking();\n }\n this.allowStale = !!allowStale;\n this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;\n this.updateAgeOnGet = !!updateAgeOnGet;\n this.updateAgeOnHas = !!updateAgeOnHas;\n this.ttlResolution =\n isPosInt(ttlResolution) || ttlResolution === 0\n ? ttlResolution\n : 1;\n this.ttlAutopurge = !!ttlAutopurge;\n this.ttl = ttl || 0;\n if (this.ttl) {\n if (!isPosInt(this.ttl)) {\n throw new TypeError('ttl must be a positive integer if specified');\n }\n this.#initializeTTLTracking();\n }\n // do not allow completely unbounded caches\n if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {\n throw new TypeError('At least one of max, maxSize, or ttl is required');\n }\n if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {\n const code = 'LRU_CACHE_UNBOUNDED';\n if (shouldWarn(code)) {\n warned.add(code);\n const msg = 'TTL caching without ttlAutopurge, max, or maxSize can ' +\n 'result in unbounded memory consumption.';\n emitWarning(msg, 'UnboundedCacheWarning', code, LRUCache);\n }\n }\n }\n /**\n * Return the remaining TTL time for a given entry key\n */\n getRemainingTTL(key) {\n return this.#keyMap.has(key) ? Infinity : 0;\n }\n #initializeTTLTracking() {\n const ttls = new ZeroArray(this.#max);\n const starts = new ZeroArray(this.#max);\n this.#ttls = ttls;\n this.#starts = starts;\n this.#setItemTTL = (index, ttl, start = perf.now()) => {\n starts[index] = ttl !== 0 ? start : 0;\n ttls[index] = ttl;\n if (ttl !== 0 && this.ttlAutopurge) {\n const t = setTimeout(() => {\n if (this.#isStale(index)) {\n this.delete(this.#keyList[index]);\n }\n }, ttl + 1);\n // unref() not supported on all platforms\n /* c8 ignore start */\n if (t.unref) {\n t.unref();\n }\n /* c8 ignore stop */\n }\n };\n this.#updateItemAge = index => {\n starts[index] = ttls[index] !== 0 ? perf.now() : 0;\n };\n this.#statusTTL = (status, index) => {\n if (ttls[index]) {\n const ttl = ttls[index];\n const start = starts[index];\n /* c8 ignore next */\n if (!ttl || !start)\n return;\n status.ttl = ttl;\n status.start = start;\n status.now = cachedNow || getNow();\n const age = status.now - start;\n status.remainingTTL = ttl - age;\n }\n };\n // debounce calls to perf.now() to 1s so we're not hitting\n // that costly call repeatedly.\n let cachedNow = 0;\n const getNow = () => {\n const n = perf.now();\n if (this.ttlResolution > 0) {\n cachedNow = n;\n const t = setTimeout(() => (cachedNow = 0), this.ttlResolution);\n // not available on all platforms\n /* c8 ignore start */\n if (t.unref) {\n t.unref();\n }\n /* c8 ignore stop */\n }\n return n;\n };\n this.getRemainingTTL = key => {\n const index = this.#keyMap.get(key);\n if (index === undefined) {\n return 0;\n }\n const ttl = ttls[index];\n const start = starts[index];\n if (!ttl || !start) {\n return Infinity;\n }\n const age = (cachedNow || getNow()) - start;\n return ttl - age;\n };\n this.#isStale = index => {\n const s = starts[index];\n const t = ttls[index];\n return !!t && !!s && (cachedNow || getNow()) - s > t;\n };\n }\n // conditionally set private methods related to TTL\n #updateItemAge = () => { };\n #statusTTL = () => { };\n #setItemTTL = () => { };\n /* c8 ignore stop */\n #isStale = () => false;\n #initializeSizeTracking() {\n const sizes = new ZeroArray(this.#max);\n this.#calculatedSize = 0;\n this.#sizes = sizes;\n this.#removeItemSize = index => {\n this.#calculatedSize -= sizes[index];\n sizes[index] = 0;\n };\n this.#requireSize = (k, v, size, sizeCalculation) => {\n // provisionally accept background fetches.\n // actual value size will be checked when they return.\n if (this.#isBackgroundFetch(v)) {\n return 0;\n }\n if (!isPosInt(size)) {\n if (sizeCalculation) {\n if (typeof sizeCalculation !== 'function') {\n throw new TypeError('sizeCalculation must be a function');\n }\n size = sizeCalculation(v, k);\n if (!isPosInt(size)) {\n throw new TypeError('sizeCalculation return invalid (expect positive integer)');\n }\n }\n else {\n throw new TypeError('invalid size value (must be positive integer). ' +\n 'When maxSize or maxEntrySize is used, sizeCalculation ' +\n 'or size must be set.');\n }\n }\n return size;\n };\n this.#addItemSize = (index, size, status) => {\n sizes[index] = size;\n if (this.#maxSize) {\n const maxSize = this.#maxSize - sizes[index];\n while (this.#calculatedSize > maxSize) {\n this.#evict(true);\n }\n }\n this.#calculatedSize += sizes[index];\n if (status) {\n status.entrySize = size;\n status.totalCalculatedSize = this.#calculatedSize;\n }\n };\n }\n #removeItemSize = _i => { };\n #addItemSize = (_i, _s, _st) => { };\n #requireSize = (_k, _v, size, sizeCalculation) => {\n if (size || sizeCalculation) {\n throw new TypeError('cannot set size without setting maxSize or maxEntrySize on cache');\n }\n return 0;\n };\n *#indexes({ allowStale = this.allowStale } = {}) {\n if (this.#size) {\n for (let i = this.#tail; true;) {\n if (!this.#isValidIndex(i)) {\n break;\n }\n if (allowStale || !this.#isStale(i)) {\n yield i;\n }\n if (i === this.#head) {\n break;\n }\n else {\n i = this.#prev[i];\n }\n }\n }\n }\n *#rindexes({ allowStale = this.allowStale } = {}) {\n if (this.#size) {\n for (let i = this.#head; true;) {\n if (!this.#isValidIndex(i)) {\n break;\n }\n if (allowStale || !this.#isStale(i)) {\n yield i;\n }\n if (i === this.#tail) {\n break;\n }\n else {\n i = this.#next[i];\n }\n }\n }\n }\n #isValidIndex(index) {\n return (index !== undefined &&\n this.#keyMap.get(this.#keyList[index]) === index);\n }\n /**\n * Return a generator yielding `[key, value]` pairs,\n * in order from most recently used to least recently used.\n */\n *entries() {\n for (const i of this.#indexes()) {\n if (this.#valList[i] !== undefined &&\n this.#keyList[i] !== undefined &&\n !this.#isBackgroundFetch(this.#valList[i])) {\n yield [this.#keyList[i], this.#valList[i]];\n }\n }\n }\n /**\n * Inverse order version of {@link LRUCache.entries}\n *\n * Return a generator yielding `[key, value]` pairs,\n * in order from least recently used to most recently used.\n */\n *rentries() {\n for (const i of this.#rindexes()) {\n if (this.#valList[i] !== undefined &&\n this.#keyList[i] !== undefined &&\n !this.#isBackgroundFetch(this.#valList[i])) {\n yield [this.#keyList[i], this.#valList[i]];\n }\n }\n }\n /**\n * Return a generator yielding the keys in the cache,\n * in order from most recently used to least recently used.\n */\n *keys() {\n for (const i of this.#indexes()) {\n const k = this.#keyList[i];\n if (k !== undefined &&\n !this.#isBackgroundFetch(this.#valList[i])) {\n yield k;\n }\n }\n }\n /**\n * Inverse order version of {@link LRUCache.keys}\n *\n * Return a generator yielding the keys in the cache,\n * in order from least recently used to most recently used.\n */\n *rkeys() {\n for (const i of this.#rindexes()) {\n const k = this.#keyList[i];\n if (k !== undefined &&\n !this.#isBackgroundFetch(this.#valList[i])) {\n yield k;\n }\n }\n }\n /**\n * Return a generator yielding the values in the cache,\n * in order from most recently used to least recently used.\n */\n *values() {\n for (const i of this.#indexes()) {\n const v = this.#valList[i];\n if (v !== undefined &&\n !this.#isBackgroundFetch(this.#valList[i])) {\n yield this.#valList[i];\n }\n }\n }\n /**\n * Inverse order version of {@link LRUCache.values}\n *\n * Return a generator yielding the values in the cache,\n * in order from least recently used to most recently used.\n */\n *rvalues() {\n for (const i of this.#rindexes()) {\n const v = this.#valList[i];\n if (v !== undefined &&\n !this.#isBackgroundFetch(this.#valList[i])) {\n yield this.#valList[i];\n }\n }\n }\n /**\n * Iterating over the cache itself yields the same results as\n * {@link LRUCache.entries}\n */\n [Symbol.iterator]() {\n return this.entries();\n }\n /**\n * A String value that is used in the creation of the default string description of an object.\n * Called by the built-in method Object.prototype.toString.\n */\n [Symbol.toStringTag] = 'LRUCache';\n /**\n * Find a value for which the supplied fn method returns a truthy value,\n * similar to Array.find(). fn is called as fn(value, key, cache).\n */\n find(fn, getOptions = {}) {\n for (const i of this.#indexes()) {\n const v = this.#valList[i];\n const value = this.#isBackgroundFetch(v)\n ? v.__staleWhileFetching\n : v;\n if (value === undefined)\n continue;\n if (fn(value, this.#keyList[i], this)) {\n return this.get(this.#keyList[i], getOptions);\n }\n }\n }\n /**\n * Call the supplied function on each item in the cache, in order from\n * most recently used to least recently used. fn is called as\n * fn(value, key, cache). Does not update age or recenty of use.\n * Does not iterate over stale values.\n */\n forEach(fn, thisp = this) {\n for (const i of this.#indexes()) {\n const v = this.#valList[i];\n const value = this.#isBackgroundFetch(v)\n ? v.__staleWhileFetching\n : v;\n if (value === undefined)\n continue;\n fn.call(thisp, value, this.#keyList[i], this);\n }\n }\n /**\n * The same as {@link LRUCache.forEach} but items are iterated over in\n * reverse order. (ie, less recently used items are iterated over first.)\n */\n rforEach(fn, thisp = this) {\n for (const i of this.#rindexes()) {\n const v = this.#valList[i];\n const value = this.#isBackgroundFetch(v)\n ? v.__staleWhileFetching\n : v;\n if (value === undefined)\n continue;\n fn.call(thisp, value, this.#keyList[i], this);\n }\n }\n /**\n * Delete any stale entries. Returns true if anything was removed,\n * false otherwise.\n */\n purgeStale() {\n let deleted = false;\n for (const i of this.#rindexes({ allowStale: true })) {\n if (this.#isStale(i)) {\n this.delete(this.#keyList[i]);\n deleted = true;\n }\n }\n return deleted;\n }\n /**\n * Get the extended info about a given entry, to get its value, size, and\n * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a\n * single key. Always returns stale values, if their info is found in the\n * cache, so be sure to check for expired TTLs if relevant.\n */\n info(key) {\n const i = this.#keyMap.get(key);\n if (i === undefined)\n return undefined;\n const v = this.#valList[i];\n const value = this.#isBackgroundFetch(v)\n ? v.__staleWhileFetching\n : v;\n if (value === undefined)\n return undefined;\n const entry = { value };\n if (this.#ttls && this.#starts) {\n const ttl = this.#ttls[i];\n const start = this.#starts[i];\n if (ttl && start) {\n const remain = ttl - (perf.now() - start);\n entry.ttl = remain;\n entry.start = Date.now();\n }\n }\n if (this.#sizes) {\n entry.size = this.#sizes[i];\n }\n return entry;\n }\n /**\n * Return an array of [key, {@link LRUCache.Entry}] tuples which can be\n * passed to cache.load()\n */\n dump() {\n const arr = [];\n for (const i of this.#indexes({ allowStale: true })) {\n const key = this.#keyList[i];\n const v = this.#valList[i];\n const value = this.#isBackgroundFetch(v)\n ? v.__staleWhileFetching\n : v;\n if (value === undefined || key === undefined)\n continue;\n const entry = { value };\n if (this.#ttls && this.#starts) {\n entry.ttl = this.#ttls[i];\n // always dump the start relative to a portable timestamp\n // it's ok for this to be a bit slow, it's a rare operation.\n const age = perf.now() - this.#starts[i];\n entry.start = Math.floor(Date.now() - age);\n }\n if (this.#sizes) {\n entry.size = this.#sizes[i];\n }\n arr.unshift([key, entry]);\n }\n return arr;\n }\n /**\n * Reset the cache and load in the items in entries in the order listed.\n * Note that the shape of the resulting cache may be different if the\n * same options are not used in both caches.\n */\n load(arr) {\n this.clear();\n for (const [key, entry] of arr) {\n if (entry.start) {\n // entry.start is a portable timestamp, but we may be using\n // node's performance.now(), so calculate the offset, so that\n // we get the intended remaining TTL, no matter how long it's\n // been on ice.\n //\n // it's ok for this to be a bit slow, it's a rare operation.\n const age = Date.now() - entry.start;\n entry.start = perf.now() - age;\n }\n this.set(key, entry.value, entry);\n }\n }\n /**\n * Add a value to the cache.\n *\n * Note: if `undefined` is specified as a value, this is an alias for\n * {@link LRUCache#delete}\n */\n set(k, v, setOptions = {}) {\n if (v === undefined) {\n this.delete(k);\n return this;\n }\n const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status, } = setOptions;\n let { noUpdateTTL = this.noUpdateTTL } = setOptions;\n const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);\n // if the item doesn't fit, don't do anything\n // NB: maxEntrySize set to maxSize by default\n if (this.maxEntrySize && size > this.maxEntrySize) {\n if (status) {\n status.set = 'miss';\n status.maxEntrySizeExceeded = true;\n }\n // have to delete, in case something is there already.\n this.delete(k);\n return this;\n }\n let index = this.#size === 0 ? undefined : this.#keyMap.get(k);\n if (index === undefined) {\n // addition\n index = (this.#size === 0\n ? this.#tail\n : this.#free.length !== 0\n ? this.#free.pop()\n : this.#size === this.#max\n ? this.#evict(false)\n : this.#size);\n this.#keyList[index] = k;\n this.#valList[index] = v;\n this.#keyMap.set(k, index);\n this.#next[this.#tail] = index;\n this.#prev[index] = this.#tail;\n this.#tail = index;\n this.#size++;\n this.#addItemSize(index, size, status);\n if (status)\n status.set = 'add';\n noUpdateTTL = false;\n }\n else {\n // update\n this.#moveToTail(index);\n const oldVal = this.#valList[index];\n if (v !== oldVal) {\n if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {\n oldVal.__abortController.abort(new Error('replaced'));\n const { __staleWhileFetching: s } = oldVal;\n if (s !== undefined && !noDisposeOnSet) {\n if (this.#hasDispose) {\n this.#dispose?.(s, k, 'set');\n }\n if (this.#hasDisposeAfter) {\n this.#disposed?.push([s, k, 'set']);\n }\n }\n }\n else if (!noDisposeOnSet) {\n if (this.#hasDispose) {\n this.#dispose?.(oldVal, k, 'set');\n }\n if (this.#hasDisposeAfter) {\n this.#disposed?.push([oldVal, k, 'set']);\n }\n }\n this.#removeItemSize(index);\n this.#addItemSize(index, size, status);\n this.#valList[index] = v;\n if (status) {\n status.set = 'replace';\n const oldValue = oldVal && this.#isBackgroundFetch(oldVal)\n ? oldVal.__staleWhileFetching\n : oldVal;\n if (oldValue !== undefined)\n status.oldValue = oldValue;\n }\n }\n else if (status) {\n status.set = 'update';\n }\n }\n if (ttl !== 0 && !this.#ttls) {\n this.#initializeTTLTracking();\n }\n if (this.#ttls) {\n if (!noUpdateTTL) {\n this.#setItemTTL(index, ttl, start);\n }\n if (status)\n this.#statusTTL(status, index);\n }\n if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {\n const dt = this.#disposed;\n let task;\n while ((task = dt?.shift())) {\n this.#disposeAfter?.(...task);\n }\n }\n return this;\n }\n /**\n * Evict the least recently used item, returning its value or\n * `undefined` if cache is empty.\n */\n pop() {\n try {\n while (this.#size) {\n const val = this.#valList[this.#head];\n this.#evict(true);\n if (this.#isBackgroundFetch(val)) {\n if (val.__staleWhileFetching) {\n return val.__staleWhileFetching;\n }\n }\n else if (val !== undefined) {\n return val;\n }\n }\n }\n finally {\n if (this.#hasDisposeAfter && this.#disposed) {\n const dt = this.#disposed;\n let task;\n while ((task = dt?.shift())) {\n this.#disposeAfter?.(...task);\n }\n }\n }\n }\n #evict(free) {\n const head = this.#head;\n const k = this.#keyList[head];\n const v = this.#valList[head];\n if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) {\n v.__abortController.abort(new Error('evicted'));\n }\n else if (this.#hasDispose || this.#hasDisposeAfter) {\n if (this.#hasDispose) {\n this.#dispose?.(v, k, 'evict');\n }\n if (this.#hasDisposeAfter) {\n this.#disposed?.push([v, k, 'evict']);\n }\n }\n this.#removeItemSize(head);\n // if we aren't about to use the index, then null these out\n if (free) {\n this.#keyList[head] = undefined;\n this.#valList[head] = undefined;\n this.#free.push(head);\n }\n if (this.#size === 1) {\n this.#head = this.#tail = 0;\n this.#free.length = 0;\n }\n else {\n this.#head = this.#next[head];\n }\n this.#keyMap.delete(k);\n this.#size--;\n return head;\n }\n /**\n * Check if a key is in the cache, without updating the recency of use.\n * Will return false if the item is stale, even though it is technically\n * in the cache.\n *\n * Will not update item age unless\n * {@link LRUCache.OptionsBase.updateAgeOnHas} is set.\n */\n has(k, hasOptions = {}) {\n const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;\n const index = this.#keyMap.get(k);\n if (index !== undefined) {\n const v = this.#valList[index];\n if (this.#isBackgroundFetch(v) &&\n v.__staleWhileFetching === undefined) {\n return false;\n }\n if (!this.#isStale(index)) {\n if (updateAgeOnHas) {\n this.#updateItemAge(index);\n }\n if (status) {\n status.has = 'hit';\n this.#statusTTL(status, index);\n }\n return true;\n }\n else if (status) {\n status.has = 'stale';\n this.#statusTTL(status, index);\n }\n }\n else if (status) {\n status.has = 'miss';\n }\n return false;\n }\n /**\n * Like {@link LRUCache#get} but doesn't update recency or delete stale\n * items.\n *\n * Returns `undefined` if the item is stale, unless\n * {@link LRUCache.OptionsBase.allowStale} is set.\n */\n peek(k, peekOptions = {}) {\n const { allowStale = this.allowStale } = peekOptions;\n const index = this.#keyMap.get(k);\n if (index === undefined ||\n (!allowStale && this.#isStale(index))) {\n return;\n }\n const v = this.#valList[index];\n // either stale and allowed, or forcing a refresh of non-stale value\n return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;\n }\n #backgroundFetch(k, index, options, context) {\n const v = index === undefined ? undefined : this.#valList[index];\n if (this.#isBackgroundFetch(v)) {\n return v;\n }\n const ac = new AC();\n const { signal } = options;\n // when/if our AC signals, then stop listening to theirs.\n signal?.addEventListener('abort', () => ac.abort(signal.reason), {\n signal: ac.signal,\n });\n const fetchOpts = {\n signal: ac.signal,\n options,\n context,\n };\n const cb = (v, updateCache = false) => {\n const { aborted } = ac.signal;\n const ignoreAbort = options.ignoreFetchAbort && v !== undefined;\n if (options.status) {\n if (aborted && !updateCache) {\n options.status.fetchAborted = true;\n options.status.fetchError = ac.signal.reason;\n if (ignoreAbort)\n options.status.fetchAbortIgnored = true;\n }\n else {\n options.status.fetchResolved = true;\n }\n }\n if (aborted && !ignoreAbort && !updateCache) {\n return fetchFail(ac.signal.reason);\n }\n // either we didn't abort, and are still here, or we did, and ignored\n const bf = p;\n if (this.#valList[index] === p) {\n if (v === undefined) {\n if (bf.__staleWhileFetching) {\n this.#valList[index] = bf.__staleWhileFetching;\n }\n else {\n this.delete(k);\n }\n }\n else {\n if (options.status)\n options.status.fetchUpdated = true;\n this.set(k, v, fetchOpts.options);\n }\n }\n return v;\n };\n const eb = (er) => {\n if (options.status) {\n options.status.fetchRejected = true;\n options.status.fetchError = er;\n }\n return fetchFail(er);\n };\n const fetchFail = (er) => {\n const { aborted } = ac.signal;\n const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;\n const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;\n const noDelete = allowStale || options.noDeleteOnFetchRejection;\n const bf = p;\n if (this.#valList[index] === p) {\n // if we allow stale on fetch rejections, then we need to ensure that\n // the stale value is not removed from the cache when the fetch fails.\n const del = !noDelete || bf.__staleWhileFetching === undefined;\n if (del) {\n this.delete(k);\n }\n else if (!allowStaleAborted) {\n // still replace the *promise* with the stale value,\n // since we are done with the promise at this point.\n // leave it untouched if we're still waiting for an\n // aborted background fetch that hasn't yet returned.\n this.#valList[index] = bf.__staleWhileFetching;\n }\n }\n if (allowStale) {\n if (options.status && bf.__staleWhileFetching !== undefined) {\n options.status.returnedStale = true;\n }\n return bf.__staleWhileFetching;\n }\n else if (bf.__returned === bf) {\n throw er;\n }\n };\n const pcall = (res, rej) => {\n const fmp = this.#fetchMethod?.(k, v, fetchOpts);\n if (fmp && fmp instanceof Promise) {\n fmp.then(v => res(v === undefined ? undefined : v), rej);\n }\n // ignored, we go until we finish, regardless.\n // defer check until we are actually aborting,\n // so fetchMethod can override.\n ac.signal.addEventListener('abort', () => {\n if (!options.ignoreFetchAbort ||\n options.allowStaleOnFetchAbort) {\n res(undefined);\n // when it eventually resolves, update the cache.\n if (options.allowStaleOnFetchAbort) {\n res = v => cb(v, true);\n }\n }\n });\n };\n if (options.status)\n options.status.fetchDispatched = true;\n const p = new Promise(pcall).then(cb, eb);\n const bf = Object.assign(p, {\n __abortController: ac,\n __staleWhileFetching: v,\n __returned: undefined,\n });\n if (index === undefined) {\n // internal, don't expose status.\n this.set(k, bf, { ...fetchOpts.options, status: undefined });\n index = this.#keyMap.get(k);\n }\n else {\n this.#valList[index] = bf;\n }\n return bf;\n }\n #isBackgroundFetch(p) {\n if (!this.#hasFetchMethod)\n return false;\n const b = p;\n return (!!b &&\n b instanceof Promise &&\n b.hasOwnProperty('__staleWhileFetching') &&\n b.__abortController instanceof AC);\n }\n async fetch(k, fetchOptions = {}) {\n const { \n // get options\n allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, \n // set options\n ttl = this.ttl, noDisposeOnSet = this.noDisposeOnSet, size = 0, sizeCalculation = this.sizeCalculation, noUpdateTTL = this.noUpdateTTL, \n // fetch exclusive options\n noDeleteOnFetchRejection = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection = this.allowStaleOnFetchRejection, ignoreFetchAbort = this.ignoreFetchAbort, allowStaleOnFetchAbort = this.allowStaleOnFetchAbort, context, forceRefresh = false, status, signal, } = fetchOptions;\n if (!this.#hasFetchMethod) {\n if (status)\n status.fetch = 'get';\n return this.get(k, {\n allowStale,\n updateAgeOnGet,\n noDeleteOnStaleGet,\n status,\n });\n }\n const options = {\n allowStale,\n updateAgeOnGet,\n noDeleteOnStaleGet,\n ttl,\n noDisposeOnSet,\n size,\n sizeCalculation,\n noUpdateTTL,\n noDeleteOnFetchRejection,\n allowStaleOnFetchRejection,\n allowStaleOnFetchAbort,\n ignoreFetchAbort,\n status,\n signal,\n };\n let index = this.#keyMap.get(k);\n if (index === undefined) {\n if (status)\n status.fetch = 'miss';\n const p = this.#backgroundFetch(k, index, options, context);\n return (p.__returned = p);\n }\n else {\n // in cache, maybe already fetching\n const v = this.#valList[index];\n if (this.#isBackgroundFetch(v)) {\n const stale = allowStale && v.__staleWhileFetching !== undefined;\n if (status) {\n status.fetch = 'inflight';\n if (stale)\n status.returnedStale = true;\n }\n return stale ? v.__staleWhileFetching : (v.__returned = v);\n }\n // if we force a refresh, that means do NOT serve the cached value,\n // unless we are already in the process of refreshing the cache.\n const isStale = this.#isStale(index);\n if (!forceRefresh && !isStale) {\n if (status)\n status.fetch = 'hit';\n this.#moveToTail(index);\n if (updateAgeOnGet) {\n this.#updateItemAge(index);\n }\n if (status)\n this.#statusTTL(status, index);\n return v;\n }\n // ok, it is stale or a forced refresh, and not already fetching.\n // refresh the cache.\n const p = this.#backgroundFetch(k, index, options, context);\n const hasStale = p.__staleWhileFetching !== undefined;\n const staleVal = hasStale && allowStale;\n if (status) {\n status.fetch = isStale ? 'stale' : 'refresh';\n if (staleVal && isStale)\n status.returnedStale = true;\n }\n return staleVal ? p.__staleWhileFetching : (p.__returned = p);\n }\n }\n /**\n * Return a value from the cache. Will update the recency of the cache\n * entry found.\n *\n * If the key is not found, get() will return `undefined`.\n */\n get(k, getOptions = {}) {\n const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status, } = getOptions;\n const index = this.#keyMap.get(k);\n if (index !== undefined) {\n const value = this.#valList[index];\n const fetching = this.#isBackgroundFetch(value);\n if (status)\n this.#statusTTL(status, index);\n if (this.#isStale(index)) {\n if (status)\n status.get = 'stale';\n // delete only if not an in-flight background fetch\n if (!fetching) {\n if (!noDeleteOnStaleGet) {\n this.delete(k);\n }\n if (status && allowStale)\n status.returnedStale = true;\n return allowStale ? value : undefined;\n }\n else {\n if (status &&\n allowStale &&\n value.__staleWhileFetching !== undefined) {\n status.returnedStale = true;\n }\n return allowStale ? value.__staleWhileFetching : undefined;\n }\n }\n else {\n if (status)\n status.get = 'hit';\n // if we're currently fetching it, we don't actually have it yet\n // it's not stale, which means this isn't a staleWhileRefetching.\n // If it's not stale, and fetching, AND has a __staleWhileFetching\n // value, then that means the user fetched with {forceRefresh:true},\n // so it's safe to return that value.\n if (fetching) {\n return value.__staleWhileFetching;\n }\n this.#moveToTail(index);\n if (updateAgeOnGet) {\n this.#updateItemAge(index);\n }\n return value;\n }\n }\n else if (status) {\n status.get = 'miss';\n }\n }\n #connect(p, n) {\n this.#prev[n] = p;\n this.#next[p] = n;\n }\n #moveToTail(index) {\n // if tail already, nothing to do\n // if head, move head to next[index]\n // else\n // move next[prev[index]] to next[index] (head has no prev)\n // move prev[next[index]] to prev[index]\n // prev[index] = tail\n // next[tail] = index\n // tail = index\n if (index !== this.#tail) {\n if (index === this.#head) {\n this.#head = this.#next[index];\n }\n else {\n this.#connect(this.#prev[index], this.#next[index]);\n }\n this.#connect(this.#tail, index);\n this.#tail = index;\n }\n }\n /**\n * Deletes a key out of the cache.\n * Returns true if the key was deleted, false otherwise.\n */\n delete(k) {\n let deleted = false;\n if (this.#size !== 0) {\n const index = this.#keyMap.get(k);\n if (index !== undefined) {\n deleted = true;\n if (this.#size === 1) {\n this.clear();\n }\n else {\n this.#removeItemSize(index);\n const v = this.#valList[index];\n if (this.#isBackgroundFetch(v)) {\n v.__abortController.abort(new Error('deleted'));\n }\n else if (this.#hasDispose || this.#hasDisposeAfter) {\n if (this.#hasDispose) {\n this.#dispose?.(v, k, 'delete');\n }\n if (this.#hasDisposeAfter) {\n this.#disposed?.push([v, k, 'delete']);\n }\n }\n this.#keyMap.delete(k);\n this.#keyList[index] = undefined;\n this.#valList[index] = undefined;\n if (index === this.#tail) {\n this.#tail = this.#prev[index];\n }\n else if (index === this.#head) {\n this.#head = this.#next[index];\n }\n else {\n const pi = this.#prev[index];\n this.#next[pi] = this.#next[index];\n const ni = this.#next[index];\n this.#prev[ni] = this.#prev[index];\n }\n this.#size--;\n this.#free.push(index);\n }\n }\n }\n if (this.#hasDisposeAfter && this.#disposed?.length) {\n const dt = this.#disposed;\n let task;\n while ((task = dt?.shift())) {\n this.#disposeAfter?.(...task);\n }\n }\n return deleted;\n }\n /**\n * Clear the cache entirely, throwing away all values.\n */\n clear() {\n for (const index of this.#rindexes({ allowStale: true })) {\n const v = this.#valList[index];\n if (this.#isBackgroundFetch(v)) {\n v.__abortController.abort(new Error('deleted'));\n }\n else {\n const k = this.#keyList[index];\n if (this.#hasDispose) {\n this.#dispose?.(v, k, 'delete');\n }\n if (this.#hasDisposeAfter) {\n this.#disposed?.push([v, k, 'delete']);\n }\n }\n }\n this.#keyMap.clear();\n this.#valList.fill(undefined);\n this.#keyList.fill(undefined);\n if (this.#ttls && this.#starts) {\n this.#ttls.fill(0);\n this.#starts.fill(0);\n }\n if (this.#sizes) {\n this.#sizes.fill(0);\n }\n this.#head = 0;\n this.#tail = 0;\n this.#free.length = 0;\n this.#calculatedSize = 0;\n this.#size = 0;\n if (this.#hasDisposeAfter && this.#disposed) {\n const dt = this.#disposed;\n let task;\n while ((task = dt?.shift())) {\n this.#disposeAfter?.(...task);\n }\n }\n }\n}\n//# sourceMappingURL=index.js.map","import { flatten } from 'lodash';\nimport { LRUCache } from 'lru-cache';\n\nimport { LanguageProvider, AbstractQuery, KeyValue, getDefaultTimeRange, TimeRange } from '@grafana/data';\nimport { config } from '@grafana/runtime';\n\nimport { DEFAULT_MAX_LINES_SAMPLE, LokiDatasource } from './datasource';\nimport { abstractQueryToExpr, mapAbstractOperatorsToOp, processLabels } from './languageUtils';\nimport { getStreamSelectorsFromQuery } from './queryUtils';\nimport { buildVisualQueryFromString } from './querybuilder/parsing';\nimport {\n extractLabelKeysFromDataFrame,\n extractLogParserFromDataFrame,\n extractUnwrapLabelKeysFromDataFrame,\n} from './responseUtils';\nimport { ParserAndLabelKeysResult, LokiQuery, LokiQueryType, LabelType } from './types';\n\nconst NS_IN_MS = 1000000;\n\nexport default class LokiLanguageProvider extends LanguageProvider {\n labelKeys: string[];\n started = false;\n startedTimeRange?: TimeRange;\n datasource: LokiDatasource;\n\n /**\n * Cache for labels of series. This is bit simplistic in the sense that it just counts responses each as a 1 and does\n * not account for different size of a response. If that is needed a `length` function can be added in the options.\n * 10 as a max size is totally arbitrary right now.\n */\n private seriesCache = new LRUCache<string, Record<string, string[]>>({ max: 10 });\n private labelsCache = new LRUCache<string, string[]>({ max: 10 });\n\n constructor(datasource: LokiDatasource, initialValues?: any) {\n super();\n\n this.datasource = datasource;\n this.labelKeys = [];\n\n Object.assign(this, initialValues);\n }\n\n request = async (url: string, params?: any) => {\n try {\n return await this.datasource.metadataRequest(url, params);\n } catch (error) {\n console.error(error);\n }\n\n return undefined;\n };\n\n /**\n * Initialize the language provider by fetching set of labels.\n */\n start = (timeRange?: TimeRange) => {\n const range = timeRange ?? this.getDefaultTimeRange();\n // refetch labels if either there's not already a start task or the time range has changed\n if (\n !this.startTask ||\n this.startedTimeRange?.from.isSame(range.from) === false ||\n this.startedTimeRange?.to.isSame(range.to) === false\n ) {\n this.startedTimeRange = range;\n this.startTask = this.fetchLabels({ timeRange: range }).then(() => {\n this.started = true;\n return [];\n });\n }\n\n return this.startTask;\n };\n\n /**\n * Returns the label keys that have been fetched.\n * If labels have not been fetched yet, it will return an empty array.\n * For updated labels (which should not happen often), use fetchLabels.\n * @todo It is quite complicated to know when to use fetchLabels and when to use getLabelKeys.\n * We should consider simplifying this and use caching in the same way as with seriesCache and labelsCache\n * and just always use fetchLabels.\n * Caching should be thought out properly, so we are not fetching this often, as labelKeys should not be changing often.\n *\n * @returns {string[]} An array of label keys or an empty array if labels have not been fetched.\n */\n getLabelKeys(): string[] {\n return this.labelKeys;\n }\n\n importFromAbstractQuery(labelBasedQuery: AbstractQuery): LokiQuery {\n return {\n refId: labelBasedQuery.refId,\n expr: abstractQueryToExpr(labelBasedQuery),\n queryType: LokiQueryType.Range,\n };\n }\n\n exportToAbstractQuery(query: LokiQuery): AbstractQuery {\n if (!query.expr || query.expr.length === 0) {\n return { refId: query.refId, labelMatchers: [] };\n }\n const streamSelectors = getStreamSelectorsFromQuery(query.expr);\n\n const labelMatchers = streamSelectors.map((streamSelector) => {\n const visualQuery = buildVisualQueryFromString(streamSelector).query;\n const matchers = visualQuery.labels.map((label) => {\n return {\n name: label.label,\n value: label.value,\n operator: mapAbstractOperatorsToOp[label.op],\n };\n });\n return matchers;\n });\n\n return {\n refId: query.refId,\n labelMatchers: flatten(labelMatchers),\n };\n }\n\n /**\n * Fetch all label keys\n * This asynchronous function returns all available label keys from the data source.\n * It returns a promise that resolves to an array of strings containing the label keys.\n *\n * @param options - (Optional) An object containing additional options - currently only time range.\n * @param options.timeRange - (Optional) The time range for which you want to retrieve label keys. If not provided, the default time range is used.\n * @returns A promise containing an array of label keys.\n * @throws An error if the fetch operation fails.\n */\n async fetchLabels(options?: { timeRange?: TimeRange }): Promise<string[]> {\n const url = 'labels';\n const range = options?.timeRange ?? this.getDefaultTimeRange();\n const timeRange = this.datasource.getTimeRangeParams(range);\n\n const res = await this.request(url, timeRange);\n if (Array.isArray(res)) {\n const labels = res\n .slice()\n .sort()\n .filter((label) => label !== '__name__');\n this.labelKeys = labels;\n return this.labelKeys;\n }\n\n return [];\n }\n\n /**\n * Fetch series labels for a selector\n *\n * This method fetches labels for a given stream selector, such as `{job=\"grafana\"}`.\n * It returns a promise that resolves to a record mapping label names to their corresponding values.\n *\n * @param streamSelector - The stream selector for which you want to retrieve labels.\n * @param options - (Optional) An object containing additional options - currently only time range.\n * @param options.timeRange - (Optional) The time range for which you want to retrieve label keys. If not provided, the default time range is used.\n * @returns A promise containing a record of label names and their values.\n * @throws An error if the fetch operation fails.\n */\n fetchSeriesLabels = async (\n streamSelector: string,\n options?: { timeRange?: TimeRange }\n ): Promise<Record<string, string[]>> => {\n const interpolatedMatch = this.datasource.interpolateString(streamSelector);\n const url = 'series';\n const range = options?.timeRange ?? this.getDefaultTimeRange();\n const { start, end } = this.datasource.getTimeRangeParams(range);\n\n const cacheKey = this.generateCacheKey(url, start, end, interpolatedMatch);\n let value = this.seriesCache.get(cacheKey);\n if (!value) {\n const params = { 'match[]': interpolatedMatch, start, end };\n const data = await this.request(url, params);\n if (!Array.isArray(data)) {\n return {};\n }\n const { values } = processLabels(data);\n value = values;\n this.seriesCache.set(cacheKey, value);\n }\n return value;\n };\n\n /**\n * Fetch series for a selector. Use this for raw results. Use fetchSeriesLabels() to get labels.\n * @param match\n * @param streamSelector - The stream selector for which you want to retrieve labels.\n * @param options - (Optional) An object containing additional options.\n * @param options.timeRange - (Optional) The time range for which you want to retrieve label keys. If not provided, the default time range is used.\n * @returns A promise containing array with records of label names and their value.\n */\n fetchSeries = async (match: string, options?: { timeRange?: TimeRange }): Promise<Array<Record<string, string>>> => {\n const url = 'series';\n const range = options?.timeRange ?? this.getDefaultTimeRange();\n const { start, end } = this.datasource.getTimeRangeParams(range);\n const params = { 'match[]': match, start, end };\n return await this.request(url, params);\n };\n\n // Cache key is a bit different here. We round up to a minute the intervals.\n // The rounding may seem strange but makes relative intervals like now-1h less prone to need separate request every\n // millisecond while still actually getting all the keys for the correct interval. This still can create problems\n // when user does not the newest values for a minute if already cached.\n private generateCacheKey(url: string, start: number, end: number, param: string): string {\n return [url, this.roundTime(start), this.roundTime(end), param].join();\n }\n\n // Round nanoseconds epoch to nearest 5 minute interval\n private roundTime(nanoseconds: number): number {\n return nanoseconds ? Math.floor(nanoseconds / NS_IN_MS / 1000 / 60 / 5) : 0;\n }\n\n /**\n * Fetch label values\n *\n * This asynchronous function fetches values associated with a specified label name.\n * It returns a promise that resolves to an array of strings containing the label values.\n *\n * @param labelName - The name of the label for which you want to retrieve values.\n * @param options - (Optional) An object containing additional options.\n * @param options.streamSelector - (Optional) The stream selector to filter label values. If not provided, all label values are fetched.\n * @param options.timeRange - (Optional) The time range for which you want to retrieve label values. If not provided, the default time range is used.\n * @returns A promise containing an array of label values.\n * @throws An error if the fetch operation fails.\n */\n async fetchLabelValues(\n labelName: string,\n options?: { streamSelector?: string; timeRange?: TimeRange }\n ): Promise<string[]> {\n const label = encodeURIComponent(this.datasource.interpolateString(labelName));\n const streamParam = options?.streamSelector\n ? encodeURIComponent(this.datasource.interpolateString(options.streamSelector))\n : undefined;\n\n const url = `label/${label}/values`;\n const range = options?.timeRange ?? this.getDefaultTimeRange();\n const rangeParams = this.datasource.getTimeRangeParams(range);\n const { start, end } = rangeParams;\n const params: KeyValue<string | number> = { start, end };\n let paramCacheKey = label;\n\n if (streamParam) {\n params.query = streamParam;\n paramCacheKey += streamParam;\n }\n\n const cacheKey = this.generateCacheKey(url, start, end, paramCacheKey);\n\n let labelValues = this.labelsCache.get(cacheKey);\n if (!labelValues) {\n // Clear value when requesting new one. Empty object being truthy also makes sure we don't request twice.\n this.labelsCache.set(cacheKey, []);\n const res = await this.request(url, params);\n if (Array.isArray(res)) {\n labelValues = res.slice().sort();\n this.labelsCache.set(cacheKey, labelValues);\n }\n }\n\n return labelValues ?? [];\n }\n\n /**\n * Get parser and label keys for a selector\n *\n * This asynchronous function is used to fetch parsers and label keys for a selected log stream based on sampled lines.\n * It returns a promise that resolves to an object with the following properties:\n *\n * - `extractedLabelKeys`: An array of available label keys associated with the log stream.\n * - `hasJSON`: A boolean indicating whether JSON parsing is available for the stream.\n * - `hasLogfmt`: A boolean indicating whether Logfmt parsing is available for the stream.\n * - `hasPack`: A boolean indicating whether Pack parsing is available for the stream.\n * - `unwrapLabelKeys`: An array of label keys that can be used for unwrapping log data.\n *\n * @param streamSelector - The selector for the log stream you want to analyze.\n * @param options - (Optional) An object containing additional options.\n * @param options.maxLines - (Optional) The number of log lines requested when determining parsers and label keys.\n * @param options.timeRange - (Optional) The time range for which you want to retrieve label keys. If not provided, the default time range is used.\n * Smaller maxLines is recommended for improved query performance. The default count is 10.\n * @returns A promise containing an object with parser and label key information.\n * @throws An error if the fetch operation fails.\n */\n async getParserAndLabelKeys(\n streamSelector: string,\n options?: { maxLines?: number; timeRange?: TimeRange }\n ): Promise<ParserAndLabelKeysResult> {\n const empty = {\n extractedLabelKeys: [],\n structuredMetadataKeys: [],\n unwrapLabelKeys: [],\n hasJSON: false,\n hasLogfmt: false,\n hasPack: false,\n };\n if (!config.featureToggles.lokiQueryHints) {\n return empty;\n }\n\n const series = await this.datasource.getDataSamples(\n {\n expr: streamSelector,\n refId: 'data-samples',\n maxLines: options?.maxLines || DEFAULT_MAX_LINES_SAMPLE,\n },\n options?.timeRange ?? this.getDefaultTimeRange()\n );\n\n if (!series.length) {\n return empty;\n }\n\n const { hasLogfmt, hasJSON, hasPack } = extractLogParserFromDataFrame(series[0]);\n\n return {\n extractedLabelKeys: [\n ...extractLabelKeysFromDataFrame(series[0], LabelType.Indexed),\n ...extractLabelKeysFromDataFrame(series[0], LabelType.Parsed),\n ],\n structuredMetadataKeys: extractLabelKeysFromDataFrame(series[0], LabelType.StructuredMetadata),\n unwrapLabelKeys: extractUnwrapLabelKeysFromDataFrame(series[0]),\n hasJSON,\n hasPack,\n hasLogfmt,\n };\n }\n\n /**\n * Get the default time range\n *\n * @returns {TimeRange} The default time range\n */\n private getDefaultTimeRange(): TimeRange {\n return getDefaultTimeRange();\n }\n}\n","import { __assign, __extends } from \"tslib\";\nimport { Subject, AnonymousSubject } from '../../Subject';\nimport { Subscriber } from '../../Subscriber';\nimport { Observable } from '../../Observable';\nimport { Subscription } from '../../Subscription';\nimport { ReplaySubject } from '../../ReplaySubject';\nvar DEFAULT_WEBSOCKET_CONFIG = {\n url: '',\n deserializer: function (e) { return JSON.parse(e.data); },\n serializer: function (value) { return JSON.stringify(value); },\n};\nvar WEBSOCKETSUBJECT_INVALID_ERROR_OBJECT = 'WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }';\nvar WebSocketSubject = (function (_super) {\n __extends(WebSocketSubject, _super);\n function WebSocketSubject(urlConfigOrSource, destination) {\n var _this = _super.call(this) || this;\n _this._socket = null;\n if (urlConfigOrSource instanceof Observable) {\n _this.destination = destination;\n _this.source = urlConfigOrSource;\n }\n else {\n var config = (_this._config = __assign({}, DEFAULT_WEBSOCKET_CONFIG));\n _this._output = new Subject();\n if (typeof urlConfigOrSource === 'string') {\n config.url = urlConfigOrSource;\n }\n else {\n for (var key in urlConfigOrSource) {\n if (urlConfigOrSource.hasOwnProperty(key)) {\n config[key] = urlConfigOrSource[key];\n }\n }\n }\n if (!config.WebSocketCtor && WebSocket) {\n config.WebSocketCtor = WebSocket;\n }\n else if (!config.WebSocketCtor) {\n throw new Error('no WebSocket constructor can be found');\n }\n _this.destination = new ReplaySubject();\n }\n return _this;\n }\n WebSocketSubject.prototype.lift = function (operator) {\n var sock = new WebSocketSubject(this._config, this.destination);\n sock.operator = operator;\n sock.source = this;\n return sock;\n };\n WebSocketSubject.prototype._resetState = function () {\n this._socket = null;\n if (!this.source) {\n this.destination = new ReplaySubject();\n }\n this._output = new Subject();\n };\n WebSocketSubject.prototype.multiplex = function (subMsg, unsubMsg, messageFilter) {\n var self = this;\n return new Observable(function (observer) {\n try {\n self.next(subMsg());\n }\n catch (err) {\n observer.error(err);\n }\n var subscription = self.subscribe({\n next: function (x) {\n try {\n if (messageFilter(x)) {\n observer.next(x);\n }\n }\n catch (err) {\n observer.error(err);\n }\n },\n error: function (err) { return observer.error(err); },\n complete: function () { return observer.complete(); },\n });\n return function () {\n try {\n self.next(unsubMsg());\n }\n catch (err) {\n observer.error(err);\n }\n subscription.unsubscribe();\n };\n });\n };\n WebSocketSubject.prototype._connectSocket = function () {\n var _this = this;\n var _a = this._config, WebSocketCtor = _a.WebSocketCtor, protocol = _a.protocol, url = _a.url, binaryType = _a.binaryType;\n var observer = this._output;\n var socket = null;\n try {\n socket = protocol ? new WebSocketCtor(url, protocol) : new WebSocketCtor(url);\n this._socket = socket;\n if (binaryType) {\n this._socket.binaryType = binaryType;\n }\n }\n catch (e) {\n observer.error(e);\n return;\n }\n var subscription = new Subscription(function () {\n _this._socket = null;\n if (socket && socket.readyState === 1) {\n socket.close();\n }\n });\n socket.onopen = function (evt) {\n var _socket = _this._socket;\n if (!_socket) {\n socket.close();\n _this._resetState();\n return;\n }\n var openObserver = _this._config.openObserver;\n if (openObserver) {\n openObserver.next(evt);\n }\n var queue = _this.destination;\n _this.destination = Subscriber.create(function (x) {\n if (socket.readyState === 1) {\n try {\n var serializer = _this._config.serializer;\n socket.send(serializer(x));\n }\n catch (e) {\n _this.destination.error(e);\n }\n }\n }, function (err) {\n var closingObserver = _this._config.closingObserver;\n if (closingObserver) {\n closingObserver.next(undefined);\n }\n if (err && err.code) {\n socket.close(err.code, err.reason);\n }\n else {\n observer.error(new TypeError(WEBSOCKETSUBJECT_INVALID_ERROR_OBJECT));\n }\n _this._resetState();\n }, function () {\n var closingObserver = _this._config.closingObserver;\n if (closingObserver) {\n closingObserver.next(undefined);\n }\n socket.close();\n _this._resetState();\n });\n if (queue && queue instanceof ReplaySubject) {\n subscription.add(queue.subscribe(_this.destination));\n }\n };\n socket.onerror = function (e) {\n _this._resetState();\n observer.error(e);\n };\n socket.onclose = function (e) {\n if (socket === _this._socket) {\n _this._resetState();\n }\n var closeObserver = _this._config.closeObserver;\n if (closeObserver) {\n closeObserver.next(e);\n }\n if (e.wasClean) {\n observer.complete();\n }\n else {\n observer.error(e);\n }\n };\n socket.onmessage = function (e) {\n try {\n var deserializer = _this._config.deserializer;\n observer.next(deserializer(e));\n }\n catch (err) {\n observer.error(err);\n }\n };\n };\n WebSocketSubject.prototype._subscribe = function (subscriber) {\n var _this = this;\n var source = this.source;\n if (source) {\n return source.subscribe(subscriber);\n }\n if (!this._socket) {\n this._connectSocket();\n }\n this._output.subscribe(subscriber);\n subscriber.add(function () {\n var _socket = _this._socket;\n if (_this._output.observers.length === 0) {\n if (_socket && (_socket.readyState === 1 || _socket.readyState === 0)) {\n _socket.close();\n }\n _this._resetState();\n }\n });\n return subscriber;\n };\n WebSocketSubject.prototype.unsubscribe = function () {\n var _socket = this._socket;\n if (_socket && (_socket.readyState === 1 || _socket.readyState === 0)) {\n _socket.close();\n }\n this._resetState();\n _super.prototype.unsubscribe.call(this);\n };\n return WebSocketSubject;\n}(AnonymousSubject));\nexport { WebSocketSubject };\n//# sourceMappingURL=WebSocketSubject.js.map","import { WebSocketSubject } from './WebSocketSubject';\nexport function webSocket(urlConfigOrSource) {\n return new WebSocketSubject(urlConfigOrSource);\n}\n//# sourceMappingURL=webSocket.js.map","import validate from './validate.js';\n\nfunction parse(uuid) {\n if (!validate(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n let v;\n const arr = new Uint8Array(16); // Parse ########-....-....-....-............\n\n arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;\n arr[1] = v >>> 16 & 0xff;\n arr[2] = v >>> 8 & 0xff;\n arr[3] = v & 0xff; // Parse ........-####-....-....-............\n\n arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;\n arr[5] = v & 0xff; // Parse ........-....-####-....-............\n\n arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;\n arr[7] = v & 0xff; // Parse ........-....-....-####-............\n\n arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;\n arr[9] = v & 0xff; // Parse ........-....-....-....-############\n // (Use \"/\" to avoid 32-bit truncation when bit-shifting high-order bytes)\n\n arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;\n arr[11] = v / 0x100000000 & 0xff;\n arr[12] = v >>> 24 & 0xff;\n arr[13] = v >>> 16 & 0xff;\n arr[14] = v >>> 8 & 0xff;\n arr[15] = v & 0xff;\n return arr;\n}\n\nexport default parse;","import { unsafeStringify } from './stringify.js';\nimport parse from './parse.js';\n\nfunction stringToBytes(str) {\n str = unescape(encodeURIComponent(str)); // UTF8 escape\n\n const bytes = [];\n\n for (let i = 0; i < str.length; ++i) {\n bytes.push(str.charCodeAt(i));\n }\n\n return bytes;\n}\n\nexport const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\nexport const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\nexport default function v35(name, version, hashfunc) {\n function generateUUID(value, namespace, buf, offset) {\n var _namespace;\n\n if (typeof value === 'string') {\n value = stringToBytes(value);\n }\n\n if (typeof namespace === 'string') {\n namespace = parse(namespace);\n }\n\n if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {\n throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');\n } // Compute hash of namespace and value, Per 4.3\n // Future: Use spread syntax when supported on all platforms, e.g. `bytes =\n // hashfunc([...namespace, ... value])`\n\n\n let bytes = new Uint8Array(16 + value.length);\n bytes.set(namespace);\n bytes.set(value, namespace.length);\n bytes = hashfunc(bytes);\n bytes[6] = bytes[6] & 0x0f | version;\n bytes[8] = bytes[8] & 0x3f | 0x80;\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = bytes[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(bytes);\n } // Function#name is not settable on some platforms (#270)\n\n\n try {\n generateUUID.name = name; // eslint-disable-next-line no-empty\n } catch (err) {} // For CommonJS default export support\n\n\n generateUUID.DNS = DNS;\n generateUUID.URL = URL;\n return generateUUID;\n}","// Adapted from Chris Veness' SHA1 code at\n// http://www.movable-type.co.uk/scripts/sha1.html\nfunction f(s, x, y, z) {\n switch (s) {\n case 0:\n return x & y ^ ~x & z;\n\n case 1:\n return x ^ y ^ z;\n\n case 2:\n return x & y ^ x & z ^ y & z;\n\n case 3:\n return x ^ y ^ z;\n }\n}\n\nfunction ROTL(x, n) {\n return x << n | x >>> 32 - n;\n}\n\nfunction sha1(bytes) {\n const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];\n const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];\n\n if (typeof bytes === 'string') {\n const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = [];\n\n for (let i = 0; i < msg.length; ++i) {\n bytes.push(msg.charCodeAt(i));\n }\n } else if (!Array.isArray(bytes)) {\n // Convert Array-like to Array\n bytes = Array.prototype.slice.call(bytes);\n }\n\n bytes.push(0x80);\n const l = bytes.length / 4 + 2;\n const N = Math.ceil(l / 16);\n const M = new Array(N);\n\n for (let i = 0; i < N; ++i) {\n const arr = new Uint32Array(16);\n\n for (let j = 0; j < 16; ++j) {\n arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];\n }\n\n M[i] = arr;\n }\n\n M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);\n M[N - 1][14] = Math.floor(M[N - 1][14]);\n M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;\n\n for (let i = 0; i < N; ++i) {\n const W = new Uint32Array(80);\n\n for (let t = 0; t < 16; ++t) {\n W[t] = M[i][t];\n }\n\n for (let t = 16; t < 80; ++t) {\n W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);\n }\n\n let a = H[0];\n let b = H[1];\n let c = H[2];\n let d = H[3];\n let e = H[4];\n\n for (let t = 0; t < 80; ++t) {\n const s = Math.floor(t / 20);\n const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;\n e = d;\n d = c;\n c = ROTL(b, 30) >>> 0;\n b = a;\n a = T;\n }\n\n H[0] = H[0] + a >>> 0;\n H[1] = H[1] + b >>> 0;\n H[2] = H[2] + c >>> 0;\n H[3] = H[3] + d >>> 0;\n H[4] = H[4] + e >>> 0;\n }\n\n return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];\n}\n\nexport default sha1;","import v35 from './v35.js';\nimport sha1 from './sha1.js';\nconst v5 = v35('v5', 0x50, sha1);\nexport default v5;","import { v5 as uuidv5 } from 'uuid';\n\nimport { MutableDataFrame } from '@grafana/data';\n\nimport { LokiStreamResult, LokiTailResponse } from './types';\n\nconst UUID_NAMESPACE = '6ec946da-0f49-47a8-983a-1d76d17e7c92';\n\n/**\n * Transform LokiResponse data and appends it to MutableDataFrame. Used for streaming where the dataFrame can be\n * a CircularDataFrame creating a fixed size rolling buffer.\n * TODO: Probably could be unified with the logStreamToDataFrame function.\n * @param response\n * @param data Needs to have ts, line, labels, id as fields\n */\nexport function appendResponseToBufferedData(response: LokiTailResponse, data: MutableDataFrame) {\n // Should we do anything with: response.dropped_entries?\n\n const streams: LokiStreamResult[] = response.streams;\n if (!streams || !streams.length) {\n return;\n }\n\n const tsField = data.fields[0];\n const lineField = data.fields[1];\n const idField = data.fields[2];\n\n // We are comparing used ids only within the received stream. This could be a problem if the same line + labels + nanosecond timestamp came in 2 separate batches.\n // As this is very unlikely, and the result would only affect live-tailing css animation we have decided to not compare all received uids from data param as this would slow down processing.\n const usedUids: Record<string, number> = {};\n\n for (const stream of streams) {\n // Find unique labels\n const allLabelsString = Object.entries(stream.stream)\n .map(([key, val]) => `${key}=\"${val}\"`)\n .sort()\n .join('');\n\n // Add each line\n for (const [ts, line] of stream.values) {\n tsField.values.push(new Date(parseInt(ts.slice(0, -6), 10)).toISOString());\n lineField.values.push(line);\n idField.values.push(createUid(ts, allLabelsString, line, usedUids, data.refId));\n }\n }\n}\n\nfunction createUid(\n ts: string,\n labelsString: string,\n line: string,\n usedUids: Record<string, number>,\n refId?: string\n): string {\n // Generate id as hashed nanosecond timestamp, labels and line (this does not have to be unique)\n let id = uuidv5(`${ts}_${labelsString}_${line}`, UUID_NAMESPACE);\n\n // Check if generated id is unique\n // If not and we've already used it, append its count after it\n if (id in usedUids) {\n // Increase the count\n const newCount = usedUids[id] + 1;\n usedUids[id] = newCount;\n // Append count to generated id to make it unique\n id = `${id}_${newCount}`;\n } else {\n // If id is unique and wasn't used, add it to usedUids and start count at 0\n usedUids[id] = 0;\n }\n // Return unique id\n if (refId) {\n return `${refId}_${id}`;\n }\n return id;\n}\n","import { Observable, throwError, timer } from 'rxjs';\nimport { finalize, map, retryWhen, mergeMap } from 'rxjs/operators';\nimport { webSocket } from 'rxjs/webSocket';\n\nimport { DataFrame, FieldType, KeyValue, CircularDataFrame } from '@grafana/data';\n\nimport { appendResponseToBufferedData } from './liveStreamsResultTransformer';\nimport { LokiTailResponse } from './types';\n\n/**\n * Maps directly to a query in the UI (refId is key)\n */\nexport interface LokiLiveTarget {\n query: string;\n url: string;\n refId: string;\n size: number;\n}\n\n/**\n * Cache of websocket streams that can be returned as observable. In case there already is a stream for particular\n * target it is returned and on subscription returns the latest dataFrame.\n */\nexport class LiveStreams {\n private streams: KeyValue<Observable<DataFrame[]>> = {};\n\n getStream(target: LokiLiveTarget, retryInterval = 5000): Observable<DataFrame[]> {\n let stream = this.streams[target.url];\n\n if (stream) {\n return stream;\n }\n\n const data = new CircularDataFrame({ capacity: target.size });\n data.addField({ name: 'Time', type: FieldType.time, config: {} });\n data.addField({ name: 'Line', type: FieldType.string });\n data.addField({ name: 'id', type: FieldType.string });\n data.meta = { ...data.meta, preferredVisualisationType: 'logs' };\n data.refId = target.refId;\n\n stream = webSocket<LokiTailResponse>(target.url).pipe(\n map((response: LokiTailResponse) => {\n appendResponseToBufferedData(response, data);\n return [data];\n }),\n retryWhen((attempts: Observable<any>) =>\n attempts.pipe(\n mergeMap((error, i) => {\n const retryAttempt = i + 1;\n // Code 1006 is used to indicate that a connection was closed abnormally.\n // Added hard limit of 30 on number of retries.\n // If connection was closed abnormally, and we wish to retry, otherwise throw error.\n if (error.code === 1006 && retryAttempt < 30) {\n if (retryAttempt > 10) {\n // If more than 10 times retried, consol.warn, but keep reconnecting\n console.warn(\n `Websocket connection is being disrupted. We keep reconnecting but consider starting new live tailing again. Error: ${error.reason}`\n );\n }\n // Retry every 5s\n return timer(retryInterval);\n }\n return throwError(error);\n })\n )\n ),\n finalize(() => {\n delete this.streams[target.url];\n })\n );\n this.streams[target.url] = stream;\n\n return stream;\n }\n}\n","import { css } from '@emotion/css';\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { useAsync } from 'react-use';\n\nimport { dateTime, GrafanaTheme2, LogRowModel, renderMarkdown, SelectableValue } from '@grafana/data';\nimport { RawQuery } from '@grafana/experimental';\nimport { reportInteraction } from '@grafana/runtime';\nimport {\n Alert,\n Button,\n Collapse,\n Icon,\n InlineField,\n InlineFieldRow,\n InlineSwitch,\n Label,\n MultiSelect,\n RenderUserContentAsHTML,\n Spinner,\n Tooltip,\n useStyles2,\n} from '@grafana/ui';\n\nimport {\n LogContextProvider,\n LOKI_LOG_CONTEXT_PRESERVED_LABELS,\n PreservedLabels,\n SHOULD_INCLUDE_PIPELINE_OPERATIONS,\n} from '../LogContextProvider';\nimport { escapeLabelValueInSelector } from '../languageUtils';\nimport { lokiGrammar } from '../syntax';\nimport { ContextFilter, LokiQuery } from '../types';\n\nexport interface LokiContextUiProps {\n logContextProvider: LogContextProvider;\n row: LogRowModel;\n updateFilter: (value: ContextFilter[]) => void;\n onClose: () => void;\n origQuery?: LokiQuery;\n runContextQuery?: () => void;\n}\n\nfunction getStyles(theme: GrafanaTheme2) {\n return {\n labels: css`\n display: flex;\n gap: ${theme.spacing(0.5)};\n `,\n wrapper: css`\n display: flex;\n flex-direction: column;\n flex: 1;\n gap: ${theme.spacing(0.5)};\n position: relative;\n `,\n textWrapper: css`\n display: flex;\n align-items: center;\n `,\n hidden: css`\n visibility: hidden;\n `,\n label: css`\n max-width: 100%;\n &:first-of-type {\n margin-bottom: ${theme.spacing(2)};\n }\n &:not(:first-of-type) {\n margin: ${theme.spacing(2)} 0;\n }\n `,\n rawQueryContainer: css`\n text-align: start;\n line-break: anywhere;\n margin-top: -${theme.spacing(0.25)};\n margin-right: ${theme.spacing(6)};\n min-height: ${theme.spacing(4)};\n `,\n ui: css`\n background-color: ${theme.colors.background.secondary};\n padding: ${theme.spacing(2)};\n `,\n notification: css({\n position: 'absolute',\n zIndex: theme.zIndex.portal,\n top: 0,\n right: 0,\n }),\n rawQuery: css`\n display: inline;\n `,\n queryDescription: css`\n margin-left: ${theme.spacing(0.5)};\n `,\n iconButton: css`\n position: absolute;\n top: ${theme.spacing(1)};\n right: ${theme.spacing(1)};\n z-index: ${theme.zIndex.navbarFixed};\n `,\n operationsToggle: css`\n margin: ${theme.spacing(1)} 0 ${theme.spacing(-1)} 0;\n & > div {\n margin: 0;\n & > label {\n padding: 0;\n }\n }\n `,\n };\n}\n\nexport const IS_LOKI_LOG_CONTEXT_UI_OPEN = 'isLogContextQueryUiOpen';\n\nexport function LokiContextUi(props: LokiContextUiProps) {\n const { row, logContextProvider, updateFilter, onClose, origQuery, runContextQuery } = props;\n const styles = useStyles2(getStyles);\n\n const [contextFilters, setContextFilters] = useState<ContextFilter[]>([]);\n const [showPreservedFiltersAppliedNotification, setShowPreservedFiltersAppliedNotification] = useState(false);\n\n const [initialized, setInitialized] = useState(false);\n const [loading, setLoading] = useState(false);\n const [isOpen, setIsOpen] = useState(window.localStorage.getItem(IS_LOKI_LOG_CONTEXT_UI_OPEN) === 'true');\n const [includePipelineOperations, setIncludePipelineOperations] = useState(\n window.localStorage.getItem(SHOULD_INCLUDE_PIPELINE_OPERATIONS) === 'true'\n );\n\n const timerHandle = React.useRef<number>();\n const previousInitialized = React.useRef<boolean>(false);\n const previousContextFilters = React.useRef<ContextFilter[]>([]);\n\n const isInitialState = useMemo(() => {\n // Initial query has all regular labels enabled and all parsed labels disabled\n if (initialized && contextFilters.some((filter) => filter.nonIndexed === filter.enabled)) {\n return false;\n }\n\n // if we include pipeline operations, we also want to enable the revert button\n if (includePipelineOperations && logContextProvider.queryContainsValidPipelineStages(origQuery)) {\n return false;\n }\n\n return true;\n }, [contextFilters, includePipelineOperations, initialized, logContextProvider, origQuery]);\n\n useEffect(() => {\n if (!initialized) {\n return;\n }\n\n // don't trigger if we initialized, this will be the same query anyways.\n if (!previousInitialized.current) {\n previousInitialized.current = initialized;\n return;\n }\n\n if (contextFilters.filter(({ enabled, nonIndexed }) => enabled && !nonIndexed).length === 0) {\n setContextFilters(previousContextFilters.current);\n return;\n }\n\n previousContextFilters.current = structuredClone(contextFilters);\n\n if (timerHandle.current) {\n clearTimeout(timerHandle.current);\n }\n setLoading(true);\n timerHandle.current = window.setTimeout(() => {\n updateFilter(contextFilters.filter(({ enabled }) => enabled));\n // We are storing the removed labels and selected extracted labels in local storage so we can\n // preselect the labels in the UI in the next log context view.\n const preservedLabels: PreservedLabels = {\n removedLabels: [],\n selectedExtractedLabels: [],\n };\n\n contextFilters.forEach(({ enabled, nonIndexed, label }) => {\n // We only want to store real labels that were removed from the initial query\n if (!enabled && !nonIndexed) {\n preservedLabels.removedLabels.push(label);\n }\n // Or extracted labels that were added to the initial query\n if (enabled && nonIndexed) {\n preservedLabels.selectedExtractedLabels.push(label);\n }\n });\n\n window.localStorage.setItem(LOKI_LOG_CONTEXT_PRESERVED_LABELS, JSON.stringify(preservedLabels));\n setLoading(false);\n }, 1500);\n\n return () => {\n clearTimeout(timerHandle.current);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [contextFilters, initialized]);\n\n useEffect(() => {\n return () => {\n clearTimeout(timerHandle.current);\n onClose();\n };\n }, [onClose]);\n\n useAsync(async () => {\n setLoading(true);\n const initContextFilters = await logContextProvider.getInitContextFilters(row.labels, origQuery, {\n from: dateTime(row.timeEpochMs),\n to: dateTime(row.timeEpochMs),\n raw: { from: dateTime(row.timeEpochMs), to: dateTime(row.timeEpochMs) },\n });\n setContextFilters(initContextFilters.contextFilters);\n setShowPreservedFiltersAppliedNotification(initContextFilters.preservedFiltersApplied);\n setInitialized(true);\n setLoading(false);\n });\n\n // To hide previousContextFiltersApplied notification after 2 seconds\n useEffect(() => {\n if (showPreservedFiltersAppliedNotification) {\n setTimeout(() => {\n setShowPreservedFiltersAppliedNotification(false);\n }, 2000);\n }\n }, [showPreservedFiltersAppliedNotification]);\n\n useEffect(() => {\n reportInteraction('grafana_explore_logs_loki_log_context_loaded', {\n logRowUid: row.uid,\n type: 'load',\n });\n\n return () => {\n reportInteraction('grafana_explore_logs_loki_log_context_loaded', {\n logRowUid: row.uid,\n type: 'unload',\n });\n };\n }, [row.uid]);\n\n const realLabels = contextFilters.filter(({ nonIndexed }) => !nonIndexed);\n const realLabelsEnabled = realLabels.filter(({ enabled }) => enabled);\n\n const parsedLabels = contextFilters.filter(({ nonIndexed }) => nonIndexed);\n const parsedLabelsEnabled = parsedLabels.filter(({ enabled }) => enabled);\n\n const contextFilterToSelectFilter = useCallback((contextFilter: ContextFilter): SelectableValue<string> => {\n return {\n label: `${contextFilter.label}=\"${escapeLabelValueInSelector(contextFilter.value)}\"`,\n value: contextFilter.label,\n };\n }, []);\n\n // If there's any nonIndexed labels, that includes structured metadata and parsed labels, we show the nonIndexed labels input\n const showNonIndexedLabels = parsedLabels.length > 0;\n\n let queryExpr = logContextProvider.prepareExpression(\n contextFilters.filter(({ enabled }) => enabled),\n origQuery\n );\n return (\n <div className={styles.wrapper}>\n {showPreservedFiltersAppliedNotification && (\n <Alert\n className={styles.notification}\n title=\"Previously used filters have been applied.\"\n severity=\"info\"\n elevated={true}\n ></Alert>\n )}\n <Tooltip content={'Revert to initial log context query.'}>\n <div className={styles.iconButton}>\n <Button\n data-testid=\"revert-button\"\n icon=\"history-alt\"\n variant=\"secondary\"\n disabled={isInitialState}\n onClick={(e) => {\n reportInteraction('grafana_explore_logs_loki_log_context_reverted', {\n logRowUid: row.uid,\n });\n setContextFilters((contextFilters) => {\n return contextFilters.map((contextFilter) => ({\n ...contextFilter,\n // For revert to initial query we need to enable all labels and disable all parsed labels\n enabled: !contextFilter.nonIndexed,\n }));\n });\n // We are removing the preserved labels from local storage so we can preselect the labels in the UI\n window.localStorage.removeItem(LOKI_LOG_CONTEXT_PRESERVED_LABELS);\n window.localStorage.removeItem(SHOULD_INCLUDE_PIPELINE_OPERATIONS);\n setIncludePipelineOperations(false);\n }}\n />\n </div>\n </Tooltip>\n\n <Collapse\n collapsible={true}\n isOpen={isOpen}\n onToggle={() => {\n window.localStorage.setItem(IS_LOKI_LOG_CONTEXT_UI_OPEN, (!isOpen).toString());\n setIsOpen((isOpen) => !isOpen);\n reportInteraction('grafana_explore_logs_loki_log_context_toggled', {\n logRowUid: row.uid,\n action: !isOpen ? 'open' : 'close',\n });\n }}\n label={\n <div className={styles.rawQueryContainer}>\n {initialized ? (\n <>\n <RawQuery\n language={{ grammar: lokiGrammar, name: 'loki' }}\n query={queryExpr}\n className={styles.rawQuery}\n />\n <Tooltip content=\"The initial log context query is created from all labels defining the stream for the selected log line. Use the editor below to customize the log context query.\">\n <Icon name=\"info-circle\" size=\"sm\" className={styles.queryDescription} />\n </Tooltip>\n </>\n ) : (\n <Spinner />\n )}\n </div>\n }\n >\n <div className={styles.ui}>\n <Label\n className={styles.label}\n description=\"The initial log context query is created from all labels defining the stream for the selected log line. You can broaden your search by removing one or more of the label filters.\"\n >\n Widen the search\n </Label>\n <MultiSelect\n isLoading={loading}\n options={realLabels.map(contextFilterToSelectFilter)}\n value={realLabelsEnabled.map(contextFilterToSelectFilter)}\n closeMenuOnSelect={true}\n maxMenuHeight={200}\n noOptionsMessage=\"No further labels available\"\n onChange={(keys, actionMeta) => {\n if (actionMeta.action === 'select-option') {\n reportInteraction('grafana_explore_logs_loki_log_context_filtered', {\n logRowUid: row.uid,\n type: 'label',\n action: 'select',\n });\n }\n if (actionMeta.action === 'remove-value') {\n reportInteraction('grafana_explore_logs_loki_log_context_filtered', {\n logRowUid: row.uid,\n type: 'label',\n action: 'remove',\n });\n }\n return setContextFilters(\n contextFilters.map((filter) => {\n if (filter.nonIndexed) {\n return filter;\n }\n filter.enabled = keys.some((key) => key.value === filter.label);\n return filter;\n })\n );\n }}\n />\n {showNonIndexedLabels && (\n <>\n <Label\n className={styles.label}\n description={`By using a parser in your original query, you can use filters for extracted labels. Refine your search by applying extracted labels created from the selected log line.`}\n >\n Refine the search\n </Label>\n <MultiSelect\n isLoading={loading}\n options={parsedLabels.map(contextFilterToSelectFilter)}\n value={parsedLabelsEnabled.map(contextFilterToSelectFilter)}\n closeMenuOnSelect={true}\n maxMenuHeight={200}\n noOptionsMessage=\"No further labels available\"\n isClearable={true}\n onChange={(keys, actionMeta) => {\n if (actionMeta.action === 'select-option') {\n reportInteraction('grafana_explore_logs_loki_log_context_filtered', {\n logRowUid: row.uid,\n type: 'parsed_label',\n action: 'select',\n });\n }\n if (actionMeta.action === 'remove-value') {\n reportInteraction('grafana_explore_logs_loki_log_context_filtered', {\n logRowUid: row.uid,\n type: 'parsed_label',\n action: 'remove',\n });\n }\n setContextFilters(\n contextFilters.map((filter) => {\n if (!filter.nonIndexed) {\n return filter;\n }\n filter.enabled = keys.some((key) => key.value === filter.label);\n return filter;\n })\n );\n }}\n />\n </>\n )}\n {logContextProvider.queryContainsValidPipelineStages(origQuery) && (\n <InlineFieldRow className={styles.operationsToggle}>\n <InlineField\n label=\"Include LogQL pipeline operations\"\n tooltip={\n <RenderUserContentAsHTML\n content={renderMarkdown(\n \"This will include LogQL operations such as `line_format` or `label_format`. It won't include line or label filter operations.\"\n )}\n />\n }\n >\n <InlineSwitch\n value={includePipelineOperations}\n showLabel={true}\n transparent={true}\n onChange={(e) => {\n reportInteraction('grafana_explore_logs_loki_log_context_pipeline_toggled', {\n logRowUid: row.uid,\n action: e.currentTarget.checked ? 'enable' : 'disable',\n });\n window.localStorage.setItem(SHOULD_INCLUDE_PIPELINE_OPERATIONS, e.currentTarget.checked.toString());\n setIncludePipelineOperations(e.currentTarget.checked);\n if (runContextQuery) {\n runContextQuery();\n }\n }}\n />\n </InlineField>\n </InlineFieldRow>\n )}\n </div>\n </Collapse>\n </div>\n );\n}\n","import { DataFrame, Field, FieldType, SortedVector } from '@grafana/data';\n\nexport enum SortDirection {\n Ascending,\n Descending,\n}\n\n// creates the `index` for the sorting.\n// this is needed by the `SortedVector`.\n// the index is an array of numbers, and it defines an order.\n// at every slot in the index the values is the position of\n// the sorted item.\n// for example, an index of [3,1,2] means that\n// in the dataframe, that has 3 rows, after sorting:\n// - the third row will become the first\n// - the first row will become the second\n// - the second row will become the third\nfunction makeIndex(field: Field<number>, dir: SortDirection): number[] {\n const fieldValues: number[] = field.values;\n const { nanos } = field;\n\n // we first build an array which is [0,1,2,3....]\n const index = Array(fieldValues.length);\n for (let i = 0; i < index.length; i++) {\n index[i] = i;\n }\n\n const isAsc = dir === SortDirection.Ascending;\n\n index.sort((a: number, b: number): number => {\n // we need to answer this question:\n // in the field-used-for-sorting, how would we compare value-at-index-a to value-at-index-b?\n const valA = fieldValues[a];\n const valB = fieldValues[b];\n if (valA < valB) {\n return isAsc ? -1 : 1;\n }\n\n if (valA > valB) {\n return isAsc ? 1 : -1;\n }\n\n // the millisecond timestamps are equal,\n // compare the nanosecond part, if available\n\n if (nanos === undefined) {\n return 0;\n }\n\n const nanoA = nanos[a];\n const nanoB = nanos[b];\n\n if (nanoA < nanoB) {\n return isAsc ? -1 : 1;\n }\n\n if (nanoA > nanoB) {\n return isAsc ? 1 : -1;\n }\n\n return 0;\n });\n\n return index;\n}\n\n// sort a dataframe that is in the Loki dataframe format ascending or desceding based on time,\n// with nanosecond precision.\nexport function sortDataFrameByTime(frame: DataFrame, dir: SortDirection): DataFrame {\n const { fields, ...rest } = frame;\n\n // we use the approach used in @grafana/data/sortDataframe.\n // we cannot use it directly, because it does not take `.nanos` into account\n // (see https://github.com/grafana/grafana/issues/72351).\n // we can switch to to @grafana/data/sortDataframe when the issue is fixed.\n\n const timeField = fields.find((field) => field.type === FieldType.time);\n if (timeField === undefined) {\n throw new Error('missing timestamp field. should never happen');\n }\n\n const index = makeIndex(timeField, dir);\n\n return {\n ...rest,\n fields: fields.map((field) => ({\n ...field,\n values: new SortedVector(field.values, index).toArray(),\n nanos: field.nanos === undefined ? undefined : new SortedVector(field.nanos, index).toArray(),\n })),\n };\n\n return frame;\n}\n","import { isEmpty } from 'lodash';\nimport { catchError, lastValueFrom, of, switchMap } from 'rxjs';\n\nimport {\n CoreApp,\n DataFrame,\n DataQueryError,\n DataQueryResponse,\n FieldCache,\n FieldType,\n LogRowModel,\n TimeRange,\n toUtc,\n LogRowContextQueryDirection,\n LogRowContextOptions,\n dateTime,\n} from '@grafana/data';\nimport { LabelParser, LabelFilter, LineFilters, PipelineStage, Logfmt, Json } from '@grafana/lezer-logql';\nimport { Labels } from '@grafana/schema';\n\nimport { LokiContextUi } from './components/LokiContextUi';\nimport { LokiDatasource, makeRequest, REF_ID_STARTER_LOG_ROW_CONTEXT } from './datasource';\nimport { escapeLabelValueInExactSelector } from './languageUtils';\nimport { addLabelToQuery, addParserToQuery } from './modifyQuery';\nimport {\n getNodePositionsFromQuery,\n getParserFromQuery,\n getStreamSelectorsFromQuery,\n isQueryWithParser,\n} from './queryUtils';\nimport { sortDataFrameByTime, SortDirection } from './sortDataFrame';\nimport { ContextFilter, LabelType, LokiQuery, LokiQueryDirection, LokiQueryType } from './types';\n\nexport const LOKI_LOG_CONTEXT_PRESERVED_LABELS = 'lokiLogContextPreservedLabels';\nexport const SHOULD_INCLUDE_PIPELINE_OPERATIONS = 'lokiLogContextShouldIncludePipelineOperations';\n\nexport type PreservedLabels = {\n removedLabels: string[];\n selectedExtractedLabels: string[];\n};\n\nexport class LogContextProvider {\n datasource: LokiDatasource;\n cachedContextFilters: ContextFilter[];\n onContextClose: (() => void) | undefined;\n\n constructor(datasource: LokiDatasource) {\n this.datasource = datasource;\n this.cachedContextFilters = [];\n }\n\n private async getQueryAndRange(\n row: LogRowModel,\n options?: LogRowContextOptions,\n origQuery?: LokiQuery,\n cacheFilters = true\n ) {\n const direction = (options && options.direction) || LogRowContextQueryDirection.Backward;\n const limit = (options && options.limit) || this.datasource.maxLines;\n // If the user doesn't have any filters applied already, or if we don't want\n // to use the cached filters, we need to reinitialize them.\n if (this.cachedContextFilters.length === 0 || !cacheFilters) {\n const filters = (\n await this.getInitContextFilters(row.labels, origQuery, {\n from: dateTime(row.timeEpochMs),\n to: dateTime(row.timeEpochMs),\n raw: { from: dateTime(row.timeEpochMs), to: dateTime(row.timeEpochMs) },\n })\n ).contextFilters.filter((filter) => filter.enabled);\n\n this.cachedContextFilters = filters;\n }\n\n return await this.prepareLogRowContextQueryTarget(row, limit, direction, origQuery);\n }\n\n getLogRowContextQuery = async (\n row: LogRowModel,\n options?: LogRowContextOptions,\n origQuery?: LokiQuery,\n cacheFilters = true\n ): Promise<LokiQuery> => {\n const { query } = await this.getQueryAndRange(row, options, origQuery, cacheFilters);\n\n if (!cacheFilters) {\n // If the caller doesn't want to cache the filters, we need to reset them.\n this.cachedContextFilters = [];\n }\n\n return query;\n };\n\n getLogRowContext = async (\n row: LogRowModel,\n options?: LogRowContextOptions,\n origQuery?: LokiQuery\n ): Promise<{ data: DataFrame[] }> => {\n const direction = (options && options.direction) || LogRowContextQueryDirection.Backward;\n const { query, range } = await this.getQueryAndRange(row, options, origQuery);\n\n const processResults = (result: DataQueryResponse): DataQueryResponse => {\n const frames: DataFrame[] = result.data;\n const processedFrames = frames.map((frame) => sortDataFrameByTime(frame, SortDirection.Descending));\n\n return {\n ...result,\n data: processedFrames,\n };\n };\n\n // this can only be called from explore currently\n const app = CoreApp.Explore;\n\n return lastValueFrom(\n this.datasource.query(makeRequest(query, range, app, `${REF_ID_STARTER_LOG_ROW_CONTEXT}${direction}`)).pipe(\n catchError((err) => {\n const error: DataQueryError = {\n message: 'Error during context query. Please check JS console logs.',\n status: err.status,\n statusText: err.statusText,\n };\n throw error;\n }),\n switchMap((res) => of(processResults(res)))\n )\n );\n };\n\n async prepareLogRowContextQueryTarget(\n row: LogRowModel,\n limit: number,\n direction: LogRowContextQueryDirection,\n origQuery?: LokiQuery\n ): Promise<{ query: LokiQuery; range: TimeRange }> {\n const expr = this.prepareExpression(this.cachedContextFilters, origQuery);\n\n const contextTimeBuffer = 2 * 60 * 60 * 1000; // 2h buffer\n\n const queryDirection =\n direction === LogRowContextQueryDirection.Forward ? LokiQueryDirection.Forward : LokiQueryDirection.Backward;\n\n const query: LokiQuery = {\n expr,\n queryType: LokiQueryType.Range,\n // refId has to be:\n // - always different (temporarily, will be fixed later)\n // - not increase in size\n // because it may be called many times from logs-context\n refId: `${REF_ID_STARTER_LOG_ROW_CONTEXT}_${Math.random().toString()}`,\n maxLines: limit,\n direction: queryDirection,\n datasource: { uid: this.datasource.uid, type: this.datasource.type },\n };\n\n const fieldCache = new FieldCache(row.dataFrame);\n const tsField = fieldCache.getFirstFieldOfType(FieldType.time);\n if (tsField === undefined) {\n throw new Error('loki: data frame missing time-field, should never happen');\n }\n const tsValue = tsField.values[row.rowIndex];\n const timestamp = toUtc(tsValue);\n\n const range =\n queryDirection === LokiQueryDirection.Forward\n ? {\n // start param in Loki API is inclusive so we'll have to filter out the row that this request is based from\n // and any other that were logged in the same ns but before the row. Right now these rows will be lost\n // because the are before but came it he response that should return only rows after.\n from: timestamp,\n // convert to ns, we lose some precision here but it is not that important at the far points of the context\n to: toUtc(row.timeEpochMs + contextTimeBuffer),\n }\n : {\n // convert to ns, we lose some precision here but it is not that important at the far points of the context\n from: toUtc(row.timeEpochMs - contextTimeBuffer),\n to: timestamp,\n };\n\n return {\n query,\n range: {\n from: range.from,\n to: range.to,\n raw: range,\n },\n };\n }\n\n getLogRowContextUi(row: LogRowModel, runContextQuery?: () => void, origQuery?: LokiQuery): React.ReactNode {\n const updateFilter = (contextFilters: ContextFilter[]) => {\n this.cachedContextFilters = contextFilters;\n\n if (runContextQuery) {\n runContextQuery();\n }\n };\n\n // we need to cache this function so that it doesn't get recreated on every render\n this.onContextClose =\n this.onContextClose ??\n (() => {\n this.cachedContextFilters = [];\n });\n\n return LokiContextUi({\n row,\n origQuery,\n updateFilter,\n onClose: this.onContextClose,\n logContextProvider: this,\n runContextQuery,\n });\n }\n\n prepareExpression(contextFilters: ContextFilter[], query: LokiQuery | undefined): string {\n let preparedExpression = this.processContextFiltersToExpr(contextFilters, query);\n if (window.localStorage.getItem(SHOULD_INCLUDE_PIPELINE_OPERATIONS) === 'true') {\n preparedExpression = this.processPipelineStagesToExpr(preparedExpression, query);\n }\n return preparedExpression;\n }\n\n processContextFiltersToExpr = (contextFilters: ContextFilter[], query: LokiQuery | undefined): string => {\n const labelFilters = contextFilters\n .map((filter) => {\n if (!filter.nonIndexed && filter.enabled) {\n // escape backslashes in label as users can't escape them by themselves\n return `${filter.label}=\"${escapeLabelValueInExactSelector(filter.value)}\"`;\n }\n return '';\n })\n // Filter empty strings\n .filter((label) => !!label)\n .join(',');\n\n let expr = `{${labelFilters}}`;\n\n // We need to have original query to get parser and include parsed labels\n // We only add parser and parsed labels if there is only one parser in query\n if (query) {\n let hasParser = false;\n if (isQueryWithParser(query.expr).parserCount === 1) {\n hasParser = true;\n const parser = getParserFromQuery(query.expr);\n if (parser) {\n expr = addParserToQuery(expr, parser);\n }\n }\n\n const nonIndexedLabels = contextFilters.filter((filter) => filter.nonIndexed && filter.enabled);\n for (const parsedLabel of nonIndexedLabels) {\n if (parsedLabel.enabled) {\n expr = addLabelToQuery(\n expr,\n parsedLabel.label,\n '=',\n parsedLabel.value,\n hasParser ? LabelType.Parsed : LabelType.StructuredMetadata\n );\n }\n }\n }\n\n return expr;\n };\n\n processPipelineStagesToExpr = (currentExpr: string, query: LokiQuery | undefined): string => {\n let newExpr = currentExpr;\n const origExpr = query?.expr ?? '';\n\n if (isQueryWithParser(origExpr).parserCount > 1) {\n return newExpr;\n }\n\n const allNodePositions = getNodePositionsFromQuery(origExpr, [\n PipelineStage,\n LabelParser,\n Logfmt,\n Json,\n LineFilters,\n LabelFilter,\n ]);\n const pipelineStagePositions = allNodePositions.filter((position) => position.type?.id === PipelineStage);\n const otherNodePositions = allNodePositions.filter((position) => position.type?.id !== PipelineStage);\n\n for (const pipelineStagePosition of pipelineStagePositions) {\n // we don't process pipeline stages that contain label parsers, line filters or label filters\n if (otherNodePositions.some((position) => pipelineStagePosition.contains(position))) {\n continue;\n }\n\n newExpr += ` ${pipelineStagePosition.getExpression(origExpr)}`;\n }\n\n return newExpr;\n };\n\n queryContainsValidPipelineStages = (query: LokiQuery | undefined): boolean => {\n const origExpr = query?.expr ?? '';\n const allNodePositions = getNodePositionsFromQuery(origExpr, [\n PipelineStage,\n LabelParser,\n LineFilters,\n LabelFilter,\n ]);\n const pipelineStagePositions = allNodePositions.filter((position) => position.type?.id === PipelineStage);\n const otherNodePositions = allNodePositions.filter((position) => position.type?.id !== PipelineStage);\n\n return pipelineStagePositions.some((pipelineStagePosition) =>\n otherNodePositions.every((position) => pipelineStagePosition.contains(position) === false)\n );\n };\n\n getInitContextFilters = async (\n labels: Labels,\n query?: LokiQuery,\n timeRange?: TimeRange\n ): Promise<{ contextFilters: ContextFilter[]; preservedFiltersApplied: boolean }> => {\n let preservedFiltersApplied = false;\n if (!query || isEmpty(labels)) {\n return { contextFilters: [], preservedFiltersApplied };\n }\n\n // 1. First we need to get all labels from the log row's label\n // and correctly set parsed and not parsed labels\n let allLabels: string[] = [];\n if (!isQueryWithParser(query.expr).queryWithParser) {\n // If there is no parser, we use getLabelKeys because it has better caching\n // and all labels should already be fetched\n await this.datasource.languageProvider.start(timeRange);\n allLabels = this.datasource.languageProvider.getLabelKeys();\n } else {\n // If we have parser, we use fetchSeriesLabels to fetch actual labels for selected stream\n const stream = getStreamSelectorsFromQuery(query.expr);\n // We are using stream[0] as log query can always have just 1 stream selector\n const series = await this.datasource.languageProvider.fetchSeriesLabels(stream[0], { timeRange });\n allLabels = Object.keys(series);\n }\n\n const contextFilters: ContextFilter[] = [];\n Object.entries(labels).forEach(([label, value]) => {\n const filter: ContextFilter = {\n label,\n value: value,\n enabled: allLabels.includes(label),\n nonIndexed: !allLabels.includes(label),\n };\n\n contextFilters.push(filter);\n });\n\n // Secondly we check for preserved labels and update enabled state of filters based on that\n let preservedLabels: undefined | PreservedLabels = undefined;\n const preservedLabelsString = window.localStorage.getItem(LOKI_LOG_CONTEXT_PRESERVED_LABELS);\n if (preservedLabelsString) {\n try {\n preservedLabels = JSON.parse(preservedLabelsString);\n // Do nothing when error occurs\n } catch (e) {}\n }\n\n if (!preservedLabels) {\n // If we don't have preservedLabels, we return contextFilters as they are\n return { contextFilters, preservedFiltersApplied };\n } else {\n // Otherwise, we need to update filters based on preserved labels\n let arePreservedLabelsUsed = false;\n const newContextFilters = contextFilters.map((contextFilter) => {\n // We checked for undefined above\n if (preservedLabels!.removedLabels.includes(contextFilter.label)) {\n arePreservedLabelsUsed = true;\n return { ...contextFilter, enabled: false };\n }\n // We checked for undefined above\n if (preservedLabels!.selectedExtractedLabels.includes(contextFilter.label)) {\n arePreservedLabelsUsed = true;\n return { ...contextFilter, enabled: true };\n }\n return { ...contextFilter };\n });\n\n const isAtLeastOneRealLabelEnabled = newContextFilters.some(({ enabled, nonIndexed }) => enabled && !nonIndexed);\n if (!isAtLeastOneRealLabelEnabled) {\n // If we end up with no real labels enabled, we need to reset the init filters\n return { contextFilters, preservedFiltersApplied };\n } else {\n if (arePreservedLabelsUsed) {\n preservedFiltersApplied = true;\n }\n return { contextFilters: newContextFilters, preservedFiltersApplied };\n }\n }\n };\n}\n","import { LokiVariableQuery, LokiVariableQueryType } from '../types';\n\nexport const labelNamesRegex = /^label_names\\(\\)\\s*$/;\nexport const labelValuesRegex = /^label_values\\((?:(.+),\\s*)?([a-zA-Z_$][a-zA-Z0-9_]*)\\)\\s*$/;\n\nexport function migrateVariableQuery(rawQuery: string | LokiVariableQuery): LokiVariableQuery {\n // If not string, we assume LokiVariableQuery\n if (typeof rawQuery !== 'string') {\n return rawQuery;\n }\n\n const queryBase = {\n refId: 'LokiVariableQueryEditor-VariableQuery',\n type: LokiVariableQueryType.LabelNames,\n };\n\n const labelNames = rawQuery.match(labelNamesRegex);\n if (labelNames) {\n return {\n ...queryBase,\n type: LokiVariableQueryType.LabelNames,\n };\n }\n\n const labelValues = rawQuery.match(labelValuesRegex);\n if (labelValues) {\n return {\n ...queryBase,\n type: LokiVariableQueryType.LabelValues,\n label: labelValues[2] ? labelValues[2] : labelValues[1],\n stream: labelValues[2] ? labelValues[1] : undefined,\n };\n }\n\n return queryBase;\n}\n","import React, { FormEvent, useState, useEffect } from 'react';\n\nimport { QueryEditorProps, SelectableValue } from '@grafana/data';\nimport { InlineField, InlineFieldRow, Input, Select } from '@grafana/ui';\n\nimport { LokiDatasource } from '../datasource';\nimport { migrateVariableQuery } from '../migrations/variableQueryMigrations';\nimport { LokiOptions, LokiQuery, LokiVariableQuery, LokiVariableQueryType as QueryType } from '../types';\n\nconst variableOptions = [\n { label: 'Label names', value: QueryType.LabelNames },\n { label: 'Label values', value: QueryType.LabelValues },\n];\n\nexport type Props = QueryEditorProps<LokiDatasource, LokiQuery, LokiOptions, LokiVariableQuery>;\n\nconst refId = 'LokiVariableQueryEditor-VariableQuery';\n\nexport const LokiVariableQueryEditor = ({ onChange, query, datasource }: Props) => {\n const [type, setType] = useState<number | undefined>(undefined);\n const [label, setLabel] = useState('');\n const [labelOptions, setLabelOptions] = useState<Array<SelectableValue<string>>>([]);\n const [stream, setStream] = useState('');\n\n useEffect(() => {\n if (!query) {\n return;\n }\n\n const variableQuery = typeof query === 'string' ? migrateVariableQuery(query) : query;\n setType(variableQuery.type);\n setLabel(variableQuery.label || '');\n setStream(variableQuery.stream || '');\n }, [query]);\n\n useEffect(() => {\n if (type !== QueryType.LabelValues) {\n return;\n }\n\n datasource.languageProvider.fetchLabels().then((labelNames: string[]) => {\n setLabelOptions(labelNames.map((labelName) => ({ label: labelName, value: labelName })));\n });\n }, [datasource, type]);\n\n const onQueryTypeChange = (newType: SelectableValue<QueryType>) => {\n setType(newType.value);\n if (newType.value !== undefined) {\n onChange({\n type: newType.value,\n label,\n stream,\n refId,\n });\n }\n };\n\n const onLabelChange = (newLabel: SelectableValue<string>) => {\n setLabel(newLabel.value || '');\n };\n\n const onStreamChange = (e: FormEvent<HTMLInputElement>) => {\n setStream(e.currentTarget.value);\n };\n\n const handleBlur = () => {\n if (type !== undefined) {\n onChange({ type, label, stream, refId: 'LokiVariableQueryEditor-VariableQuery' });\n }\n };\n\n return (\n <>\n <InlineFieldRow>\n <InlineField label=\"Query type\" labelWidth={20}>\n <Select\n aria-label=\"Query type\"\n onChange={onQueryTypeChange}\n onBlur={handleBlur}\n value={type}\n options={variableOptions}\n width={16}\n />\n </InlineField>\n {type === QueryType.LabelValues && (\n <>\n <InlineField label=\"Label\" labelWidth={20}>\n <Select\n aria-label=\"Label\"\n onChange={onLabelChange}\n onBlur={handleBlur}\n value={{ label: label, value: label }}\n options={labelOptions}\n width={16}\n allowCustomValue\n />\n </InlineField>\n </>\n )}\n </InlineFieldRow>\n {type === QueryType.LabelValues && (\n <InlineFieldRow>\n <InlineField\n label=\"Stream selector\"\n labelWidth={20}\n grow={true}\n tooltip={\n <div>\n {\n 'Optional. If defined, a list of values for the specified log stream selector is returned. For example: {label=\"value\"} or {label=\"$variable\"}'\n }\n </div>\n }\n >\n <Input\n type=\"text\"\n aria-label=\"Stream selector\"\n placeholder=\"Optional stream selector\"\n value={stream}\n onChange={onStreamChange}\n onBlur={handleBlur}\n />\n </InlineField>\n </InlineFieldRow>\n )}\n </>\n );\n};\n","import { from, Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nimport { CustomVariableSupport, DataQueryRequest, MetricFindValue, ScopedVars, TimeRange } from '@grafana/data';\n\nimport { LokiVariableQueryEditor } from './components/VariableQueryEditor';\nimport { LokiDatasource } from './datasource';\nimport { LokiVariableQuery } from './types';\n\nexport class LokiVariableSupport extends CustomVariableSupport<LokiDatasource, LokiVariableQuery> {\n editor = LokiVariableQueryEditor;\n\n constructor(private datasource: LokiDatasource) {\n super();\n }\n\n async execute(query: LokiVariableQuery, scopedVars: ScopedVars, range: TimeRange) {\n return this.datasource.metricFindQuery(query, { scopedVars, range });\n }\n\n query(request: DataQueryRequest<LokiVariableQuery>): Observable<{ data: MetricFindValue[] }> {\n const result = this.execute(request.targets[0], request.scopedVars, request.range);\n\n return from(result).pipe(map((data) => ({ data })));\n }\n}\n","import { groupBy } from 'lodash';\n\nimport { FieldType, DataFrame, DataLink, Field } from '@grafana/data';\nimport { getDataSourceSrv } from '@grafana/runtime';\n\nimport { DerivedFieldConfig } from './types';\n\nexport function getDerivedFields(dataFrame: DataFrame, derivedFieldConfigs: DerivedFieldConfig[]): Field[] {\n if (!derivedFieldConfigs.length) {\n return [];\n }\n const derivedFieldsGrouped = groupBy(derivedFieldConfigs, 'name');\n\n const newFields = Object.values(derivedFieldsGrouped).map(fieldFromDerivedFieldConfig);\n\n // line-field is the first string-field\n // NOTE: we should create some common log-frame-extra-string-field code somewhere\n const lineField = dataFrame.fields.find((f) => f.type === FieldType.string);\n\n if (lineField === undefined) {\n // if this is happening, something went wrong, let's raise an error\n throw new Error('invalid logs-dataframe, string-field missing');\n }\n\n const labelFields = dataFrame.fields.find((f) => f.type === FieldType.other && f.name === 'labels');\n\n for (let i = 0; i < lineField.values.length; i++) {\n for (const field of newFields) {\n // `matcherRegex` can be either a RegExp that is used to extract the value from the log line, or it can be a label key to derive the field from the labels\n if (derivedFieldsGrouped[field.name][0].matcherType === 'label' && labelFields) {\n const label = labelFields.values[i];\n if (label) {\n // Find the key that matches both, the `matcherRegex` and the label key\n const intersectingKey = Object.keys(label).find(\n (key) => derivedFieldsGrouped[field.name][0].matcherRegex === key\n );\n\n if (intersectingKey) {\n field.values.push(label[intersectingKey]);\n continue;\n }\n }\n field.values.push(null);\n } else if (\n derivedFieldsGrouped[field.name][0].matcherType === 'regex' ||\n derivedFieldsGrouped[field.name][0].matcherType === undefined\n ) {\n // `matcherRegex` will actually be used as a RegExp here\n const line = lineField.values[i];\n const logMatch = line.match(derivedFieldsGrouped[field.name][0].matcherRegex);\n\n if (logMatch && logMatch[1]) {\n field.values.push(logMatch[1]);\n continue;\n }\n\n field.values.push(null);\n } else {\n field.values.push(null);\n }\n }\n }\n\n return newFields;\n}\n\n/**\n * Transform derivedField config into dataframe field with config that contains link.\n */\nfunction fieldFromDerivedFieldConfig(derivedFieldConfigs: DerivedFieldConfig[]): Field {\n const dataSourceSrv = getDataSourceSrv();\n\n const dataLinks = derivedFieldConfigs.reduce<DataLink[]>((acc, derivedFieldConfig) => {\n // Having field.datasourceUid means it is an internal link.\n if (derivedFieldConfig.datasourceUid) {\n const dsSettings = dataSourceSrv.getInstanceSettings(derivedFieldConfig.datasourceUid);\n const queryType = (type: string | undefined): string | undefined => {\n switch (type) {\n case 'tempo':\n return 'traceql';\n case 'grafana-x-ray-datasource':\n return 'getTrace';\n default:\n return undefined;\n }\n };\n\n acc.push({\n // Will be filled out later\n title: derivedFieldConfig.urlDisplayLabel || '',\n url: '',\n // This is hardcoded for Jaeger or Zipkin not way right now to specify datasource specific query object\n internal: {\n query: { query: derivedFieldConfig.url, queryType: queryType(dsSettings?.type) },\n datasourceUid: derivedFieldConfig.datasourceUid,\n datasourceName: dsSettings?.name ?? 'Data source not found',\n },\n });\n } else if (derivedFieldConfig.url) {\n acc.push({\n // We do not know what title to give here so we count on presentation layer to create a title from metadata.\n title: derivedFieldConfig.urlDisplayLabel || '',\n // This is hardcoded for Jaeger or Zipkin not way right now to specify datasource specific query object\n url: derivedFieldConfig.url,\n });\n }\n return acc;\n }, []);\n\n return {\n name: derivedFieldConfigs[0].name,\n type: FieldType.string,\n config: {\n links: dataLinks,\n },\n // We are adding values later on\n values: [],\n };\n}\n","import { groupBy } from 'lodash';\n\nimport { DataFrame, Field, FieldType } from '@grafana/data';\n\nexport function makeTableFrames(instantMetricFrames: DataFrame[]): DataFrame[] {\n // first we remove frames that have no refId\n // (we will group them by refId, so we need it to be set)\n const framesWithRefId = instantMetricFrames.filter((f) => f.refId !== undefined);\n\n const framesByRefId = groupBy(framesWithRefId, (frame) => frame.refId);\n\n return Object.entries(framesByRefId).map(([refId, frames]) => makeTableFrame(frames, refId));\n}\n\ntype NumberField = Field<number, number[]>;\ntype StringField = Field<string, string[]>;\n\nfunction makeTableFrame(instantMetricFrames: DataFrame[], refId: string): DataFrame {\n const tableTimeField: NumberField = { name: 'Time', config: {}, values: [], type: FieldType.time };\n const tableValueField: NumberField = {\n name: `Value #${refId}`,\n config: {},\n values: [],\n type: FieldType.number,\n };\n\n // Sort metric labels, create columns for them and record their index\n const allLabelNames = new Set(\n instantMetricFrames.map((frame) => frame.fields.map((field) => Object.keys(field.labels ?? {})).flat()).flat()\n );\n\n const sortedLabelNames = Array.from(allLabelNames).sort();\n\n const labelFields: StringField[] = sortedLabelNames.map((labelName) => ({\n name: labelName,\n config: { filterable: true },\n values: [],\n type: FieldType.string,\n }));\n\n instantMetricFrames.forEach((frame) => {\n const timeField = frame.fields.find((field) => field.type === FieldType.time);\n const valueField = frame.fields.find((field) => field.type === FieldType.number);\n if (timeField == null || valueField == null) {\n return;\n }\n\n const timeArray = timeField.values;\n const valueArray = valueField.values;\n\n for (let x of timeArray) {\n tableTimeField.values.push(x);\n }\n\n for (let x of valueArray) {\n tableValueField.values.push(x);\n }\n\n const labels = valueField.labels ?? {};\n\n for (let f of labelFields) {\n const text = labels[f.name] ?? '';\n // we insert the labels as many times as we have values\n for (let i = 0; i < valueArray.length; i++) {\n f.values.push(text);\n }\n }\n });\n\n return {\n fields: [tableTimeField, ...labelFields, tableValueField],\n refId,\n meta: { preferredVisualisationType: 'table' },\n length: tableTimeField.values.length,\n };\n}\n","import { DataQueryResponse, DataFrame, isDataFrame, FieldType, QueryResultMeta, DataQueryError } from '@grafana/data';\n\nimport { getDerivedFields } from './getDerivedFields';\nimport { makeTableFrames } from './makeTableFrames';\nimport { getHighlighterExpressionsFromQuery } from './queryUtils';\nimport { dataFrameHasLokiError } from './responseUtils';\nimport { DerivedFieldConfig, LokiQuery, LokiQueryType } from './types';\n\nfunction isMetricFrame(frame: DataFrame): boolean {\n return frame.fields.every((field) => field.type === FieldType.time || field.type === FieldType.number);\n}\n\n// returns a new frame, with meta shallow merged with its original meta\nfunction setFrameMeta(frame: DataFrame, meta: QueryResultMeta): DataFrame {\n const { meta: oldMeta, ...rest } = frame;\n // meta maybe be undefined, we need to handle that\n const newMeta = { ...oldMeta, ...meta };\n return {\n ...rest,\n meta: newMeta,\n };\n}\n\nfunction processStreamFrame(\n frame: DataFrame,\n query: LokiQuery | undefined,\n derivedFieldConfigs: DerivedFieldConfig[]\n): DataFrame {\n const custom: Record<string, string> = {\n ...frame.meta?.custom, // keep the original meta.custom\n // used by logsModel\n lokiQueryStatKey: 'Summary: total bytes processed',\n };\n\n if (dataFrameHasLokiError(frame)) {\n custom.error = 'Error when parsing some of the logs';\n }\n\n const meta: QueryResultMeta = {\n preferredVisualisationType: 'logs',\n limit: query?.maxLines,\n searchWords: query !== undefined ? getHighlighterExpressionsFromQuery(query.expr) : undefined,\n custom,\n };\n\n const newFrame = setFrameMeta(frame, meta);\n const derivedFields = getDerivedFields(newFrame, derivedFieldConfigs);\n return {\n ...newFrame,\n fields: [...newFrame.fields, ...derivedFields],\n };\n}\n\nfunction processStreamsFrames(\n frames: DataFrame[],\n queryMap: Map<string, LokiQuery>,\n derivedFieldConfigs: DerivedFieldConfig[]\n): DataFrame[] {\n return frames.map((frame) => {\n const query = frame.refId !== undefined ? queryMap.get(frame.refId) : undefined;\n return processStreamFrame(frame, query, derivedFieldConfigs);\n });\n}\n\nfunction processMetricInstantFrames(frames: DataFrame[]): DataFrame[] {\n return frames.length > 0 ? makeTableFrames(frames) : [];\n}\n\nfunction processMetricRangeFrames(frames: DataFrame[]): DataFrame[] {\n const meta: QueryResultMeta = { preferredVisualisationType: 'graph' };\n return frames.map((frame) => setFrameMeta(frame, meta));\n}\n\n// we split the frames into 3 groups, because we will handle\n// each group slightly differently\nfunction groupFrames(\n frames: DataFrame[],\n queryMap: Map<string, LokiQuery>\n): {\n streamsFrames: DataFrame[];\n metricInstantFrames: DataFrame[];\n metricRangeFrames: DataFrame[];\n} {\n const streamsFrames: DataFrame[] = [];\n const metricInstantFrames: DataFrame[] = [];\n const metricRangeFrames: DataFrame[] = [];\n\n frames.forEach((frame) => {\n if (!isMetricFrame(frame)) {\n streamsFrames.push(frame);\n } else {\n const isInstantFrame = frame.refId != null && queryMap.get(frame.refId)?.queryType === LokiQueryType.Instant;\n if (isInstantFrame) {\n metricInstantFrames.push(frame);\n } else {\n metricRangeFrames.push(frame);\n }\n }\n });\n\n return { streamsFrames, metricInstantFrames, metricRangeFrames };\n}\n\nfunction improveError(error: DataQueryError | undefined, queryMap: Map<string, LokiQuery>): DataQueryError | undefined {\n // many things are optional in an error-object, we need an error-message to exist,\n // and we need to find the loki-query, based on the refId in the error-object.\n if (error === undefined) {\n return error;\n }\n\n const { refId, message } = error;\n if (refId === undefined || message === undefined) {\n return error;\n }\n\n const query = queryMap.get(refId);\n if (query === undefined) {\n return error;\n }\n\n if (message.includes('escape') && query.expr.includes('\\\\')) {\n return {\n ...error,\n message: `${message}. Make sure that all special characters are escaped with \\\\. For more information on escaping of special characters visit LogQL documentation at https://grafana.com/docs/loki/latest/logql/.`,\n };\n }\n\n return error;\n}\n\nexport function transformBackendResult(\n response: DataQueryResponse,\n queries: LokiQuery[],\n derivedFieldConfigs: DerivedFieldConfig[]\n): DataQueryResponse {\n const { data, error, ...rest } = response;\n\n // in the typescript type, data is an array of basically anything.\n // we do know that they have to be dataframes, so we make a quick check,\n // this way we can be sure, and also typescript is happy.\n const dataFrames = data.map((d) => {\n if (!isDataFrame(d)) {\n throw new Error('transformation only supports dataframe responses');\n }\n return d;\n });\n\n const queryMap = new Map(queries.map((query) => [query.refId, query]));\n\n const { streamsFrames, metricInstantFrames, metricRangeFrames } = groupFrames(dataFrames, queryMap);\n\n return {\n ...rest,\n error: improveError(error, queryMap),\n data: [\n ...processMetricRangeFrames(metricRangeFrames),\n ...processMetricInstantFrames(metricInstantFrames),\n ...processStreamsFrames(streamsFrames, queryMap, derivedFieldConfigs),\n ],\n };\n}\n","// Libraries\nimport React, { memo } from 'react';\n\nimport { AnnotationQuery } from '@grafana/data';\nimport { EditorField, EditorRow } from '@grafana/experimental';\nimport { Input } from '@grafana/ui';\n\n// Types\nimport { getNormalizedLokiQuery } from '../queryUtils';\nimport { LokiQuery, LokiQueryType } from '../types';\n\nimport { LokiOptionFields } from './LokiOptionFields';\nimport { LokiQueryField } from './LokiQueryField';\nimport { LokiQueryEditorProps } from './types';\n\ntype Props = LokiQueryEditorProps & {\n annotation?: AnnotationQuery<LokiQuery>;\n onAnnotationChange?: (annotation: AnnotationQuery<LokiQuery>) => void;\n};\n\nexport const LokiAnnotationsQueryEditor = memo(function LokiAnnotationQueryEditor(props: Props) {\n const { annotation, onAnnotationChange, history } = props;\n\n // this should never happen, but we want to keep typescript happy\n if (annotation === undefined || onAnnotationChange === undefined) {\n return null;\n }\n\n const onChangeQuery = (query: LokiQuery) => {\n // the current version of annotations only stores an optional boolean\n // field `instant` to handle the instant/range switch.\n // we need to maintain compatibility for now, so we do the same.\n // we explicitly call `getNormalizedLokiQuery` to make sure `queryType`\n // is set up correctly.\n const instant = getNormalizedLokiQuery(query).queryType === LokiQueryType.Instant;\n onAnnotationChange({\n ...annotation,\n expr: query.expr,\n maxLines: query.maxLines,\n instant,\n });\n };\n\n const queryWithRefId: LokiQuery = {\n refId: '',\n expr: annotation.expr,\n maxLines: annotation.maxLines,\n instant: annotation.instant,\n queryType: annotation.queryType,\n };\n return (\n <>\n <div className=\"gf-form-group\">\n <LokiQueryField\n datasource={props.datasource}\n query={queryWithRefId}\n onChange={onChangeQuery}\n onRunQuery={() => {}}\n history={history}\n ExtraFieldElement={\n <LokiOptionFields\n lineLimitValue={queryWithRefId?.maxLines?.toString() || ''}\n resolution={queryWithRefId.resolution || 1}\n query={queryWithRefId}\n onRunQuery={() => {}}\n onChange={onChangeQuery}\n />\n }\n />\n </div>\n\n <EditorRow>\n <EditorField\n label=\"Title\"\n tooltip={\n 'Use either the name or a pattern. For example, {{instance}} is replaced with label value for the label instance.'\n }\n >\n <Input\n type=\"text\"\n placeholder=\"alertname\"\n value={annotation.titleFormat}\n onChange={(event) => {\n onAnnotationChange({\n ...annotation,\n titleFormat: event.currentTarget.value,\n });\n }}\n />\n </EditorField>\n <EditorField label=\"Tags\">\n <Input\n type=\"text\"\n placeholder=\"label1,label2\"\n value={annotation.tagKeys}\n onChange={(event) => {\n onAnnotationChange({\n ...annotation,\n tagKeys: event.currentTarget.value,\n });\n }}\n />\n </EditorField>\n <EditorField\n label=\"Text\"\n tooltip={\n 'Use either the name or a pattern. For example, {{instance}} is replaced with label value for the label instance.'\n }\n >\n <Input\n type=\"text\"\n placeholder=\"instance\"\n value={annotation.textFormat}\n onChange={(event) => {\n onAnnotationChange({\n ...annotation,\n textFormat: event.currentTarget.value,\n });\n }}\n />\n </EditorField>\n </EditorRow>\n </>\n );\n});\n","import { DataFrame, QueryHint } from '@grafana/data';\n\nimport {\n isQueryWithLabelFilter,\n isQueryPipelineErrorFiltering,\n isQueryWithLabelFormat,\n isQueryWithParser,\n isQueryWithLineFilter,\n} from './queryUtils';\nimport {\n dataFrameHasLevelLabel,\n extractHasErrorLabelFromDataFrame,\n extractLevelLikeLabelFromDataFrame,\n extractLogParserFromDataFrame,\n} from './responseUtils';\n\nexport function getQueryHints(query: string, series: DataFrame[]): QueryHint[] {\n if (series.length === 0) {\n return [];\n }\n\n const hints: QueryHint[] = [];\n const { queryWithParser, parserCount } = isQueryWithParser(query);\n\n if (!queryWithParser) {\n const { hasLogfmt, hasJSON, hasPack } = extractLogParserFromDataFrame(series[0]);\n if (hasJSON) {\n if (hasPack) {\n hints.push({\n type: 'ADD_UNPACK_PARSER',\n label: 'Selected log stream selector has packed logs.',\n fix: {\n title: 'add unpack parser',\n label: 'Consider using unpack parser.',\n action: {\n type: 'ADD_UNPACK_PARSER',\n query,\n },\n },\n });\n } else {\n hints.push({\n type: 'ADD_JSON_PARSER',\n label: 'Selected log stream selector has JSON formatted logs.',\n fix: {\n title: 'add json parser',\n label: 'Consider using JSON parser.',\n action: {\n type: 'ADD_JSON_PARSER',\n query,\n },\n },\n });\n }\n }\n\n if (hasLogfmt) {\n hints.push({\n type: 'ADD_LOGFMT_PARSER',\n label: 'Selected log stream selector has logfmt formatted logs.',\n fix: {\n title: 'add logfmt parser',\n label: 'Consider using logfmt parser to turn key-value pairs in your log lines to labels.',\n action: {\n type: 'ADD_LOGFMT_PARSER',\n query,\n },\n },\n });\n }\n }\n\n if (queryWithParser) {\n // To keep this simple, we consider pipeline error filtering hint only is query has up to 1 parser\n if (parserCount === 1) {\n const hasPipelineErrorFiltering = isQueryPipelineErrorFiltering(query);\n const hasError = extractHasErrorLabelFromDataFrame(series[0]);\n if (hasError && !hasPipelineErrorFiltering) {\n hints.push({\n type: 'ADD_NO_PIPELINE_ERROR',\n label: 'Some logs in your selected log streams have parsing error.',\n fix: {\n title: 'remove pipeline errors',\n label: 'Consider filtering out logs with parsing errors.',\n action: {\n type: 'ADD_NO_PIPELINE_ERROR',\n query,\n },\n },\n });\n }\n }\n\n const hasLabelFilter = isQueryWithLabelFilter(query);\n\n if (!hasLabelFilter) {\n hints.push({\n type: 'ADD_LABEL_FILTER',\n label: 'Consider filtering logs by their label and value.',\n fix: {\n title: 'add label filter',\n label: '',\n action: {\n type: 'ADD_LABEL_FILTER',\n query,\n },\n },\n });\n }\n }\n\n const queryWithLabelFormat = isQueryWithLabelFormat(query);\n if (!queryWithLabelFormat) {\n const hasLevel = dataFrameHasLevelLabel(series[0]);\n const levelLikeLabel = extractLevelLikeLabelFromDataFrame(series[0]);\n\n // Add hint only if we don't have \"level\" label and have level-like label\n if (!hasLevel && levelLikeLabel) {\n hints.push({\n type: 'ADD_LEVEL_LABEL_FORMAT',\n label: `Some logs in your selected log stream have \"${levelLikeLabel}\" label.`,\n fix: {\n title: 'add label level format',\n label: `If ${levelLikeLabel} label has level values, consider using label_format to rename it to \"level\". Level label can be then visualized in log volumes.`,\n action: {\n type: 'ADD_LEVEL_LABEL_FORMAT',\n query,\n options: {\n renameTo: 'level',\n originalLabel: levelLikeLabel,\n },\n },\n },\n });\n }\n }\n\n const hasLineFilter = isQueryWithLineFilter(query);\n\n if (!hasLineFilter) {\n hints.push({\n type: 'ADD_LINE_FILTER',\n label: 'Consider filtering logs for specific string.',\n fix: {\n title: 'add line filter',\n label: '',\n action: {\n type: 'ADD_LINE_FILTER',\n query,\n },\n },\n });\n }\n\n return hints;\n}\n","// every timestamp in this file is a number which contains an unix-timestamp-in-millisecond format,\n// like returned by `new Date().getTime()`. this is needed because the \"math\"\n// has to be done on integer numbers.\n\n// the way loki handles logs-range-queries is that if you specify start & end,\n// one of those will be included, but the other will not. this allows us to\n// make it easy to split ranges.\n// for example, if the time-range is 100<>150,\n// we can split it into:\n// - 100<>120\n// - 120<>140\n// - 140<>150\n// and no log-line will be skipped or duplicated\n// (NOTE: we do these calculations in milliseconds. at the end, Loki receives\n// nanoseconds, but it will be OK, because it's simply a matter to adding `000000`,\n// to the end, so if we do it right in milliseconds, it should be OK in\n// nanoseconds too\n\nexport function splitTimeRange(\n startTime: number,\n endTime: number,\n idealRangeDuration: number\n): Array<[number, number]> {\n if (endTime - startTime <= idealRangeDuration) {\n return [[startTime, endTime]];\n }\n\n const result: Array<[number, number]> = [];\n\n // we walk backward, because we need want the potentially smaller \"last\" chunk\n // to be at the oldest timestamp.\n for (let chunkEndTime = endTime; chunkEndTime > startTime; chunkEndTime -= idealRangeDuration) {\n // when we get close to the start of the time range, we need to be sure not\n // to cross over the startTime\n const chunkStartTime = Math.max(chunkEndTime - idealRangeDuration, startTime);\n result.push([chunkStartTime, chunkEndTime]);\n }\n\n // because we walked backwards, we need to reverse the array\n result.reverse();\n\n return result;\n}\n","// every timestamp in this file is a number which contains an unix-timestamp-in-millisecond format,\n// like returned by `new Date().getTime()`. this is needed because the \"math\"\n// has to be done on integer numbers.\n\n// we are trying to be compatible with\n// https://github.com/grafana/loki/blob/089ec1b05f5ec15a8851d0e8230153e0eeb4dcec/pkg/querier/queryrange/split_by_interval.go#L327-L336\n\nexport function splitTimeRange(\n startTime: number,\n endTime: number,\n step: number,\n idealRangeDuration: number\n): Array<[number, number]> {\n if (idealRangeDuration < step) {\n // we cannot create chunks smaller than `step`\n return [[startTime, endTime]];\n }\n\n // we make the duration a multiple of `step`, lowering it if necessary\n const alignedDuration = Math.trunc(idealRangeDuration / step) * step;\n\n const alignedStartTime = startTime - (startTime % step);\n\n const result: Array<[number, number]> = [];\n\n // in a previous version we started iterating from the end, to the start.\n // However this is not easily possible as end timestamps are always inclusive\n // for Loki. So a `2022-02-08T00:00:00Z` end time with a 1day step would mean\n // to include the 08.02.2022, which we don't want. So we have to start from\n // the start, always ending at the last step before the actual end, or the total end.\n for (let chunkStartTime = alignedStartTime; chunkStartTime < endTime; chunkStartTime += alignedDuration) {\n const chunkEndTime = Math.min(chunkStartTime + alignedDuration - step, endTime);\n result.push([chunkStartTime, chunkEndTime]);\n }\n\n return result;\n}\n","import { groupBy, partition } from 'lodash';\nimport { Observable, Subscriber, Subscription, tap } from 'rxjs';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport {\n arrayToDataFrame,\n DataQueryRequest,\n DataQueryResponse,\n DataTopic,\n dateTime,\n durationToMilliseconds,\n parseDuration,\n rangeUtil,\n TimeRange,\n LoadingState,\n} from '@grafana/data';\nimport { combineResponses } from '@grafana/o11y-ds-frontend';\n\nimport { LokiDatasource } from './datasource';\nimport { splitTimeRange as splitLogsTimeRange } from './logsTimeSplitting';\nimport { splitTimeRange as splitMetricTimeRange } from './metricTimeSplitting';\nimport { isLogsQuery, isQueryWithRangeVariable } from './queryUtils';\nimport { trackGroupedQueries } from './tracking';\nimport { LokiGroupedRequest, LokiQuery, LokiQueryType } from './types';\n\nexport function partitionTimeRange(\n isLogsQuery: boolean,\n originalTimeRange: TimeRange,\n stepMs: number,\n duration: number\n): TimeRange[] {\n const start = originalTimeRange.from.toDate().getTime();\n const end = originalTimeRange.to.toDate().getTime();\n\n const ranges = isLogsQuery\n ? splitLogsTimeRange(start, end, duration)\n : splitMetricTimeRange(start, end, stepMs, duration);\n\n return ranges.map(([start, end]) => {\n const from = dateTime(start);\n const to = dateTime(end);\n return {\n from,\n to,\n raw: { from, to },\n };\n });\n}\n\n/**\n * Based in the state of the current response, if any, adjust target parameters such as `maxLines`.\n * For `maxLines`, we will update it as `maxLines - current amount of lines`.\n * At the end, we will filter the targets that don't need to be executed in the next request batch,\n * becasue, for example, the `maxLines` have been reached.\n */\nfunction adjustTargetsFromResponseState(targets: LokiQuery[], response: DataQueryResponse | null): LokiQuery[] {\n if (!response) {\n return targets;\n }\n\n return targets\n .map((target) => {\n if (!target.maxLines || !isLogsQuery(target.expr)) {\n return target;\n }\n const targetFrame = response.data.find((frame) => frame.refId === target.refId);\n if (!targetFrame) {\n return target;\n }\n const updatedMaxLines = target.maxLines - targetFrame.length;\n return {\n ...target,\n maxLines: updatedMaxLines < 0 ? 0 : updatedMaxLines,\n };\n })\n .filter((target) => target.maxLines === undefined || target.maxLines > 0);\n}\nexport function runSplitGroupedQueries(datasource: LokiDatasource, requests: LokiGroupedRequest[]) {\n const responseKey = requests.length ? requests[0].request.queryGroupId : uuidv4();\n let mergedResponse: DataQueryResponse = { data: [], state: LoadingState.Streaming, key: responseKey };\n const totalRequests = Math.max(...requests.map(({ partition }) => partition.length));\n const longestPartition = requests.filter(({ partition }) => partition.length === totalRequests)[0].partition;\n\n let shouldStop = false;\n let subquerySubsciption: Subscription | null = null;\n const runNextRequest = (subscriber: Subscriber<DataQueryResponse>, requestN: number, requestGroup: number) => {\n if (shouldStop) {\n subscriber.complete();\n return;\n }\n\n const done = () => {\n mergedResponse.state = LoadingState.Done;\n subscriber.next(mergedResponse);\n subscriber.complete();\n };\n\n const nextRequest = () => {\n const { nextRequestN, nextRequestGroup } = getNextRequestPointers(requests, requestGroup, requestN);\n if (nextRequestN > 0 && nextRequestGroup >= 0) {\n runNextRequest(subscriber, nextRequestN, nextRequestGroup);\n return;\n }\n done();\n };\n\n const group = requests[requestGroup];\n const range = group.partition[requestN - 1];\n const targets = adjustTargetsFromResponseState(group.request.targets, mergedResponse);\n\n if (!targets.length) {\n nextRequest();\n return;\n }\n\n const subRequest = { ...requests[requestGroup].request, range, targets };\n // request may not have a request id\n if (group.request.requestId) {\n subRequest.requestId = `${group.request.requestId}_${requestN}`;\n }\n\n subquerySubsciption = datasource.runQuery(subRequest).subscribe({\n next: (partialResponse) => {\n mergedResponse = combineResponses(mergedResponse, partialResponse);\n mergedResponse = updateLoadingFrame(mergedResponse, subRequest, longestPartition, requestN);\n if ((mergedResponse.errors ?? []).length > 0 || mergedResponse.error != null) {\n shouldStop = true;\n }\n },\n complete: () => {\n subscriber.next(mergedResponse);\n nextRequest();\n },\n error: (error) => {\n subscriber.error(error);\n },\n });\n };\n\n const response = new Observable<DataQueryResponse>((subscriber) => {\n runNextRequest(subscriber, totalRequests, 0);\n return () => {\n shouldStop = true;\n if (subquerySubsciption != null) {\n subquerySubsciption.unsubscribe();\n }\n };\n });\n\n return response;\n}\n\nexport const LOADING_FRAME_NAME = 'loki-splitting-progress';\n\nfunction updateLoadingFrame(\n response: DataQueryResponse,\n request: DataQueryRequest<LokiQuery>,\n partition: TimeRange[],\n requestN: number\n): DataQueryResponse {\n if (isLogsQuery(request.targets[0].expr)) {\n return response;\n }\n response.data = response.data.filter((frame) => frame.name !== LOADING_FRAME_NAME);\n\n if (requestN <= 1) {\n return response;\n }\n\n const loadingFrame = arrayToDataFrame([\n {\n time: partition[0].from.valueOf(),\n timeEnd: partition[requestN - 2].to.valueOf(),\n isRegion: true,\n color: 'rgba(120, 120, 120, 0.1)',\n },\n ]);\n loadingFrame.name = LOADING_FRAME_NAME;\n loadingFrame.meta = {\n dataTopic: DataTopic.Annotations,\n };\n\n response.data.push(loadingFrame);\n\n return response;\n}\n\nfunction getNextRequestPointers(requests: LokiGroupedRequest[], requestGroup: number, requestN: number) {\n // There's a pending request from the next group:\n for (let i = requestGroup + 1; i < requests.length; i++) {\n const group = requests[i];\n if (group.partition[requestN - 1]) {\n return {\n nextRequestGroup: i,\n nextRequestN: requestN,\n };\n }\n }\n return {\n // Find the first group where `[requestN - 1]` is defined\n nextRequestGroup: requests.findIndex((group) => group?.partition[requestN - 1] !== undefined),\n nextRequestN: requestN - 1,\n };\n}\n\nfunction querySupportsSplitting(query: LokiQuery) {\n return (\n query.queryType !== LokiQueryType.Instant &&\n // Queries with $__range variable should not be split because then the interpolated $__range variable is incorrect\n // because it is interpolated on the backend with the split timeRange\n !isQueryWithRangeVariable(query.expr)\n );\n}\n\nexport function runSplitQuery(datasource: LokiDatasource, request: DataQueryRequest<LokiQuery>) {\n const queries = request.targets.filter((query) => !query.hide).filter((query) => query.expr);\n const [nonSplittingQueries, normalQueries] = partition(queries, (query) => !querySupportsSplitting(query));\n const [logQueries, metricQueries] = partition(normalQueries, (query) => isLogsQuery(query.expr));\n\n request.queryGroupId = uuidv4();\n const oneDayMs = 24 * 60 * 60 * 1000;\n const rangePartitionedLogQueries = groupBy(logQueries, (query) =>\n query.splitDuration ? durationToMilliseconds(parseDuration(query.splitDuration)) : oneDayMs\n );\n const rangePartitionedMetricQueries = groupBy(metricQueries, (query) =>\n query.splitDuration ? durationToMilliseconds(parseDuration(query.splitDuration)) : oneDayMs\n );\n\n const requests: LokiGroupedRequest[] = [];\n for (const [chunkRangeMs, queries] of Object.entries(rangePartitionedLogQueries)) {\n const resolutionPartition = groupBy(queries, (query) => query.resolution || 1);\n for (const resolution in resolutionPartition) {\n requests.push({\n request: { ...request, targets: resolutionPartition[resolution] },\n partition: partitionTimeRange(true, request.range, request.intervalMs, Number(chunkRangeMs)),\n });\n }\n }\n\n for (const [chunkRangeMs, queries] of Object.entries(rangePartitionedMetricQueries)) {\n const stepMsPartition = groupBy(queries, (query) =>\n calculateStep(request.intervalMs, request.range, query.resolution || 1, query.step)\n );\n\n for (const stepMs in stepMsPartition) {\n const targets = stepMsPartition[stepMs].map((q) => {\n const { maxLines, ...query } = q;\n return query;\n });\n requests.push({\n request: { ...request, targets },\n partition: partitionTimeRange(false, request.range, Number(stepMs), Number(chunkRangeMs)),\n });\n }\n }\n\n if (nonSplittingQueries.length) {\n requests.push({\n request: { ...request, targets: nonSplittingQueries },\n partition: [request.range],\n });\n }\n\n const startTime = new Date();\n return runSplitGroupedQueries(datasource, requests).pipe(\n tap((response) => {\n if (response.state === LoadingState.Done) {\n trackGroupedQueries(response, requests, request, startTime, {\n predefinedOperations: datasource.predefinedOperations,\n });\n }\n })\n );\n}\n\n// Replicate from backend for split queries for now, until we can move query splitting to the backend\n// https://github.com/grafana/grafana/blob/main/pkg/tsdb/loki/step.go#L23\nfunction calculateStep(intervalMs: number, range: TimeRange, resolution: number, step: string | undefined) {\n // If we can parse step,the we use it\n // Otherwise we will calculate step based on interval\n const interval_regex = /(-?\\d+(?:\\.\\d+)?)(ms|[Mwdhmsy])/;\n if (step?.match(interval_regex)) {\n return rangeUtil.intervalToMs(step) * resolution;\n }\n\n const newStep = intervalMs * resolution;\n const safeStep = Math.round((range.to.valueOf() - range.from.valueOf()) / 11000);\n return Math.max(newStep, safeStep);\n}\n","import { map, Observable, defer, mergeMap } from 'rxjs';\n\nimport {\n DataFrameJSON,\n DataQueryRequest,\n DataQueryResponse,\n LiveChannelScope,\n LoadingState,\n StreamingDataFrame,\n} from '@grafana/data';\nimport { getGrafanaLiveSrv, config } from '@grafana/runtime';\n\nimport { LokiDatasource } from './datasource';\nimport { LokiQuery } from './types';\n\n/**\n * Calculate a unique key for the query. The key is used to pick a channel and should\n * be unique for each distinct query execution plan. This key is not secure and is only picked to avoid\n * possible collisions\n */\nexport async function getLiveStreamKey(query: LokiQuery): Promise<string> {\n const str = JSON.stringify({ expr: query.expr });\n\n const msgUint8 = new TextEncoder().encode(str); // encode as (utf-8) Uint8Array\n const hashBuffer = await crypto.subtle.digest('SHA-1', msgUint8); // hash the message\n const hashArray = Array.from(new Uint8Array(hashBuffer.slice(0, 8))); // first 8 bytes\n return hashArray.map((b) => b.toString(16).padStart(2, '0')).join('');\n}\n\n// This will get both v1 and v2 result formats\nexport function doLokiChannelStream(\n query: LokiQuery,\n ds: LokiDatasource,\n options: DataQueryRequest<LokiQuery>\n): Observable<DataQueryResponse> {\n // maximum time to keep values\n const range = options.range;\n const maxDelta = range.to.valueOf() - range.from.valueOf() + 1000;\n let maxLength = options.maxDataPoints ?? 1000;\n if (maxLength > 100) {\n // for small buffers, keep them small\n maxLength *= 2;\n }\n\n let frame: StreamingDataFrame | undefined = undefined;\n const updateFrame = (msg: any) => {\n if (msg?.message) {\n const p: DataFrameJSON = msg.message;\n if (!frame) {\n frame = StreamingDataFrame.fromDataFrameJSON(p, {\n maxLength,\n maxDelta,\n displayNameFormat: query.legendFormat,\n });\n } else {\n frame.push(p);\n }\n }\n return frame;\n };\n\n return defer(() => getLiveStreamKey(query)).pipe(\n mergeMap((key) => {\n return getGrafanaLiveSrv()\n .getStream<any>({\n scope: LiveChannelScope.DataSource,\n namespace: ds.uid,\n path: `tail/${key}`,\n data: {\n ...query,\n timeRange: {\n from: range.from.valueOf().toString(),\n to: range.to.valueOf().toString(),\n },\n },\n })\n .pipe(\n map((evt) => {\n const frame = updateFrame(evt);\n return {\n data: frame ? [frame] : [],\n state: LoadingState.Streaming,\n };\n })\n );\n })\n );\n}\n\nexport const convertToWebSocketUrl = (url: string) => {\n const protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://';\n let backend = `${protocol}${window.location.host}${config.appSubUrl}`;\n if (backend.endsWith('/')) {\n backend = backend.slice(0, -1);\n }\n return `${backend}${url}`;\n};\n","import { cloneDeep, map as lodashMap } from 'lodash';\nimport { lastValueFrom, merge, Observable, of, throwError } from 'rxjs';\nimport { catchError, map, switchMap, tap } from 'rxjs/operators';\n\nimport {\n AbstractQuery,\n AnnotationEvent,\n AnnotationQueryRequest,\n CoreApp,\n DataFrame,\n DataFrameView,\n DataQueryRequest,\n DataQueryResponse,\n DataSourceInstanceSettings,\n DataSourceWithLogsContextSupport,\n DataSourceWithSupplementaryQueriesSupport,\n SupplementaryQueryType,\n DataSourceWithQueryExportSupport,\n DataSourceWithQueryImportSupport,\n Labels,\n LoadingState,\n LogRowModel,\n QueryFixAction,\n QueryHint,\n rangeUtil,\n ScopedVars,\n SupplementaryQueryOptions,\n TimeRange,\n LogRowContextOptions,\n DataSourceWithToggleableQueryFiltersSupport,\n ToggleFilterAction,\n QueryFilterOptions,\n renderLegendFormat,\n LegacyMetricFindQueryOptions,\n AdHocVariableFilter,\n urlUtil,\n MetricFindValue,\n DataSourceGetTagValuesOptions,\n DataSourceGetTagKeysOptions,\n DataSourceWithQueryModificationSupport,\n} from '@grafana/data';\nimport { Duration } from '@grafana/lezer-logql';\nimport { BackendSrvRequest, config, DataSourceWithBackend, getTemplateSrv, TemplateSrv } from '@grafana/runtime';\nimport { DataQuery } from '@grafana/schema';\n\nimport LanguageProvider from './LanguageProvider';\nimport { LiveStreams, LokiLiveTarget } from './LiveStreams';\nimport { LogContextProvider } from './LogContextProvider';\nimport { LokiVariableSupport } from './LokiVariableSupport';\nimport { transformBackendResult } from './backendResultTransformer';\nimport { LokiAnnotationsQueryEditor } from './components/AnnotationsQueryEditor';\nimport { placeHolderScopedVars } from './components/monaco-query-field/monaco-completion-provider/validation';\nimport { escapeLabelValueInSelector, isRegexSelector, getLabelTypeFromFrame } from './languageUtils';\nimport { labelNamesRegex, labelValuesRegex } from './migrations/variableQueryMigrations';\nimport {\n addLabelFormatToQuery,\n addLabelToQuery,\n addNoPipelineErrorToQuery,\n addParserToQuery,\n removeCommentsFromQuery,\n addFilterAsLabelFilter,\n getParserPositions,\n toLabelFilter,\n addLineFilter,\n findLastPosition,\n getLabelFilterPositions,\n queryHasFilter,\n removeLabelFromQuery,\n} from './modifyQuery';\nimport { getQueryHints } from './queryHints';\nimport { runSplitQuery } from './querySplitting';\nimport {\n getLogQueryFromMetricsQuery,\n getLokiQueryFromDataQuery,\n getNodesFromQuery,\n getNormalizedLokiQuery,\n getStreamSelectorsFromQuery,\n isLogsQuery,\n isQueryWithError,\n requestSupportsSplitting,\n} from './queryUtils';\nimport { replaceVariables, returnVariables } from './querybuilder/parsingUtils';\nimport { convertToWebSocketUrl, doLokiChannelStream } from './streaming';\nimport { trackQuery } from './tracking';\nimport {\n LokiOptions,\n LokiQuery,\n LokiQueryType,\n LokiVariableQuery,\n LokiVariableQueryType,\n QueryStats,\n SupportingQueryType,\n} from './types';\n\nexport type RangeQueryOptions = DataQueryRequest<LokiQuery> | AnnotationQueryRequest<LokiQuery>;\nexport const DEFAULT_MAX_LINES = 1000;\nexport const DEFAULT_MAX_LINES_SAMPLE = 10;\nexport const LOKI_ENDPOINT = '/loki/api/v1';\nexport const REF_ID_DATA_SAMPLES = 'loki-data-samples';\nexport const REF_ID_STARTER_ANNOTATION = 'annotation-';\nexport const REF_ID_STARTER_LOG_ROW_CONTEXT = 'log-row-context-query-';\nexport const REF_ID_STARTER_LOG_VOLUME = 'log-volume-';\nexport const REF_ID_STARTER_LOG_SAMPLE = 'log-sample-';\nexport const REF_ID_STARTER_STATS = 'log-stats-';\n\nconst NS_IN_MS = 1000000;\n\nexport function makeRequest(\n query: LokiQuery,\n range: TimeRange,\n app: CoreApp,\n requestId: string,\n hideFromInspector?: boolean\n): DataQueryRequest<LokiQuery> {\n const intervalInfo = rangeUtil.calculateInterval(range, 1);\n return {\n targets: [query],\n requestId,\n interval: intervalInfo.interval,\n intervalMs: intervalInfo.intervalMs,\n range: range,\n scopedVars: {},\n timezone: 'UTC',\n app,\n startTime: Date.now(),\n hideFromInspector,\n };\n}\n\nexport class LokiDatasource\n extends DataSourceWithBackend<LokiQuery, LokiOptions>\n implements\n DataSourceWithLogsContextSupport,\n DataSourceWithSupplementaryQueriesSupport<LokiQuery>,\n DataSourceWithQueryImportSupport<LokiQuery>,\n DataSourceWithQueryExportSupport<LokiQuery>,\n DataSourceWithToggleableQueryFiltersSupport<LokiQuery>,\n DataSourceWithQueryModificationSupport<LokiQuery>\n{\n private streams = new LiveStreams();\n private logContextProvider: LogContextProvider;\n languageProvider: LanguageProvider;\n maxLines: number;\n predefinedOperations: string;\n\n constructor(\n private instanceSettings: DataSourceInstanceSettings<LokiOptions>,\n private readonly templateSrv: TemplateSrv = getTemplateSrv()\n ) {\n super(instanceSettings);\n\n this.languageProvider = new LanguageProvider(this);\n const settingsData = instanceSettings.jsonData || {};\n this.maxLines = parseInt(settingsData.maxLines ?? '0', 10) || DEFAULT_MAX_LINES;\n this.predefinedOperations = settingsData.predefinedOperations ?? '';\n this.annotations = {\n QueryEditor: LokiAnnotationsQueryEditor,\n };\n this.variables = new LokiVariableSupport(this);\n this.logContextProvider = new LogContextProvider(this);\n }\n\n /**\n * Implemented for DataSourceWithSupplementaryQueriesSupport.\n * It generates a DataQueryRequest for a specific supplementary query type.\n * @returns A DataQueryRequest for the supplementary queries or undefined if not supported.\n */\n getSupplementaryRequest(\n type: SupplementaryQueryType,\n request: DataQueryRequest<LokiQuery>\n ): DataQueryRequest<LokiQuery> | undefined {\n switch (type) {\n case SupplementaryQueryType.LogsVolume:\n return this.getLogsVolumeDataProvider(request);\n case SupplementaryQueryType.LogsSample:\n return this.getLogsSampleDataProvider(request);\n default:\n return undefined;\n }\n }\n\n /**\n * Implemented for DataSourceWithSupplementaryQueriesSupport.\n * It returns the supplementary types that the data source supports.\n * @returns An array of supported supplementary query types.\n */\n getSupportedSupplementaryQueryTypes(): SupplementaryQueryType[] {\n return [SupplementaryQueryType.LogsVolume, SupplementaryQueryType.LogsSample];\n }\n\n /**\n * Implemented for DataSourceWithSupplementaryQueriesSupport.\n * It retrieves supplementary queries based on the provided options and Loki query.\n * @returns A supplemented Loki query or undefined if unsupported.\n */\n getSupplementaryQuery(options: SupplementaryQueryOptions, query: LokiQuery): LokiQuery | undefined {\n const normalizedQuery = getNormalizedLokiQuery(query);\n let expr = removeCommentsFromQuery(normalizedQuery.expr);\n let isQuerySuitable = false;\n\n switch (options.type) {\n case SupplementaryQueryType.LogsVolume:\n // it has to be a logs-producing range-query\n isQuerySuitable = !!(expr && isLogsQuery(expr) && normalizedQuery.queryType === LokiQueryType.Range);\n if (!isQuerySuitable) {\n return undefined;\n }\n\n const dropErrorExpression = `${expr} | drop __error__`;\n if (isQueryWithError(this.interpolateString(dropErrorExpression, placeHolderScopedVars)) === false) {\n expr = dropErrorExpression;\n }\n\n return {\n ...normalizedQuery,\n refId: `${REF_ID_STARTER_LOG_VOLUME}${normalizedQuery.refId}`,\n queryType: LokiQueryType.Range,\n supportingQueryType: SupportingQueryType.LogsVolume,\n expr: `sum by (level) (count_over_time(${expr}[$__auto]))`,\n };\n\n case SupplementaryQueryType.LogsSample:\n // it has to be a metric query\n isQuerySuitable = !!(expr && !isLogsQuery(expr));\n if (!isQuerySuitable) {\n return undefined;\n }\n return {\n ...normalizedQuery,\n queryType: LokiQueryType.Range,\n refId: `${REF_ID_STARTER_LOG_SAMPLE}${normalizedQuery.refId}`,\n expr: getLogQueryFromMetricsQuery(expr),\n maxLines: Number.isNaN(Number(options.limit)) ? this.maxLines : Number(options.limit),\n };\n\n default:\n return undefined;\n }\n }\n\n /**\n * Private method used in the `getDataProvider` for DataSourceWithSupplementaryQueriesSupport, specifically for Logs volume queries.\n * @returns An Observable of DataQueryResponse or undefined if no suitable queries are found.\n */\n private getLogsVolumeDataProvider(request: DataQueryRequest<LokiQuery>): DataQueryRequest<LokiQuery> | undefined {\n const logsVolumeRequest = cloneDeep(request);\n const targets = logsVolumeRequest.targets\n .map((query) => this.getSupplementaryQuery({ type: SupplementaryQueryType.LogsVolume }, query))\n .filter((query): query is LokiQuery => !!query);\n\n if (!targets.length) {\n return undefined;\n }\n\n return { ...logsVolumeRequest, targets };\n }\n\n /**\n * Private method used in the `getDataProvider` for DataSourceWithSupplementaryQueriesSupport, specifically for Logs sample queries.\n * @returns An Observable of DataQueryResponse or undefined if no suitable queries are found.\n */\n private getLogsSampleDataProvider(request: DataQueryRequest<LokiQuery>): DataQueryRequest<LokiQuery> | undefined {\n const logsSampleRequest = cloneDeep(request);\n const targets = logsSampleRequest.targets\n .map((query) => this.getSupplementaryQuery({ type: SupplementaryQueryType.LogsSample, limit: 100 }, query))\n .filter((query): query is LokiQuery => !!query);\n\n if (!targets.length) {\n return undefined;\n }\n return { ...logsSampleRequest, targets };\n }\n\n /**\n * Required by DataSourceApi. It executes queries based on the provided DataQueryRequest.\n * @returns An Observable of DataQueryResponse containing the query results.\n */\n query(request: DataQueryRequest<LokiQuery>): Observable<DataQueryResponse> {\n const queries = request.targets\n .map(getNormalizedLokiQuery) // used to \"fix\" the deprecated `.queryType` prop\n .map((q) => ({ ...q, maxLines: q.maxLines ?? this.maxLines }));\n\n const fixedRequest: DataQueryRequest<LokiQuery> = {\n ...request,\n targets: queries,\n };\n\n const streamQueries = fixedRequest.targets.filter((q) => q.queryType === LokiQueryType.Stream);\n if (\n config.featureToggles.lokiExperimentalStreaming &&\n streamQueries.length > 0 &&\n fixedRequest.rangeRaw?.to === 'now'\n ) {\n // this is still an in-development feature,\n // we do not support mixing stream-queries with normal-queries for now.\n const streamRequest = {\n ...fixedRequest,\n targets: streamQueries,\n };\n return merge(\n ...streamQueries.map((q) =>\n doLokiChannelStream(\n this.applyTemplateVariables(q, request.scopedVars),\n this, // the datasource\n streamRequest\n )\n )\n );\n }\n\n if (fixedRequest.liveStreaming) {\n return this.runLiveQueryThroughBackend(fixedRequest);\n }\n\n if (config.featureToggles.lokiQuerySplitting && requestSupportsSplitting(fixedRequest.targets)) {\n return runSplitQuery(this, fixedRequest);\n }\n\n const startTime = new Date();\n return this.runQuery(fixedRequest).pipe(\n tap((response) =>\n trackQuery(response, fixedRequest, startTime, { predefinedOperations: this.predefinedOperations })\n )\n );\n }\n\n /**\n * Executes requests through the backend using the `super.query()`, as part of the `query` method in DataSourceWithBackend.\n * @returns An Observable of transformed DataQueryResponse results from the backend.\n */\n runQuery(fixedRequest: DataQueryRequest<LokiQuery>) {\n return super\n .query(fixedRequest)\n .pipe(\n map((response) =>\n transformBackendResult(response, fixedRequest.targets, this.instanceSettings.jsonData.derivedFields ?? [])\n )\n );\n }\n\n /**\n * Used within the `query` to execute live queries.\n * It is intended for explore-mode and logs-queries, not metric queries.\n * @returns An Observable of DataQueryResponse with live query results or an empty response if no suitable queries are found.\n * @todo: The name says \"backend\" but it's actually running the query through the frontend. We should fix this.\n */\n private runLiveQueryThroughBackend(request: DataQueryRequest<LokiQuery>): Observable<DataQueryResponse> {\n // this only works in explore-mode so variables don't need to be handled,\n // and only for logs-queries, not metric queries\n const logsQueries = request.targets.filter((query) => query.expr !== '' && isLogsQuery(query.expr));\n\n if (logsQueries.length === 0) {\n return of({\n data: [],\n state: LoadingState.Done,\n });\n }\n\n const subQueries = logsQueries.map((query) => {\n const maxDataPoints = query.maxLines || this.maxLines;\n // FIXME: currently we are running it through the frontend still.\n return this.runLiveQuery(query, maxDataPoints);\n });\n\n return merge(...subQueries);\n }\n\n /**\n * Used within the `runLiveQuery` to create a live target for a Loki query.\n * @returns A LokiLiveTarget object containing the necessary information for a live query.\n */\n private createLiveTarget(target: LokiQuery, maxDataPoints: number): LokiLiveTarget {\n const query = target.expr;\n const baseUrl = this.instanceSettings.url;\n const params = urlUtil.serializeParams({ query });\n\n return {\n query,\n url: convertToWebSocketUrl(`${baseUrl}/loki/api/v1/tail?${params}`),\n refId: target.refId,\n size: maxDataPoints,\n };\n }\n\n /**\n * Runs live queries, which involves creating a WebSocket connection to listen for new logs.\n * It returns a slightly different DataQueryResponse compared to runQueries. It provides a single DataFrame\n * even if there are multiple Loki streams. Common labels are set on dataFrame.labels, and unique labels per row are\n * available in dataFrame.fields.labels.\n * @returns An Observable of DataQueryResponse with streaming data or an error message if live tailing encounters an issue.\n */\n private runLiveQuery = (target: LokiQuery, maxDataPoints: number): Observable<DataQueryResponse> => {\n const liveTarget = this.createLiveTarget(target, maxDataPoints);\n\n return this.streams.getStream(liveTarget).pipe(\n map((data) => ({\n data: data || [],\n key: `loki-${liveTarget.refId}`,\n state: LoadingState.Streaming,\n })),\n catchError((err: any) => {\n return throwError(() => `Live tailing was stopped due to following error: ${err.reason}`);\n })\n );\n };\n\n /**\n * Implemented as a part of DataSourceApi. Interpolates variables and adds ad hoc filters to a list of Loki queries.\n * @returns An array of expanded Loki queries with interpolated variables and ad hoc filters.\n */\n interpolateVariablesInQueries(\n queries: LokiQuery[],\n scopedVars: ScopedVars,\n adhocFilters?: AdHocVariableFilter[]\n ): LokiQuery[] {\n let expandedQueries = queries;\n if (queries && queries.length) {\n expandedQueries = queries.map((query) => ({\n ...query,\n datasource: this.getRef(),\n expr: this.addAdHocFilters(\n this.templateSrv.replace(query.expr, scopedVars, this.interpolateQueryExpr),\n adhocFilters\n ),\n }));\n }\n\n return expandedQueries;\n }\n\n /**\n * Implemented as part of DataSourceApi. Converts a Loki query to a simple text string.\n * Used, for example, in Query history.\n * @returns A text representation of the query.\n */\n getQueryDisplayText(query: LokiQuery) {\n return query.expr;\n }\n\n /**\n * Given a time range, returns it as Loki parameters.\n * @returns An object containing the start and end times in nanoseconds since the Unix epoch.\n */\n getTimeRangeParams(timeRange: TimeRange) {\n return { start: timeRange.from.valueOf() * NS_IN_MS, end: timeRange.to.valueOf() * NS_IN_MS };\n }\n\n /**\n * Implemented as part of DataSourceWithQueryImportSupport.\n * Imports queries from AbstractQuery objects when switching between different data source types.\n * @returns A Promise that resolves to an array of Loki queries.\n */\n async importFromAbstractQueries(abstractQueries: AbstractQuery[]): Promise<LokiQuery[]> {\n await this.languageProvider.start();\n const existingKeys = this.languageProvider.labelKeys;\n\n if (existingKeys && existingKeys.length) {\n abstractQueries = abstractQueries.map((abstractQuery) => {\n abstractQuery.labelMatchers = abstractQuery.labelMatchers.filter((labelMatcher) => {\n return existingKeys.includes(labelMatcher.name);\n });\n return abstractQuery;\n });\n }\n\n return abstractQueries.map((abstractQuery) => this.languageProvider.importFromAbstractQuery(abstractQuery));\n }\n\n /**\n * Implemented as part of DataSourceWithQueryImportSupport.\n * Exports Loki queries to AbstractQuery objects when switching between different data source types.\n * @returns A Promise that resolves to an array of AbstractQuery objects.\n */\n async exportToAbstractQueries(queries: LokiQuery[]): Promise<AbstractQuery[]> {\n return queries.map((query) => this.languageProvider.exportToAbstractQuery(query));\n }\n\n /**\n * A method that wraps `getResource` from DataSourceWithBackend to perform metadata requests, with an additional check for valid URL values.\n * @returns A Promise that resolves to the data retrieved from the metadata request, or an empty array if no data is available.\n */\n async metadataRequest(url: string, params?: Record<string, string | number>, options?: Partial<BackendSrvRequest>) {\n // url must not start with a `/`, otherwise the AJAX-request\n // going from the browser will contain `//`, which can cause problems.\n if (url.startsWith('/')) {\n throw new Error(`invalid metadata request url: ${url}`);\n }\n\n const res = await this.getResource(url, params, options);\n return res.data || [];\n }\n\n /**\n * Used in `getQueryStats`. It wraps `getResource` from DataSourceWithBackend to perform a stats request\n * Specifically designed for the stats endpoint, which does not return data but includes stats directly in the response object.\n * @returns A Promise that resolves to a QueryStats object containing the statistics retrieved from the stats request.\n */\n async statsMetadataRequest(\n url: string,\n params?: Record<string, string | number>,\n options?: Partial<BackendSrvRequest>\n ): Promise<QueryStats> {\n if (url.startsWith('/')) {\n throw new Error(`invalid metadata request url: ${url}`);\n }\n\n return await this.getResource(url, params, options);\n }\n\n /**\n * Used in `getStats`. Retrieves statistics for a Loki query and processes them into a QueryStats object.\n * @returns A Promise that resolves to a QueryStats object containing the query statistics or undefined if the query is invalid.\n */\n async getQueryStats(query: LokiQuery, timeRange: TimeRange): Promise<QueryStats | undefined> {\n // if query is invalid, clear stats, and don't request\n if (isQueryWithError(this.interpolateString(query.expr, placeHolderScopedVars))) {\n return undefined;\n }\n\n const labelMatchers = getStreamSelectorsFromQuery(query.expr);\n let statsForAll: QueryStats = { streams: 0, chunks: 0, bytes: 0, entries: 0 };\n\n for (const idx in labelMatchers) {\n const { start, end } = this.getStatsTimeRange(query, Number(idx), timeRange);\n\n if (start === undefined || end === undefined) {\n return { streams: 0, chunks: 0, bytes: 0, entries: 0, message: 'Query size estimate not available.' };\n }\n\n try {\n const data = await this.statsMetadataRequest(\n 'index/stats',\n {\n query: labelMatchers[idx],\n start: start,\n end: end,\n },\n { showErrorAlert: false, requestId: `${REF_ID_STARTER_STATS}${query.refId}` }\n );\n\n statsForAll = {\n streams: statsForAll.streams + data.streams,\n chunks: statsForAll.chunks + data.chunks,\n bytes: statsForAll.bytes + data.bytes,\n entries: statsForAll.entries + data.entries,\n };\n } catch (e) {\n break;\n }\n }\n\n return statsForAll;\n }\n\n /**\n * Used within the `getQueryStats`. Retrieves the time range for a Loki stats query, adjusting it to cover the requested period.\n * In metric queries, this means extending it over the range interval.\n * @returns An object containing the start and end time in nanoseconds (NS_IN_MS) or undefined if the time range cannot be estimated.\n */\n\n getStatsTimeRange(\n query: LokiQuery,\n idx: number,\n timeRange: TimeRange\n ): { start: number | undefined; end: number | undefined } {\n let start: number, end: number;\n const NS_IN_MS = 1000000;\n const durationNodes = getNodesFromQuery(query.expr, [Duration]);\n const durations = durationNodes.map((d) => query.expr.substring(d.from, d.to));\n\n if (isLogsQuery(query.expr)) {\n // logs query with instant type can not be estimated\n if (query.queryType === LokiQueryType.Instant) {\n return { start: undefined, end: undefined };\n }\n // logs query with range type\n return this.getTimeRangeParams(timeRange);\n }\n\n if (query.queryType === LokiQueryType.Instant) {\n // metric query with instant type\n\n if (!!durations[idx]) {\n // if query has a duration e.g. [1m]\n end = this.getTimeRangeParams(timeRange).end;\n start = end - rangeUtil.intervalToMs(durations[idx]) * NS_IN_MS;\n return { start, end };\n } else {\n // if query has no duration e.g. [$__interval]\n\n if (/(\\$__auto|\\$__range)/.test(query.expr)) {\n // if $__auto or $__range is used, we can estimate the time range using the selected range\n return this.getTimeRangeParams(timeRange);\n }\n\n // otherwise we cant estimate the time range\n return { start: undefined, end: undefined };\n }\n }\n\n // metric query with range type\n return this.getTimeRangeParams(timeRange);\n }\n\n /**\n * Retrieves statistics for a Loki query and returns the QueryStats object.\n * @returns A Promise that resolves to a QueryStats object or null if the query is invalid or has no statistics.\n */\n async getStats(query: LokiQuery, timeRange: TimeRange): Promise<QueryStats | null> {\n if (!query.expr) {\n return null;\n }\n\n const response = await this.getQueryStats(query, timeRange);\n\n if (!response) {\n return null;\n }\n\n return Object.values(response).every((v) => v === 0) ? null : response;\n }\n\n /**\n * Implemented as part of DataSourceAPI and used for template variable queries.\n * @returns A Promise that resolves to an array of results from the metric find query.\n */\n async metricFindQuery(\n query: LokiVariableQuery | string,\n options?: LegacyMetricFindQueryOptions\n ): Promise<MetricFindValue[]> {\n if (!query) {\n return Promise.resolve([]);\n }\n\n let interpolatedVariableQuery: LokiVariableQuery | undefined;\n\n if (typeof query === 'string') {\n interpolatedVariableQuery = this.parseStringToVariableQuery(this.interpolateString(query, options?.scopedVars));\n } else {\n interpolatedVariableQuery = {\n ...query,\n label: this.interpolateString(query.label || '', options?.scopedVars),\n stream: this.interpolateString(query.stream || '', options?.scopedVars),\n };\n }\n\n if (interpolatedVariableQuery) {\n return await this.processMetricFindQuery(interpolatedVariableQuery, options?.range);\n }\n\n return Promise.resolve([]);\n }\n\n /**\n * Used within the `metricFindQuery`. Retrieves the correct variable results based on the provided LokiVariableQuery.\n * @returns A Promise that resolves to an array of variable results based on the query type and parameters.\n */\n\n private async processMetricFindQuery(query: LokiVariableQuery, timeRange?: TimeRange): Promise<MetricFindValue[]> {\n if (query.type === LokiVariableQueryType.LabelNames) {\n const result = await this.languageProvider.fetchLabels({ timeRange });\n return result.map((value: string) => ({ text: value }));\n }\n\n if (!query.label) {\n return [];\n }\n\n // If we have stream selector, use /series endpoint\n if (query.stream) {\n const result = await this.languageProvider.fetchSeriesLabels(query.stream, { timeRange });\n if (!result[query.label]) {\n return [];\n }\n return result[query.label].map((value: string) => ({ text: value }));\n }\n\n const result = await this.languageProvider.fetchLabelValues(query.label, { timeRange });\n return result.map((value: string) => ({ text: value }));\n }\n\n /**\n * Used in `metricFindQuery` to process legacy query strings (label_name() and label_values()) to variable query objects.\n * @returns LokiVariableQuery object based on the provided query string, or undefined if string can't be parsed.\n */\n private parseStringToVariableQuery(query: string): LokiVariableQuery | undefined {\n const refId = 'LokiVariableQueryEditor-VariableQuery';\n const labelNames = query.match(labelNamesRegex);\n if (labelNames) {\n return {\n type: LokiVariableQueryType.LabelNames,\n refId,\n };\n }\n\n const labelValues = query.match(labelValuesRegex);\n if (labelValues) {\n return {\n type: LokiVariableQueryType.LabelValues,\n label: labelValues[2],\n stream: labelValues[1],\n refId,\n };\n }\n return undefined;\n }\n\n /**\n * Used to fetch data samples, typically for autocompletion and query building to recommend parsers, labels, and values based on sampled data.\n * Currently, it works for logs data only.\n * @returns A Promise that resolves to an array of DataFrames containing data samples.\n */\n async getDataSamples(query: LokiQuery, timeRange: TimeRange): Promise<DataFrame[]> {\n // Currently works only for logs sample\n if (!isLogsQuery(query.expr) || isQueryWithError(this.interpolateString(query.expr, placeHolderScopedVars))) {\n return [];\n }\n\n const lokiLogsQuery: LokiQuery = {\n expr: query.expr,\n queryType: LokiQueryType.Range,\n refId: REF_ID_DATA_SAMPLES,\n maxLines: query.maxLines || DEFAULT_MAX_LINES_SAMPLE,\n supportingQueryType: SupportingQueryType.DataSample,\n };\n\n const request = makeRequest(lokiLogsQuery, timeRange, CoreApp.Unknown, REF_ID_DATA_SAMPLES, true);\n return await lastValueFrom(this.query(request).pipe(switchMap((res) => of(res.data))));\n }\n\n /**\n * Implemented as part of the DataSourceAPI. Retrieves tag keys that can be used for ad-hoc filtering.\n * @returns A Promise that resolves to an array of label names represented as MetricFindValue objects.\n */\n async getTagKeys(options?: DataSourceGetTagKeysOptions<LokiQuery>): Promise<MetricFindValue[]> {\n const result = await this.languageProvider.fetchLabels({ timeRange: options?.timeRange });\n return result.map((value: string) => ({ text: value }));\n }\n\n /**\n * Implemented as part of the DataSourceAPI. Retrieves tag values that can be used for ad-hoc filtering.\n * @returns A Promise that resolves to an array of label values represented as MetricFindValue objects\n */\n async getTagValues(options: DataSourceGetTagValuesOptions): Promise<MetricFindValue[]> {\n const result = await this.languageProvider.fetchLabelValues(options.key, { timeRange: options.timeRange });\n return result.map((value: string) => ({ text: value }));\n }\n\n /**\n * Used for interpolation logic in `interpolateVariablesInQueries` and `applyTemplateVariables`.\n * Handles escaping of special characters based on variable type and value.\n * @returns The interpolated value with appropriate character escaping.\n */\n interpolateQueryExpr(value: any, variable: any) {\n // if no multi or include all do not regexEscape\n if (!variable.multi && !variable.includeAll) {\n return lokiRegularEscape(value);\n }\n\n if (typeof value === 'string') {\n return lokiSpecialRegexEscape(value);\n }\n\n const escapedValues = lodashMap(value, lokiSpecialRegexEscape);\n return escapedValues.join('|');\n }\n\n /**\n * Implemented for `DataSourceWithToggleableQueryFiltersSupport`. Toggles a filter on or off based on the provided filter action.\n * It is used for example in Explore to toggle fields on and off trough log details.\n * @returns A new LokiQuery with the filter toggled as specified.\n */\n toggleQueryFilter(query: LokiQuery, filter: ToggleFilterAction): LokiQuery {\n let expression = query.expr ?? '';\n const labelType = getLabelTypeFromFrame(filter.options.key, filter.frame, 0);\n switch (filter.type) {\n case 'FILTER_FOR': {\n if (filter.options?.key && filter.options?.value) {\n const value = escapeLabelValueInSelector(filter.options.value);\n\n // This gives the user the ability to toggle a filter on and off.\n expression = queryHasFilter(expression, filter.options.key, '=', value)\n ? removeLabelFromQuery(expression, filter.options.key, '=', value)\n : addLabelToQuery(expression, filter.options.key, '=', value, labelType);\n }\n break;\n }\n case 'FILTER_OUT': {\n if (filter.options?.key && filter.options?.value) {\n const value = escapeLabelValueInSelector(filter.options.value);\n\n /**\n * If there is a filter with the same key and value, remove it.\n * This prevents the user from seeing no changes in the query when they apply\n * this filter.\n */\n if (queryHasFilter(expression, filter.options.key, '=', value)) {\n expression = removeLabelFromQuery(expression, filter.options.key, '=', value);\n }\n\n expression = addLabelToQuery(expression, filter.options.key, '!=', value, labelType);\n }\n break;\n }\n default:\n break;\n }\n return { ...query, expr: expression };\n }\n\n /**\n * Implemented for `DataSourceWithToggleableQueryFiltersSupport`. Checks if a query expression contains a filter based on the provided filter options.\n * @returns A boolean value indicating whether the filter exists in the query expression.\n */\n queryHasFilter(query: LokiQuery, filter: QueryFilterOptions): boolean {\n let expression = query.expr ?? '';\n return queryHasFilter(expression, filter.key, '=', filter.value);\n }\n\n /**\n * Implemented as part of `DataSourceWithQueryModificationSupport`. Used to modify a query based on the provided action.\n * It is used, for example, in the Query Builder to apply hints such as parsers, operations, etc.\n * @returns A new LokiQuery with the specified modification applied.\n */\n modifyQuery(query: LokiQuery, action: QueryFixAction): LokiQuery {\n let expression = query.expr ?? '';\n // NB: Usually the labelKeys should be fetched and cached in the datasource,\n // but there might be some edge cases where this wouldn't be the case.\n // However the changed would make this method `async`.\n switch (action.type) {\n case 'ADD_FILTER': {\n if (action.options?.key && action.options?.value) {\n const labelType = getLabelTypeFromFrame(action.options.key, action.frame, 0);\n const value = escapeLabelValueInSelector(action.options.value);\n expression = addLabelToQuery(expression, action.options.key, '=', value, labelType);\n }\n break;\n }\n case 'ADD_FILTER_OUT': {\n if (action.options?.key && action.options?.value) {\n const labelType = getLabelTypeFromFrame(action.options.key, action.frame, 0);\n const value = escapeLabelValueInSelector(action.options.value);\n expression = addLabelToQuery(expression, action.options.key, '!=', value, labelType);\n }\n break;\n }\n case 'ADD_LOGFMT_PARSER': {\n expression = addParserToQuery(expression, 'logfmt');\n break;\n }\n case 'ADD_JSON_PARSER': {\n expression = addParserToQuery(expression, 'json');\n break;\n }\n case 'ADD_UNPACK_PARSER': {\n expression = addParserToQuery(expression, 'unpack');\n break;\n }\n case 'ADD_NO_PIPELINE_ERROR': {\n expression = addNoPipelineErrorToQuery(expression);\n break;\n }\n case 'ADD_LEVEL_LABEL_FORMAT': {\n if (action.options?.originalLabel && action.options?.renameTo) {\n expression = addLabelFormatToQuery(expression, {\n renameTo: action.options.renameTo,\n originalLabel: action.options.originalLabel,\n });\n }\n break;\n }\n case 'ADD_LABEL_FILTER': {\n const parserPositions = getParserPositions(query.expr);\n const labelFilterPositions = getLabelFilterPositions(query.expr);\n const lastPosition = findLastPosition([...parserPositions, ...labelFilterPositions]);\n const filter = toLabelFilter('', '', '=');\n expression = addFilterAsLabelFilter(expression, [lastPosition], filter);\n break;\n }\n case 'ADD_STRING_FILTER':\n case 'ADD_LINE_FILTER': {\n expression = addLineFilter(expression, action.options?.value);\n break;\n }\n case 'ADD_STRING_FILTER_OUT':\n case 'ADD_LINE_FILTER_OUT': {\n expression = addLineFilter(expression, action.options?.value, '!=');\n break;\n }\n default:\n break;\n }\n return { ...query, expr: expression };\n }\n\n /**\n * Implemented as part of `DataSourceWithQueryModificationSupport`. Returns a list of operation\n * types that are supported by `modifyQuery()`.\n */\n getSupportedQueryModifications() {\n return [\n 'ADD_FILTER',\n 'ADD_FILTER_OUT',\n 'ADD_LOGFMT_PARSER',\n 'ADD_JSON_PARSER',\n 'ADD_UNPACK_PARSER',\n 'ADD_NO_PIPELINE_ERROR',\n 'ADD_LEVEL_LABEL_FORMAT',\n 'ADD_LABEL_FILTER',\n 'ADD_STRING_FILTER',\n 'ADD_STRING_FILTER_OUT',\n ];\n }\n\n /**\n * Part of `DataSourceWithLogsContextSupport`, used to retrieve log context for a log row.\n * @returns A promise that resolves to an object containing the log context data as DataFrames.\n */\n getLogRowContext = async (\n row: LogRowModel,\n options?: LogRowContextOptions,\n origQuery?: DataQuery\n ): Promise<{ data: DataFrame[] }> => {\n return await this.logContextProvider.getLogRowContext(row, options, getLokiQueryFromDataQuery(origQuery));\n };\n /**\n * Part of `DataSourceWithLogsContextSupport`, used to retrieve the log context query for the provided log row and original query.\n * @returns A promise that resolves to a DataQuery representing the log context query.\n */\n getLogRowContextQuery = async (\n row: LogRowModel,\n options?: LogRowContextOptions,\n origQuery?: DataQuery,\n cacheFilters?: boolean\n ): Promise<DataQuery> => {\n return await this.logContextProvider.getLogRowContextQuery(\n row,\n options,\n getLokiQueryFromDataQuery(origQuery),\n cacheFilters\n );\n };\n\n /**\n * Part of `DataSourceWithLogsContextSupport`, used to retrieve the log context UI for the provided log row and original query.\n * @returns A React component or element representing the log context UI for the log row.\n */\n getLogRowContextUi(row: LogRowModel, runContextQuery: () => void, origQuery: DataQuery): React.ReactNode {\n return this.logContextProvider.getLogRowContextUi(row, runContextQuery, getLokiQueryFromDataQuery(origQuery));\n }\n\n /**\n * Implemented as part of the DataSourceAPI. It allows the datasource to serve as a source of annotations for a dashboard.\n * @returns A promise that resolves to an array of AnnotationEvent objects representing the annotations for the dashboard.\n * @todo This is deprecated and it is recommended to use the `AnnotationSupport` feature for annotations.\n */\n async annotationQuery(options: any): Promise<AnnotationEvent[]> {\n const { expr, maxLines, instant, tagKeys = '', titleFormat = '', textFormat = '' } = options.annotation;\n\n if (!expr) {\n return [];\n }\n\n const id = `${REF_ID_STARTER_ANNOTATION}${options.annotation.name}`;\n\n const query: LokiQuery = {\n refId: id,\n expr,\n maxLines,\n instant,\n queryType: instant ? LokiQueryType.Instant : LokiQueryType.Range,\n };\n\n const request = makeRequest(query, options.range, CoreApp.Dashboard, id);\n\n const { data } = await lastValueFrom(this.query(request));\n\n const annotations: AnnotationEvent[] = [];\n const splitKeys: string[] = tagKeys.split(',').filter((v: string) => v !== '');\n\n for (const frame of data) {\n const view = new DataFrameView<{ Time: string; Line: string; labels: Labels }>(frame);\n\n view.forEach((row) => {\n const { labels } = row;\n\n const maybeDuplicatedTags = Object.entries(labels)\n .map(([key, val]) => [key, val.trim()]) // trim all label-values\n .filter(([key, val]) => {\n if (val === '') {\n // remove empty\n return false;\n }\n\n // if tags are specified, remove label if does not match tags\n if (splitKeys.length && !splitKeys.includes(key)) {\n return false;\n }\n\n return true;\n })\n .map(([key, val]) => val); // keep only the label-value\n\n // remove duplicates\n const tags = Array.from(new Set(maybeDuplicatedTags));\n\n annotations.push({\n time: new Date(row.Time).valueOf(),\n title: renderLegendFormat(titleFormat, labels),\n text: renderLegendFormat(textFormat, labels) || row.Line,\n tags,\n });\n });\n }\n\n return annotations;\n }\n\n /**\n * Adds ad hoc filters to a query expression, handling proper escaping of filter values.\n * @returns The query expression with ad hoc filters and correctly escaped values.\n * @todo this.templateSrv.getAdhocFilters() is deprecated\n */\n addAdHocFilters(queryExpr: string, adhocFilters?: AdHocVariableFilter[]) {\n if (!adhocFilters) {\n return queryExpr;\n }\n\n let expr = replaceVariables(queryExpr);\n\n expr = adhocFilters.reduce((acc: string, filter: { key: string; operator: string; value: string }) => {\n const { key, operator } = filter;\n let { value } = filter;\n if (isRegexSelector(operator)) {\n // Adhoc filters don't support multiselect, therefore if user selects regex operator\n // we are going to consider value to be regex filter and use lokiRegularEscape\n // that does not escape regex special characters (e.g. .*test.* => .*test.*)\n value = lokiRegularEscape(value);\n } else {\n // Otherwise, we want to escape special characters in value\n value = escapeLabelValueInSelector(value, operator);\n }\n return addLabelToQuery(acc, key, operator, value);\n }, expr);\n\n return returnVariables(expr);\n }\n\n /**\n * Filters out queries that are empty or hidden. Used when running queries through backend.\n * It is called from DatasourceWithBackend.\n * @returns `true` if the query is not hidden and its expression is not empty; `false` otherwise.\n */\n filterQuery(query: LokiQuery): boolean {\n if (query.hide || query.expr === '') {\n return false;\n }\n return true;\n }\n\n /**\n * Applies template variables and add hoc filters to a query. Used when running queries through backend.\n * It is called from DatasourceWithBackend.\n * @returns A modified Loki query with template variables and ad hoc filters applied.\n */\n applyTemplateVariables(target: LokiQuery, scopedVars: ScopedVars, adhocFilters?: AdHocVariableFilter[]): LokiQuery {\n // We want to interpolate these variables on backend because we support using them in\n // alerting/ML queries and we want to have consistent interpolation for all queries\n const { __auto, __interval, __interval_ms, __range, __range_s, __range_ms, ...rest } = scopedVars || {};\n\n const exprWithAdHoc = this.addAdHocFilters(target.expr, adhocFilters);\n\n const variables = {\n ...rest,\n\n // pass through for backend interpolation. Need to be in scopedVars for Scenes though\n __interval: {\n value: '$__interval',\n },\n __interval_ms: {\n value: '$__interval_ms',\n },\n };\n return {\n ...target,\n legendFormat: this.templateSrv.replace(target.legendFormat, rest),\n expr: this.templateSrv.replace(exprWithAdHoc, variables, this.interpolateQueryExpr),\n };\n }\n\n /**\n * Interpolates template variables in a given string. Template variables are passed trough scopedVars.\n * @returns The string with template variables replaced by their values.\n */\n interpolateString(string: string, scopedVars?: ScopedVars) {\n return this.templateSrv.replace(string, scopedVars, this.interpolateQueryExpr);\n }\n\n /**\n * Retrieves and returns a list of variable names used in the template service.\n * Used for example in the Query Builder to populate the variable dropdown with template variables.\n * @returns An array of variable names, each prefixed with '$'.\n */\n getVariables(): string[] {\n return this.templateSrv.getVariables().map((v) => `$${v.name}`);\n }\n /**\n * Retrieves query hints for query improvements based on a Loki query and its result data.\n * Used in Query builder to provide hints for query improvements, such as adding a parser, etc.\n * @returns An array of query hints for potential query improvements.\n */\n getQueryHints(query: LokiQuery, result: DataFrame[]): QueryHint[] {\n return getQueryHints(query.expr, result);\n }\n\n /**\n * Get a default LokiQuery based on the specified app. Currently used in UnifiedAlerting.\n * @returns A default LokiQuery object with appropriate settings for the given application.\n */\n getDefaultQuery(app: CoreApp): LokiQuery {\n const defaults = { refId: 'A', expr: '' };\n\n if (app === CoreApp.UnifiedAlerting) {\n return {\n ...defaults,\n queryType: LokiQueryType.Instant,\n };\n }\n\n return {\n ...defaults,\n queryType: LokiQueryType.Range,\n };\n }\n}\n\n// NOTE: these two functions are very similar to the escapeLabelValueIn* functions\n// in language_utils.ts, but they are not exactly the same algorithm, and we found\n// no way to reuse one in the another or vice versa.\nexport function lokiRegularEscape(value: any) {\n if (typeof value === 'string') {\n return value.replace(/'/g, \"\\\\\\\\'\");\n }\n return value;\n}\n\nexport function lokiSpecialRegexEscape(value: any) {\n if (typeof value === 'string') {\n return lokiRegularEscape(value.replace(/\\\\/g, '\\\\\\\\\\\\\\\\').replace(/[$^*{}\\[\\]+?.()|]/g, '\\\\\\\\$&'));\n }\n return value;\n}\n","import { NodeType, SyntaxNode } from '@lezer/common';\nimport { sortBy } from 'lodash';\n\nimport { QueryBuilderLabelFilter } from '@grafana/experimental';\nimport {\n Identifier,\n LabelFilter,\n LabelParser,\n LineComment,\n LineFilters,\n LogExpr,\n LogRangeExpr,\n Matcher,\n parser,\n PipelineExpr,\n Selector,\n UnwrapExpr,\n String,\n PipelineStage,\n LogfmtParser,\n JsonExpressionParser,\n LogfmtExpressionParser,\n Expr,\n} from '@grafana/lezer-logql';\n\nimport { unescapeLabelValue } from './languageUtils';\nimport { getNodePositionsFromQuery } from './queryUtils';\nimport { lokiQueryModeller as modeller } from './querybuilder/LokiQueryModeller';\nimport { buildVisualQueryFromString, handleQuotes } from './querybuilder/parsing';\nimport { LabelType } from './types';\n\nexport class NodePosition {\n from: number;\n to: number;\n type?: NodeType;\n\n constructor(from: number, to: number, type?: NodeType) {\n this.from = from;\n this.to = to;\n this.type = type;\n }\n\n static fromNode(node: SyntaxNode): NodePosition {\n return new NodePosition(node.from, node.to, node.type);\n }\n\n contains(position: NodePosition): boolean {\n return this.from <= position.from && this.to >= position.to;\n }\n\n getExpression(query: string): string {\n return query.substring(this.from, this.to);\n }\n}\n\n/**\n * Checks for the presence of a given label=value filter in any Matcher expression in the query.\n */\nexport function queryHasFilter(query: string, key: string, operator: string, value: string): boolean {\n const matchers = getMatchersWithFilter(query, key, operator, value);\n return matchers.length > 0;\n}\n\n/**\n * Removes a label=value Matcher expression from the query.\n */\nexport function removeLabelFromQuery(query: string, key: string, operator: string, value: string): string {\n const matchers = getMatchersWithFilter(query, key, operator, value);\n for (const matcher of matchers) {\n query =\n matcher.parent?.type.id === LabelFilter ? removeLabelFilter(query, matcher) : removeSelector(query, matcher);\n }\n return query;\n}\n\nfunction removeLabelFilter(query: string, matcher: SyntaxNode): string {\n const pipelineStage = matcher.parent?.parent;\n if (!pipelineStage || pipelineStage.type.id !== PipelineStage) {\n return query;\n }\n return (query.substring(0, pipelineStage.from) + query.substring(pipelineStage.to)).trim();\n}\n\nfunction removeSelector(query: string, matcher: SyntaxNode): string {\n let selector: SyntaxNode | null = matcher;\n do {\n selector = selector.parent;\n } while (selector && selector.type.id !== Selector);\n const label = matcher.getChild(Identifier);\n if (!selector || !label) {\n return query;\n }\n const labelName = query.substring(label.from, label.to);\n\n const prefix = query.substring(0, selector.from);\n const suffix = query.substring(selector.to);\n\n const matchVisQuery = buildVisualQueryFromString(query.substring(selector.from, selector.to));\n matchVisQuery.query.labels = matchVisQuery.query.labels.filter((label) => label.label !== labelName);\n\n return prefix + modeller.renderQuery(matchVisQuery.query) + suffix;\n}\n\nfunction getMatchersWithFilter(query: string, label: string, operator: string, value: string): SyntaxNode[] {\n const tree = parser.parse(query);\n const matchers: SyntaxNode[] = [];\n tree.iterate({\n enter: ({ type, node }): void => {\n if (type.id === Matcher) {\n matchers.push(node);\n }\n },\n });\n return matchers.filter((matcher) => {\n const labelNode = matcher.getChild(Identifier);\n const opNode = labelNode?.nextSibling;\n const valueNode = matcher.getChild(String);\n if (!labelNode || !opNode || !valueNode) {\n return false;\n }\n const labelName = query.substring(labelNode.from, labelNode.to);\n if (labelName !== label) {\n return false;\n }\n const labelValue = query.substring(valueNode.from, valueNode.to);\n if (handleQuotes(labelValue) !== unescapeLabelValue(value)) {\n return false;\n }\n const labelOperator = query.substring(opNode.from, opNode.to);\n if (labelOperator !== operator) {\n return false;\n }\n return true;\n });\n}\n\n/**\n * Adds label filter to existing query. Useful for query modification for example for ad hoc filters.\n *\n * It uses LogQL parser to find instances of labels, alters them and then splices them back into the query.\n * In a case when we have parser, instead of adding new instance of label it adds label filter after the parser.\n *\n * This operates on substrings of the query with labels and operates just on those. This makes this\n * more robust and can alter even invalid queries, and preserves in general the query structure and whitespace.\n */\nexport function addLabelToQuery(\n query: string,\n key: string,\n operator: string,\n value: string,\n labelType?: LabelType | null\n): string {\n if (!key || !value) {\n throw new Error('Need label to add to query.');\n }\n\n const streamSelectorPositions = getStreamSelectorPositions(query);\n if (!streamSelectorPositions.length) {\n return query;\n }\n\n const parserPositions = getParserPositions(query);\n const labelFilterPositions = getLabelFilterPositions(query);\n const hasStreamSelectorMatchers = getMatcherInStreamPositions(query);\n const everyStreamSelectorHasMatcher = streamSelectorPositions.every((streamSelectorPosition) =>\n hasStreamSelectorMatchers.some(\n (matcherPosition) =>\n matcherPosition.from >= streamSelectorPosition.from && matcherPosition.to <= streamSelectorPosition.to\n )\n );\n\n const filter = toLabelFilter(key, value, operator);\n if (labelType === LabelType.Parsed || labelType === LabelType.StructuredMetadata) {\n const lastPositionsPerExpression = getLastPositionPerExpression(query, [\n ...streamSelectorPositions,\n ...labelFilterPositions,\n ...parserPositions,\n ]);\n\n return addFilterAsLabelFilter(query, lastPositionsPerExpression, filter);\n } else if (labelType === LabelType.Indexed) {\n return addFilterToStreamSelector(query, streamSelectorPositions, filter);\n } else {\n // labelType is not set, so we need to figure out where to add the label\n // if we don't have a parser, or have empty stream selectors, we will just add it to the stream selector\n if (parserPositions.length === 0 || everyStreamSelectorHasMatcher === false) {\n return addFilterToStreamSelector(query, streamSelectorPositions, filter);\n } else {\n // If `labelType` is not set, it indicates a potential metric query (`labelType` is present only in log queries that came from a Loki instance supporting the `categorize-labels` API). In case we are not adding the label to stream selectors we need to find the last position to add in each expression.\n // E.g. in `sum(rate({foo=\"bar\"} | logfmt [$__auto])) / sum(rate({foo=\"baz\"} | logfmt [$__auto]))` we need to add the label at two places.\n const lastPositionsPerExpression = getLastPositionPerExpression(query, [\n ...parserPositions,\n ...labelFilterPositions,\n ]);\n\n return addFilterAsLabelFilter(query, lastPositionsPerExpression, filter);\n }\n }\n}\n\nfunction getLastPositionPerExpression(query: string, positions: NodePosition[]): NodePosition[] {\n const subExpressions = findLeaves(getNodePositionsFromQuery(query, [Expr]));\n const subPositions = [...positions];\n\n // find last position for each subexpression\n const lastPositionsPerExpression = subExpressions.map((subExpression) => {\n return findLastPosition(\n subPositions.filter((p) => {\n return subExpression.contains(p);\n })\n );\n });\n return lastPositionsPerExpression;\n}\n\n/**\n * Adds parser to existing query. Useful for query modification for hints.\n * It uses LogQL parser to find instances of stream selectors or line filters and adds parser after them.\n *\n * @param query\n * @param parser\n */\nexport function addParserToQuery(query: string, parser: string): string {\n const lineFilterPositions = getLineFiltersPositions(query);\n\n if (lineFilterPositions.length) {\n return addParser(query, lineFilterPositions, parser);\n } else {\n const streamSelectorPositions = getStreamSelectorPositions(query);\n if (!streamSelectorPositions.length) {\n return query;\n }\n return addParser(query, streamSelectorPositions, parser);\n }\n}\n\n/**\n * Adds filtering for pipeline errors to existing query. Useful for query modification for hints.\n * It uses LogQL parser to find parsers and adds pipeline errors filtering after them.\n *\n * @param query\n */\nexport function addNoPipelineErrorToQuery(query: string): string {\n const parserPositions = getParserPositions(query);\n if (!parserPositions.length) {\n return query;\n }\n\n const filter = toLabelFilter('__error__', '', '=');\n return addFilterAsLabelFilter(query, parserPositions, filter);\n}\n\n/**\n * Adds label format to existing query. Useful for query modification for hints.\n * It uses LogQL parser to find log query and add label format at the end.\n *\n * @param query\n * @param labelFormat\n */\nexport function addLabelFormatToQuery(query: string, labelFormat: { originalLabel: string; renameTo: string }): string {\n const logQueryPositions = getLogQueryPositions(query);\n return addLabelFormat(query, logQueryPositions, labelFormat);\n}\n\n/**\n * Removes all comments from query.\n * It uses LogQL parser to find all LineComments and removes them.\n */\nexport function removeCommentsFromQuery(query: string): string {\n const lineCommentPositions = getLineCommentPositions(query);\n\n if (!lineCommentPositions.length) {\n return query;\n }\n\n let newQuery = '';\n let prev = 0;\n\n for (let lineCommentPosition of lineCommentPositions) {\n newQuery = newQuery + query.substring(prev, lineCommentPosition.from);\n prev = lineCommentPosition.to;\n }\n newQuery = newQuery + query.substring(prev);\n return newQuery;\n}\n\n/**\n * Parse the string and get all Selector positions in the query together with parsed representation of the\n * selector.\n * @param query\n */\nexport function getStreamSelectorPositions(query: string): NodePosition[] {\n const tree = parser.parse(query);\n const positions: NodePosition[] = [];\n tree.iterate({\n enter: ({ type, node }): false | void => {\n if (type.id === Selector) {\n positions.push(NodePosition.fromNode(node));\n return false;\n }\n },\n });\n return positions;\n}\n\n/**\n * Parse the string and get all LabelParser positions in the query.\n * @param query\n */\nexport function getParserPositions(query: string): NodePosition[] {\n const tree = parser.parse(query);\n const positions: NodePosition[] = [];\n const parserNodeTypes = [LabelParser, JsonExpressionParser, LogfmtParser, LogfmtExpressionParser];\n tree.iterate({\n enter: ({ type, node }): false | void => {\n if (parserNodeTypes.includes(type.id)) {\n positions.push(NodePosition.fromNode(node));\n return false;\n }\n },\n });\n return positions;\n}\n\n/**\n * Parse the string and get all LabelFilter positions in the query.\n * @param query\n */\nexport function getLabelFilterPositions(query: string): NodePosition[] {\n const tree = parser.parse(query);\n const positions: NodePosition[] = [];\n tree.iterate({\n enter: ({ type, node }): false | void => {\n if (type.id === LabelFilter) {\n positions.push(NodePosition.fromNode(node));\n return false;\n }\n },\n });\n return positions;\n}\n\n/**\n * Parse the string and get all Line filter positions in the query.\n * @param query\n */\nfunction getLineFiltersPositions(query: string): NodePosition[] {\n const tree = parser.parse(query);\n const positions: NodePosition[] = [];\n tree.iterate({\n enter: ({ type, node }): false | void => {\n if (type.id === LineFilters) {\n positions.push(NodePosition.fromNode(node));\n return false;\n }\n },\n });\n return positions;\n}\n\n/**\n * Parse the string and get all Log query positions in the query.\n * @param query\n */\nfunction getLogQueryPositions(query: string): NodePosition[] {\n const tree = parser.parse(query);\n const positions: NodePosition[] = [];\n tree.iterate({\n enter: ({ type, node }): false | void => {\n if (type.id === LogExpr) {\n positions.push(NodePosition.fromNode(node));\n return false;\n }\n\n // This is a case in metrics query\n if (type.id === LogRangeExpr) {\n // Unfortunately, LogRangeExpr includes both log and non-log (e.g. Duration/Range/...) parts of query.\n // We get position of all log-parts within LogRangeExpr: Selector, PipelineExpr and UnwrapExpr.\n const logPartsPositions: NodePosition[] = [];\n const selector = node.getChild(Selector);\n if (selector) {\n logPartsPositions.push(NodePosition.fromNode(selector));\n }\n\n const pipeline = node.getChild(PipelineExpr);\n if (pipeline) {\n logPartsPositions.push(NodePosition.fromNode(pipeline));\n }\n\n const unwrap = node.getChild(UnwrapExpr);\n if (unwrap) {\n logPartsPositions.push(NodePosition.fromNode(unwrap));\n }\n\n // We sort them and then pick \"from\" from first position and \"to\" from last position.\n const sorted = sortBy(logPartsPositions, (position) => position.to);\n positions.push(new NodePosition(sorted[0].from, sorted[sorted.length - 1].to));\n return false;\n }\n },\n });\n return positions;\n}\n\nexport function toLabelFilter(key: string, value: string, operator: string): QueryBuilderLabelFilter {\n // We need to make sure that we convert the value back to string because it may be a number\n return { label: key, op: operator, value };\n}\n\n/**\n * Add filter as to stream selectors\n * @param query\n * @param vectorSelectorPositions\n * @param filter\n */\nfunction addFilterToStreamSelector(\n query: string,\n vectorSelectorPositions: NodePosition[],\n filter: QueryBuilderLabelFilter\n): string {\n let newQuery = '';\n let prev = 0;\n\n for (let i = 0; i < vectorSelectorPositions.length; i++) {\n // This is basically just doing splice on a string for each matched vector selector.\n const match = vectorSelectorPositions[i];\n const isLast = i === vectorSelectorPositions.length - 1;\n\n const start = query.substring(prev, match.from);\n const end = isLast ? query.substring(match.to) : '';\n const matchVisQuery = buildVisualQueryFromString(query.substring(match.from, match.to));\n\n if (!labelExists(matchVisQuery.query.labels, filter)) {\n // We don't want to add duplicate labels.\n matchVisQuery.query.labels.push(filter);\n }\n const newLabels = modeller.renderQuery(matchVisQuery.query);\n newQuery += start + newLabels + end;\n prev = match.to;\n }\n return newQuery;\n}\n\n/**\n * Add filter as label filter after the parsers\n * @param query\n * @param positionsToAddAfter\n * @param filter\n */\nexport function addFilterAsLabelFilter(\n query: string,\n positionsToAddAfter: NodePosition[],\n filter: QueryBuilderLabelFilter\n): string {\n let newQuery = '';\n let prev = 0;\n\n for (let i = 0; i < positionsToAddAfter.length; i++) {\n // This is basically just doing splice on a string for each matched vector selector.\n const match = positionsToAddAfter[i];\n const isLast = i === positionsToAddAfter.length - 1;\n\n const start = query.substring(prev, match.to);\n const end = isLast ? query.substring(match.to) : '';\n\n let labelFilter = '';\n // For < and >, if the value is number, we don't add quotes around it and use it as number\n if (!Number.isNaN(Number(filter.value)) && (filter.op === '<' || filter.op === '>')) {\n labelFilter = ` | ${filter.label}${filter.op}${Number(filter.value)}`;\n } else {\n // we now unescape all escaped values again, because we are using backticks which can handle those cases.\n // we also don't care about the operator here, because we need to unescape for both, regex and equal.\n labelFilter = ` | ${filter.label}${filter.op}\\`${unescapeLabelValue(filter.value)}\\``;\n }\n\n newQuery += start + labelFilter + end;\n prev = match.to;\n }\n return newQuery;\n}\n\n/**\n * Add parser after line filter or stream selector\n * @param query\n * @param queryPartPositions\n * @param parser\n */\nfunction addParser(query: string, queryPartPositions: NodePosition[], parser: string): string {\n let newQuery = '';\n let prev = 0;\n\n for (let i = 0; i < queryPartPositions.length; i++) {\n // Splice on a string for each matched vector selector\n const match = queryPartPositions[i];\n const isLast = i === queryPartPositions.length - 1;\n\n const start = query.substring(prev, match.to);\n const end = isLast ? query.substring(match.to) : '';\n\n // Add parser\n newQuery += start + ` | ${parser}` + end;\n prev = match.to;\n }\n return newQuery;\n}\n\n/**\n * Add filter as label filter after the parsers\n * @param query\n * @param logQueryPositions\n * @param labelFormat\n */\nfunction addLabelFormat(\n query: string,\n logQueryPositions: NodePosition[],\n labelFormat: { originalLabel: string; renameTo: string }\n): string {\n let newQuery = '';\n let prev = 0;\n\n for (let i = 0; i < logQueryPositions.length; i++) {\n // This is basically just doing splice on a string for each matched vector selector.\n const match = logQueryPositions[i];\n const isLast = i === logQueryPositions.length - 1;\n\n const start = query.substring(prev, match.to);\n const end = isLast ? query.substring(match.to) : '';\n\n const labelFilter = ` | label_format ${labelFormat.renameTo}=${labelFormat.originalLabel}`;\n newQuery += start + labelFilter + end;\n prev = match.to;\n }\n return newQuery;\n}\n\nexport function addLineFilter(query: string, value = '', operator = '|='): string {\n const streamSelectorPositions = getStreamSelectorPositions(query);\n if (!streamSelectorPositions.length) {\n return query;\n }\n const streamSelectorEnd = streamSelectorPositions[0].to;\n\n const newQueryExpr = query.slice(0, streamSelectorEnd) + ` ${operator} \\`${value}\\`` + query.slice(streamSelectorEnd);\n return newQueryExpr;\n}\n\nfunction getLineCommentPositions(query: string): NodePosition[] {\n const tree = parser.parse(query);\n const positions: NodePosition[] = [];\n tree.iterate({\n enter: ({ type, from, to }): false | void => {\n if (type.id === LineComment) {\n positions.push(new NodePosition(from, to, type));\n return false;\n }\n },\n });\n return positions;\n}\n\n/**\n * Check if label exists in the list of labels but ignore the operator.\n * @param labels\n * @param filter\n */\nfunction labelExists(labels: QueryBuilderLabelFilter[], filter: QueryBuilderLabelFilter) {\n return labels.find((label) => label.label === filter.label && label.value === filter.value);\n}\n\n/**\n * Return the last position based on \"to\" property\n * @param positions\n */\nexport function findLastPosition(positions: NodePosition[]): NodePosition {\n if (!positions.length) {\n return new NodePosition(0, 0);\n }\n return positions.reduce((prev, current) => (prev.to > current.to ? prev : current));\n}\n\n/**\n * Gets all leaves of the nodes given. Leaves are nodes that don't contain any other nodes.\n *\n * @param {NodePosition[]} nodes\n * @return\n */\nfunction findLeaves(nodes: NodePosition[]): NodePosition[] {\n return nodes.filter((node) => nodes.every((n) => node.contains(n) === false || node === n));\n}\n\nfunction getAllPositionsInNodeByType(node: SyntaxNode, type: number): NodePosition[] {\n if (node.type.id === type) {\n return [NodePosition.fromNode(node)];\n }\n\n const positions: NodePosition[] = [];\n let pos = 0;\n let child = node.childAfter(pos);\n while (child) {\n positions.push(...getAllPositionsInNodeByType(child, type));\n pos = child.to;\n child = node.childAfter(pos);\n }\n return positions;\n}\n\nfunction getMatcherInStreamPositions(query: string): NodePosition[] {\n const tree = parser.parse(query);\n const positions: NodePosition[] = [];\n tree.iterate({\n enter: ({ node }): false | void => {\n if (node.type.id === Selector) {\n positions.push(...getAllPositionsInNodeByType(node, Matcher));\n }\n },\n });\n return positions;\n}\n","import { SyntaxNode } from '@lezer/common';\nimport { escapeRegExp } from 'lodash';\n\nimport {\n parser,\n LineFilter,\n PipeExact,\n PipeMatch,\n Filter,\n String,\n LabelFormatExpr,\n Selector,\n PipelineExpr,\n LabelParser,\n JsonExpressionParser,\n LabelFilter,\n MetricExpr,\n Matcher,\n Identifier,\n Range,\n formatLokiQuery,\n Logfmt,\n Json,\n OrFilter,\n FilterOp,\n} from '@grafana/lezer-logql';\nimport { reportInteraction } from '@grafana/runtime';\nimport { DataQuery } from '@grafana/schema';\n\nimport { placeHolderScopedVars } from './components/monaco-query-field/monaco-completion-provider/validation';\nimport { LokiDatasource } from './datasource';\nimport { getStreamSelectorPositions, NodePosition } from './modifyQuery';\nimport { ErrorId, replaceVariables, returnVariables } from './querybuilder/parsingUtils';\nimport { LokiQuery, LokiQueryType } from './types';\n\n/**\n * Returns search terms from a LogQL query.\n * E.g., `{} |= foo |=bar != baz` returns `['foo', 'bar']`.\n */\nexport function getHighlighterExpressionsFromQuery(input = ''): string[] {\n const results = [];\n\n const filters = getNodesFromQuery(input, [LineFilter]);\n\n for (const filter of filters) {\n const pipeExact = filter.getChild(Filter)?.getChild(PipeExact);\n const pipeMatch = filter.getChild(Filter)?.getChild(PipeMatch);\n const strings = getStringsFromLineFilter(filter);\n\n if ((!pipeExact && !pipeMatch) || !strings.length) {\n continue;\n }\n\n for (const string of strings) {\n const filterTerm = input.substring(string.from, string.to).trim();\n const backtickedTerm = filterTerm[0] === '`';\n const unwrappedFilterTerm = filterTerm.substring(1, filterTerm.length - 1);\n\n if (!unwrappedFilterTerm) {\n continue;\n }\n\n let resultTerm = '';\n\n // Only filter expressions with |~ operator are treated as regular expressions\n if (pipeMatch) {\n // When using backticks, Loki doesn't require to escape special characters and we can just push regular expression to highlights array\n // When using quotes, we have extra backslash escaping and we need to replace \\\\ with \\\n resultTerm = backtickedTerm ? unwrappedFilterTerm : unwrappedFilterTerm.replace(/\\\\\\\\/g, '\\\\');\n } else {\n // We need to escape this string so it is not matched as regular expression\n resultTerm = escapeRegExp(unwrappedFilterTerm);\n }\n\n if (resultTerm) {\n results.push(resultTerm);\n }\n }\n }\n return results;\n}\n\nexport function getStringsFromLineFilter(filter: SyntaxNode): SyntaxNode[] {\n const nodes: SyntaxNode[] = [];\n let node: SyntaxNode | null = filter;\n do {\n const string = node.getChild(String);\n if (string && !node.getChild(FilterOp)) {\n nodes.push(string);\n }\n node = node.getChild(OrFilter);\n } while (node != null);\n\n return nodes;\n}\n\nexport function getNormalizedLokiQuery(query: LokiQuery): LokiQuery {\n const queryType = getLokiQueryType(query);\n // instant and range are deprecated, we want to remove them\n const { instant, range, ...rest } = query;\n return { ...rest, queryType };\n}\n\nexport function getLokiQueryType(query: LokiQuery): LokiQueryType {\n // we are migrating from `.instant` and `.range` to `.queryType`\n // this function returns the correct query type\n const { queryType } = query;\n const hasValidQueryType =\n queryType === LokiQueryType.Range || queryType === LokiQueryType.Instant || queryType === LokiQueryType.Stream;\n\n // if queryType exists, it is respected\n if (hasValidQueryType) {\n return queryType;\n }\n\n // if no queryType, and instant===true, it's instant\n if (query.instant === true) {\n return LokiQueryType.Instant;\n }\n\n // otherwise it is range\n return LokiQueryType.Range;\n}\n\nconst tagsToObscure = ['String', 'Identifier', 'LineComment', 'Number'];\nconst partsToKeep = ['__error__', '__interval', '__interval_ms', '__auto'];\nexport function obfuscate(query: string): string {\n let obfuscatedQuery: string = query;\n const tree = parser.parse(query);\n tree.iterate({\n enter: ({ name, from, to }): false | void => {\n const queryPart = query.substring(from, to);\n if (tagsToObscure.includes(name) && !partsToKeep.includes(queryPart)) {\n obfuscatedQuery = obfuscatedQuery.replace(queryPart, name);\n }\n },\n });\n return obfuscatedQuery;\n}\n\nexport function parseToNodeNamesArray(query: string): string[] {\n const queryParts: string[] = [];\n const tree = parser.parse(query);\n tree.iterate({\n enter: ({ name }): false | void => {\n queryParts.push(name);\n },\n });\n return queryParts;\n}\n\nexport function isQueryWithNode(query: string, nodeType: number): boolean {\n let isQueryWithNode = false;\n const tree = parser.parse(query);\n tree.iterate({\n enter: ({ type }): false | void => {\n if (type.id === nodeType) {\n isQueryWithNode = true;\n return false;\n }\n },\n });\n return isQueryWithNode;\n}\n\nexport function getNodesFromQuery(query: string, nodeTypes?: number[]): SyntaxNode[] {\n const nodes: SyntaxNode[] = [];\n const tree = parser.parse(query);\n tree.iterate({\n enter: (node): false | void => {\n if (nodeTypes === undefined || nodeTypes.includes(node.type.id)) {\n nodes.push(node.node);\n }\n },\n });\n return nodes;\n}\n\nexport function getNodePositionsFromQuery(query: string, nodeTypes?: number[]): NodePosition[] {\n const positions: NodePosition[] = [];\n const tree = parser.parse(query);\n tree.iterate({\n enter: (node): false | void => {\n if (nodeTypes === undefined || nodeTypes.includes(node.type.id)) {\n positions.push(NodePosition.fromNode(node.node));\n }\n },\n });\n return positions;\n}\n\nexport function getNodeFromQuery(query: string, nodeType: number): SyntaxNode | undefined {\n const nodes = getNodesFromQuery(query, [nodeType]);\n return nodes.length > 0 ? nodes[0] : undefined;\n}\n\n/**\n * Parses the query and looks for error nodes. If there is at least one, it returns true.\n * Grafana variables are considered errors, so if you need to validate a query\n * with variables you should interpolate it first.\n */\nexport function isQueryWithError(query: string): boolean {\n return isQueryWithNode(query, ErrorId);\n}\n\nexport function isLogsQuery(query: string): boolean {\n return !isQueryWithNode(query, MetricExpr);\n}\n\nexport function isQueryWithParser(query: string): { queryWithParser: boolean; parserCount: number } {\n const nodes = getNodesFromQuery(query, [LabelParser, JsonExpressionParser, Logfmt]);\n const parserCount = nodes.length;\n return { queryWithParser: parserCount > 0, parserCount };\n}\n\nexport function getParserFromQuery(query: string): string | undefined {\n const parsers = getNodesFromQuery(query, [LabelParser, Json, Logfmt]);\n return parsers.length > 0 ? query.substring(parsers[0].from, parsers[0].to).trim() : undefined;\n}\n\nexport function isQueryPipelineErrorFiltering(query: string): boolean {\n const labels = getNodesFromQuery(query, [LabelFilter]);\n for (const node of labels) {\n const label = node.getChild(Matcher)?.getChild(Identifier);\n if (label) {\n const labelName = query.substring(label.from, label.to);\n if (labelName === '__error__') {\n return true;\n }\n }\n }\n return false;\n}\n\nexport function isQueryWithLabelFormat(query: string): boolean {\n return isQueryWithNode(query, LabelFormatExpr);\n}\n\nexport function getLogQueryFromMetricsQuery(query: string): string {\n if (isLogsQuery(query)) {\n return query;\n }\n\n // Log query in metrics query composes of Selector & PipelineExpr\n const selectorNode = getNodeFromQuery(query, Selector);\n if (!selectorNode) {\n return '';\n }\n const selector = query.substring(selectorNode.from, selectorNode.to);\n\n const pipelineExprNode = getNodeFromQuery(query, PipelineExpr);\n const pipelineExpr = pipelineExprNode ? query.substring(pipelineExprNode.from, pipelineExprNode.to) : '';\n\n return `${selector} ${pipelineExpr}`.trim();\n}\n\nexport function getLogQueryFromMetricsQueryAtPosition(query: string, position: number): string {\n if (isLogsQuery(query)) {\n return query;\n }\n\n const metricQuery = getNodesFromQuery(query, [MetricExpr])\n .reverse() // So we don't get the root metric node\n .find((node) => node.from <= position && node.to >= position);\n if (!metricQuery) {\n return '';\n }\n return getLogQueryFromMetricsQuery(query.substring(metricQuery.from, metricQuery.to));\n}\n\nexport function isQueryWithLabelFilter(query: string): boolean {\n return isQueryWithNode(query, LabelFilter);\n}\n\nexport function isQueryWithLineFilter(query: string): boolean {\n return isQueryWithNode(query, LineFilter);\n}\n\nexport function isQueryWithRangeVariable(query: string): boolean {\n const rangeNodes = getNodesFromQuery(query, [Range]);\n for (const node of rangeNodes) {\n if (query.substring(node.from, node.to).match(/\\[\\$__range(_s|_ms)?/)) {\n return true;\n }\n }\n return false;\n}\n\nexport function getStreamSelectorsFromQuery(query: string): string[] {\n const labelMatcherPositions = getStreamSelectorPositions(query);\n\n const labelMatchers = labelMatcherPositions.map((labelMatcher) => {\n return query.slice(labelMatcher.from, labelMatcher.to);\n });\n\n return labelMatchers;\n}\n\nexport function requestSupportsSplitting(allQueries: LokiQuery[]) {\n const queries = allQueries\n .filter((query) => !query.hide)\n .filter((query) => !query.refId.includes('do-not-chunk'))\n .filter((query) => query.expr);\n\n return queries.length > 0;\n}\n\nexport const isLokiQuery = (query: DataQuery): query is LokiQuery => {\n if (!query) {\n return false;\n }\n\n const lokiQuery = query as LokiQuery;\n return lokiQuery.expr !== undefined;\n};\n\nexport const getLokiQueryFromDataQuery = (query?: DataQuery): LokiQuery | undefined => {\n if (!query || !isLokiQuery(query)) {\n return undefined;\n }\n\n return query;\n};\n\nexport function formatLogqlQuery(query: string, datasource: LokiDatasource) {\n const isInvalid = isQueryWithError(datasource.interpolateString(query, placeHolderScopedVars));\n\n reportInteraction('grafana_loki_format_query_clicked', {\n is_invalid: isInvalid,\n query_type: isLogsQuery(query) ? 'logs' : 'metric',\n });\n\n if (isInvalid) {\n return query;\n }\n\n let transformedQuery = replaceVariables(query);\n const transformationMatches = [];\n const tree = parser.parse(transformedQuery);\n\n // Variables are considered errors inside of the parser, so we need to remove them before formatting\n // We replace all variables with [0s] and keep track of the replaced variables\n // After formatting we replace [0s] with the original variable\n if (tree.topNode.firstChild?.firstChild?.type.id === MetricExpr) {\n const pattern = /\\[__V_[0-2]__\\w+__V__\\]/g;\n transformationMatches.push(...transformedQuery.matchAll(pattern));\n transformedQuery = transformedQuery.replace(pattern, '[0s]');\n }\n\n let formatted = formatLokiQuery(transformedQuery);\n\n if (tree.topNode.firstChild?.firstChild?.type.id === MetricExpr) {\n transformationMatches.forEach((match) => {\n formatted = formatted.replace('[0s]', match[0]);\n });\n }\n\n return returnVariables(formatted);\n}\n","import { Registry } from '@grafana/data';\nimport { BINARY_OPERATIONS_KEY } from './types.js';\n\nclass QueryModellerBase {\n constructor(operationDefinitions, innerQueryPlaceholder) {\n this.categories = [];\n this.operationsRegistry = new Registry(() => operationDefinitions);\n this.innerQueryPlaceholder = innerQueryPlaceholder || \"<query>\";\n }\n setOperationCategories(categories) {\n this.categories = categories;\n }\n getOperationsForCategory(category) {\n return this.operationsRegistry.list().filter((op) => op.category === category && !op.hideFromList);\n }\n getAlternativeOperations(key) {\n return this.operationsRegistry.list().filter((op) => op.alternativesKey && op.alternativesKey === key);\n }\n getCategories() {\n return this.categories;\n }\n getOperationDefinition(id) {\n return this.operationsRegistry.getIfExists(id);\n }\n hasBinaryOp(query) {\n return query.operations.find((op) => {\n const def = this.getOperationDefinition(op.id);\n return (def == null ? void 0 : def.category) === BINARY_OPERATIONS_KEY;\n }) !== void 0;\n }\n}\n\nexport { QueryModellerBase };\n//# sourceMappingURL=QueryModellerBase.js.map\n","import {\n QueryModellerBase,\n QueryBuilderLabelFilter,\n VisualQuery,\n QueryBuilderOperation,\n VisualQueryBinary,\n} from '@grafana/experimental';\n\nimport { operationDefinitions } from './operations';\nimport { LokiOperationId, LokiQueryPattern, LokiQueryPatternType, LokiVisualQueryOperationCategory } from './types';\n\nexport class LokiQueryModeller extends QueryModellerBase {\n constructor() {\n super(operationDefinitions, '<expr>');\n\n this.setOperationCategories([\n LokiVisualQueryOperationCategory.Aggregations,\n LokiVisualQueryOperationCategory.RangeFunctions,\n LokiVisualQueryOperationCategory.Formats,\n LokiVisualQueryOperationCategory.BinaryOps,\n LokiVisualQueryOperationCategory.LabelFilters,\n LokiVisualQueryOperationCategory.LineFilters,\n ]);\n }\n\n renderOperations(queryString: string, operations: QueryBuilderOperation[]): string {\n for (const operation of operations) {\n const def = this.operationsRegistry.getIfExists(operation.id);\n if (!def) {\n console.error(`Could not find operation ${operation.id} in the registry`);\n continue;\n }\n queryString = def.renderer(operation, def, queryString);\n }\n return queryString;\n }\n\n renderBinaryQueries(queryString: string, binaryQueries?: Array<VisualQueryBinary<VisualQuery>>) {\n if (binaryQueries) {\n for (const binQuery of binaryQueries) {\n queryString = `${this.renderBinaryQuery(queryString, binQuery)}`;\n }\n }\n return queryString;\n }\n\n private renderBinaryQuery(leftOperand: string, binaryQuery: VisualQueryBinary<VisualQuery>) {\n let result = leftOperand + ` ${binaryQuery.operator} `;\n\n if (binaryQuery.vectorMatches) {\n result += `${binaryQuery.vectorMatchesType}(${binaryQuery.vectorMatches}) `;\n }\n\n return result + this.renderQuery(binaryQuery.query, true);\n }\n\n renderLabels(labels: QueryBuilderLabelFilter[]): string {\n if (labels.length === 0) {\n return '{}';\n }\n\n let expr = '{';\n for (const filter of labels) {\n if (expr !== '{') {\n expr += ', ';\n }\n\n expr += `${filter.label}${filter.op}\"${filter.value}\"`;\n }\n\n return expr + `}`;\n }\n\n renderQuery(query: VisualQuery, nested?: boolean): string {\n let queryString = this.renderLabels(query.labels);\n queryString = this.renderOperations(queryString, query.operations);\n\n if (!nested && this.hasBinaryOp(query) && Boolean(query.binaryQueries?.length)) {\n queryString = `(${queryString})`;\n }\n\n queryString = this.renderBinaryQueries(queryString, query.binaryQueries);\n\n return queryString;\n }\n\n getQueryPatterns(): LokiQueryPattern[] {\n return [\n {\n name: 'Parse log lines with logfmt parser',\n type: LokiQueryPatternType.Log,\n // {} | logfmt | __error__=``\n operations: [\n { id: LokiOperationId.Logfmt, params: [] },\n { id: LokiOperationId.LabelFilterNoErrors, params: [] },\n ],\n },\n {\n name: 'Parse log lines with JSON parser',\n type: LokiQueryPatternType.Log,\n // {} | json | __error__=``\n operations: [\n { id: LokiOperationId.Json, params: [] },\n { id: LokiOperationId.LabelFilterNoErrors, params: [] },\n ],\n },\n {\n name: 'Filter log line and parse with logfmt parser',\n type: LokiQueryPatternType.Log,\n // {} |= `` | logfmt | __error__=``\n operations: [\n { id: LokiOperationId.LineContains, params: [''] },\n { id: LokiOperationId.Logfmt, params: [] },\n { id: LokiOperationId.LabelFilterNoErrors, params: [] },\n ],\n },\n {\n name: 'Filter log lines and parse with json parser',\n type: LokiQueryPatternType.Log,\n // {} |= `` | json | __error__=``\n operations: [\n { id: LokiOperationId.LineContains, params: [''] },\n { id: LokiOperationId.Json, params: [] },\n { id: LokiOperationId.LabelFilterNoErrors, params: [] },\n ],\n },\n {\n name: 'Parse log line with logfmt parser and use label filter',\n type: LokiQueryPatternType.Log,\n // {} |= `` | logfmt | __error__=`` | label=`value`\n operations: [\n { id: LokiOperationId.LineContains, params: [''] },\n { id: LokiOperationId.Logfmt, params: [] },\n { id: LokiOperationId.LabelFilterNoErrors, params: [] },\n { id: LokiOperationId.LabelFilter, params: ['label', '=', 'value'] },\n ],\n },\n {\n name: 'Parse log lines with nested json',\n type: LokiQueryPatternType.Log,\n // {} |= `` | json | line_format `{{ .message}}` | json\n operations: [\n { id: LokiOperationId.LineContains, params: [''] },\n { id: LokiOperationId.Json, params: [] },\n { id: LokiOperationId.LabelFilterNoErrors, params: [] },\n { id: LokiOperationId.LineFormat, params: ['{{.message}}'] },\n { id: LokiOperationId.Json, params: [] },\n { id: LokiOperationId.LabelFilterNoErrors, params: [] },\n ],\n },\n {\n name: 'Reformat log lines',\n type: LokiQueryPatternType.Log,\n // {} |= `` | logfmt | line_format `{{.message}}`\n operations: [\n { id: LokiOperationId.LineContains, params: [''] },\n { id: LokiOperationId.Logfmt, params: [] },\n { id: LokiOperationId.LabelFilterNoErrors, params: [] },\n { id: LokiOperationId.LineFormat, params: ['{{.message}}'] },\n ],\n },\n {\n name: 'Rename lvl label to level',\n type: LokiQueryPatternType.Log,\n // {} |= `` | logfmt | label_format level=lvl\n operations: [\n { id: LokiOperationId.LineContains, params: [''] },\n { id: LokiOperationId.Logfmt, params: [] },\n { id: LokiOperationId.LabelFilterNoErrors, params: [] },\n { id: LokiOperationId.LabelFormat, params: ['lvl', 'level'] },\n ],\n },\n {\n name: 'Query on value inside a log line',\n type: LokiQueryPatternType.Metric,\n // sum(sum_over_time({ | logfmt | __error__=`` | unwrap | __error__=`` [$__auto]))\n operations: [\n { id: LokiOperationId.LineContains, params: [''] },\n { id: LokiOperationId.Logfmt, params: [] },\n { id: LokiOperationId.LabelFilterNoErrors, params: [] },\n { id: LokiOperationId.Unwrap, params: [''] },\n { id: LokiOperationId.LabelFilterNoErrors, params: [] },\n { id: LokiOperationId.SumOverTime, params: ['$__auto'] },\n { id: LokiOperationId.Sum, params: [] },\n ],\n },\n {\n name: 'Total requests per label of streams',\n type: LokiQueryPatternType.Metric,\n // sum by() (count_over_time({}[$__auto)\n operations: [\n { id: LokiOperationId.LineContains, params: [''] },\n { id: LokiOperationId.CountOverTime, params: ['$__auto'] },\n { id: LokiOperationId.Sum, params: [] },\n ],\n },\n {\n name: 'Total requests per parsed label or label of streams',\n type: LokiQueryPatternType.Metric,\n // sum by() (count_over_time({}| logfmt | __error__=`` [$__auto))\n operations: [\n { id: LokiOperationId.LineContains, params: [''] },\n { id: LokiOperationId.Logfmt, params: [] },\n { id: LokiOperationId.LabelFilterNoErrors, params: [] },\n { id: LokiOperationId.CountOverTime, params: ['$__auto'] },\n { id: LokiOperationId.Sum, params: [] },\n ],\n },\n {\n name: 'Bytes used by a log stream',\n type: LokiQueryPatternType.Metric,\n // bytes_over_time({}[$__auto])\n operations: [\n { id: LokiOperationId.LineContains, params: [''] },\n { id: LokiOperationId.BytesOverTime, params: ['$__auto'] },\n ],\n },\n {\n name: 'Count of log lines per stream',\n type: LokiQueryPatternType.Metric,\n // count_over_time({}[$__auto])\n operations: [\n { id: LokiOperationId.LineContains, params: [''] },\n { id: LokiOperationId.CountOverTime, params: ['$__auto'] },\n ],\n },\n {\n name: 'Top N results by label or parsed label',\n type: LokiQueryPatternType.Metric,\n // topk(10, sum by () (count_over_time({} | logfmt | __error__=`` [$__auto])))\n operations: [\n { id: LokiOperationId.Logfmt, params: [] },\n { id: LokiOperationId.LabelFilterNoErrors, params: [] },\n { id: LokiOperationId.CountOverTime, params: ['$__auto'] },\n { id: LokiOperationId.Sum, params: [] },\n { id: LokiOperationId.TopK, params: [10] },\n ],\n },\n {\n name: 'Extracted quantile',\n type: LokiQueryPatternType.Metric,\n // quantile_over_time(0.5,{} | logfmt | unwrap latency[$__auto]) by ()\n operations: [\n { id: LokiOperationId.Logfmt, params: [] },\n { id: LokiOperationId.LabelFilterNoErrors, params: [] },\n { id: LokiOperationId.Unwrap, params: ['latency'] },\n { id: LokiOperationId.LabelFilterNoErrors, params: [] },\n { id: LokiOperationId.QuantileOverTime, params: ['$__auto', 0.5] },\n { id: LokiOperationId.Sum, params: [] },\n ],\n },\n ];\n }\n}\n\nexport const lokiQueryModeller = new LokiQueryModeller();\n","import {\n QueryBuilderOperation,\n QueryBuilderOperationDefinition,\n QueryBuilderOperationParamDef,\n} from '@grafana/experimental';\n\nimport { defaultAddOperationHandler } from './operationUtils';\nimport { LokiOperationId, LokiVisualQueryOperationCategory } from './types';\n\nexport const binaryScalarDefs = [\n {\n id: LokiOperationId.Addition,\n name: 'Add scalar',\n sign: '+',\n },\n {\n id: LokiOperationId.Subtraction,\n name: 'Subtract scalar',\n sign: '-',\n },\n {\n id: LokiOperationId.MultiplyBy,\n name: 'Multiply by scalar',\n sign: '*',\n },\n {\n id: LokiOperationId.DivideBy,\n name: 'Divide by scalar',\n sign: '/',\n },\n {\n id: LokiOperationId.Modulo,\n name: 'Modulo by scalar',\n sign: '%',\n },\n {\n id: LokiOperationId.Exponent,\n name: 'Exponent',\n sign: '^',\n },\n {\n id: LokiOperationId.EqualTo,\n name: 'Equal to',\n sign: '==',\n comparison: true,\n },\n {\n id: LokiOperationId.NotEqualTo,\n name: 'Not equal to',\n sign: '!=',\n comparison: true,\n },\n {\n id: LokiOperationId.GreaterThan,\n name: 'Greater than',\n sign: '>',\n comparison: true,\n },\n {\n id: LokiOperationId.LessThan,\n name: 'Less than',\n sign: '<',\n comparison: true,\n },\n {\n id: LokiOperationId.GreaterOrEqual,\n name: 'Greater or equal to',\n sign: '>=',\n comparison: true,\n },\n {\n id: LokiOperationId.LessOrEqual,\n name: 'Less or equal to',\n sign: '<=',\n comparison: true,\n },\n];\n\n// Not sure about this one. It could also be a more generic 'Simple math operation' where user specifies\n// both the operator and the operand in a single input\nexport const binaryScalarOperations: QueryBuilderOperationDefinition[] = binaryScalarDefs.map((opDef) => {\n const params: QueryBuilderOperationParamDef[] = [{ name: 'Value', type: 'number' }];\n const defaultParams: any[] = [2];\n if (opDef.comparison) {\n params.push({\n name: 'Bool',\n type: 'boolean',\n description: 'If checked comparison will return 0 or 1 for the value rather than filtering.',\n });\n defaultParams.push(false);\n }\n\n return {\n id: opDef.id,\n name: opDef.name,\n params,\n defaultParams,\n alternativesKey: 'binary scalar operations',\n category: LokiVisualQueryOperationCategory.BinaryOps,\n renderer: getSimpleBinaryRenderer(opDef.sign),\n addOperationHandler: defaultAddOperationHandler,\n };\n});\n\nfunction getSimpleBinaryRenderer(operator: string) {\n return function binaryRenderer(\n model: QueryBuilderOperation,\n def: QueryBuilderOperationDefinition,\n innerExpr: string\n ) {\n let param = model.params[0];\n let bool = '';\n if (model.params.length === 2) {\n bool = model.params[1] ? ' bool' : '';\n }\n\n return `${innerExpr} ${operator}${bool} ${param}`;\n };\n}\n","import React, { useState } from 'react';\n\nimport { SelectableValue, getDefaultTimeRange, toOption } from '@grafana/data';\nimport { QueryBuilderOperationParamEditorProps, VisualQueryModeller } from '@grafana/experimental';\nimport { config } from '@grafana/runtime';\nimport { Select } from '@grafana/ui';\n\nimport { placeHolderScopedVars } from '../../components/monaco-query-field/monaco-completion-provider/validation';\nimport { LokiDatasource } from '../../datasource';\nimport { getLogQueryFromMetricsQuery, isQueryWithError } from '../../queryUtils';\nimport { extractUnwrapLabelKeysFromDataFrame } from '../../responseUtils';\nimport { getOperationParamId } from '../operationUtils';\nimport { LokiVisualQuery } from '../types';\n\nexport function UnwrapParamEditor({\n onChange,\n index,\n operationId,\n value,\n query,\n datasource,\n timeRange,\n queryModeller,\n}: QueryBuilderOperationParamEditorProps) {\n const [state, setState] = useState<{\n options?: Array<SelectableValue<string>>;\n isLoading?: boolean;\n }>({});\n\n return (\n <Select\n inputId={getOperationParamId(operationId, index)}\n onOpenMenu={async () => {\n // This check is always true, we do it to make typescript happy\n if (datasource instanceof LokiDatasource && config.featureToggles.lokiQueryHints) {\n setState({ isLoading: true });\n const options = await loadUnwrapOptions(query, datasource, queryModeller, timeRange);\n setState({ options, isLoading: undefined });\n }\n }}\n isLoading={state.isLoading}\n allowCustomValue\n noOptionsMessage=\"No labels found\"\n loadingMessage=\"Loading labels\"\n options={state.options}\n value={value ? toOption(value.toString()) : null}\n onChange={(value) => {\n if (value.value) {\n onChange(index, value.value);\n }\n }}\n />\n );\n}\n\nasync function loadUnwrapOptions(\n query: LokiVisualQuery,\n datasource: LokiDatasource,\n queryModeller: VisualQueryModeller,\n timeRange = getDefaultTimeRange()\n): Promise<Array<SelectableValue<string>>> {\n const queryExpr = queryModeller.renderQuery(query);\n const logExpr = getLogQueryFromMetricsQuery(queryExpr);\n if (isQueryWithError(datasource.interpolateString(logExpr, placeHolderScopedVars))) {\n return [];\n }\n\n const samples = await datasource.getDataSamples({ expr: logExpr, refId: 'unwrap_samples' }, timeRange);\n const unwrapLabels = extractUnwrapLabelKeysFromDataFrame(samples[0]);\n\n const labelOptions = unwrapLabels.map((label) => ({\n label,\n value: label,\n }));\n\n return labelOptions;\n}\n","import { QueryBuilderOperationDefinition, QueryBuilderOperationParamValue } from '@grafana/experimental';\n\nimport { binaryScalarOperations } from './binaryScalarOperations';\nimport { UnwrapParamEditor } from './components/UnwrapParamEditor';\nimport {\n addLokiOperation,\n addNestedQueryHandler,\n createAggregationOperation,\n createAggregationOperationWithParam,\n createRangeOperation,\n createRangeOperationWithGrouping,\n getLineFilterRenderer,\n labelFilterRenderer,\n pipelineRenderer,\n} from './operationUtils';\nimport { LokiOperationId, LokiOperationOrder, lokiOperators, LokiVisualQueryOperationCategory } from './types';\n\nfunction getOperationDefinitions(): QueryBuilderOperationDefinition[] {\n const aggregations = [\n LokiOperationId.Sum,\n LokiOperationId.Min,\n LokiOperationId.Max,\n LokiOperationId.Avg,\n LokiOperationId.Stddev,\n LokiOperationId.Stdvar,\n LokiOperationId.Count,\n ].flatMap((opId) =>\n createAggregationOperation(opId, {\n addOperationHandler: addLokiOperation,\n orderRank: LokiOperationOrder.Last,\n })\n );\n\n const aggregationsWithParam = [LokiOperationId.TopK, LokiOperationId.BottomK].flatMap((opId) => {\n return createAggregationOperationWithParam(\n opId,\n {\n params: [{ name: 'K-value', type: 'number' }],\n defaultParams: [5],\n },\n {\n addOperationHandler: addLokiOperation,\n orderRank: LokiOperationOrder.Last,\n }\n );\n });\n\n const rangeOperations = [\n createRangeOperation(LokiOperationId.Rate),\n createRangeOperation(LokiOperationId.RateCounter),\n createRangeOperation(LokiOperationId.CountOverTime),\n createRangeOperation(LokiOperationId.SumOverTime),\n createRangeOperation(LokiOperationId.BytesRate),\n createRangeOperation(LokiOperationId.BytesOverTime),\n createRangeOperation(LokiOperationId.AbsentOverTime),\n ];\n\n const rangeOperationsWithGrouping = [\n ...createRangeOperationWithGrouping(LokiOperationId.AvgOverTime),\n ...createRangeOperationWithGrouping(LokiOperationId.MaxOverTime),\n ...createRangeOperationWithGrouping(LokiOperationId.MinOverTime),\n ...createRangeOperationWithGrouping(LokiOperationId.FirstOverTime),\n ...createRangeOperationWithGrouping(LokiOperationId.LastOverTime),\n ...createRangeOperationWithGrouping(LokiOperationId.StdvarOverTime),\n ...createRangeOperationWithGrouping(LokiOperationId.StddevOverTime),\n ...createRangeOperationWithGrouping(LokiOperationId.QuantileOverTime),\n ];\n\n const list: QueryBuilderOperationDefinition[] = [\n ...aggregations,\n ...aggregationsWithParam,\n ...rangeOperations,\n ...rangeOperationsWithGrouping,\n {\n id: LokiOperationId.Json,\n name: 'Json',\n params: [\n {\n name: 'Expression',\n type: 'string',\n restParam: true,\n optional: true,\n minWidth: 18,\n placeholder: 'server=\"servers[0]\"',\n description:\n 'Using expressions with your json parser will extract only the specified json fields to labels. You can specify one or more expressions in this way. All expressions must be quoted.',\n },\n ],\n defaultParams: [],\n alternativesKey: 'format',\n category: LokiVisualQueryOperationCategory.Formats,\n orderRank: LokiOperationOrder.Parsers,\n renderer: pipelineRenderer,\n addOperationHandler: addLokiOperation,\n explainHandler: () =>\n `This will extract keys and values from a [json](https://grafana.com/docs/loki/latest/logql/log_queries/#json) formatted log line as labels. The extracted labels can be used in label filter expressions and used as values for a range aggregation via the unwrap operation.`,\n },\n {\n id: LokiOperationId.Logfmt,\n name: 'Logfmt',\n params: [\n {\n name: 'Strict',\n type: 'boolean',\n optional: true,\n description:\n 'With strict parsing enabled, the logfmt parser immediately stops scanning the log line and returns early with an error when it encounters any poorly formatted key/value pair.',\n },\n {\n name: 'Keep empty',\n type: 'boolean',\n optional: true,\n description:\n 'The logfmt parser retains standalone keys (keys without a value) as labels with its value set to empty string. ',\n },\n {\n name: 'Expression',\n type: 'string',\n optional: true,\n restParam: true,\n minWidth: 18,\n placeholder: 'field_name',\n description:\n 'Using expressions with your logfmt parser will extract and rename (if provided) only the specified fields to labels. You can specify one or more expressions in this way.',\n },\n ],\n defaultParams: [false, false],\n alternativesKey: 'format',\n category: LokiVisualQueryOperationCategory.Formats,\n orderRank: LokiOperationOrder.Parsers,\n renderer: pipelineRenderer,\n addOperationHandler: addLokiOperation,\n explainHandler: () =>\n `This will extract all keys and values from a [logfmt](https://grafana.com/docs/loki/latest/logql/log_queries/#logfmt) formatted log line as labels. The extracted labels can be used in label filter expressions and used as values for a range aggregation via the unwrap operation.`,\n },\n {\n id: LokiOperationId.Regexp,\n name: 'Regexp',\n params: [\n {\n name: 'String',\n type: 'string',\n hideName: true,\n placeholder: '<re>',\n description: 'The regexp expression that matches the structure of a log line.',\n minWidth: 20,\n },\n ],\n defaultParams: [''],\n alternativesKey: 'format',\n category: LokiVisualQueryOperationCategory.Formats,\n orderRank: LokiOperationOrder.Parsers,\n renderer: (model, def, innerExpr) => `${innerExpr} | regexp \\`${model.params[0]}\\``,\n addOperationHandler: addLokiOperation,\n explainHandler: () =>\n `The [regexp parser](https://grafana.com/docs/loki/latest/logql/log_queries/#regular-expression) takes a single parameter | regexp \"<re>\" which is the regular expression using the Golang RE2 syntax. The regular expression must contain a least one named sub-match (e.g (?P<name>re)), each sub-match will extract a different label. The expression matches the structure of a log line. The extracted labels can be used in label filter expressions and used as values for a range aggregation via the unwrap operation.`,\n },\n {\n id: LokiOperationId.Pattern,\n name: 'Pattern',\n params: [\n {\n name: 'String',\n type: 'string',\n hideName: true,\n placeholder: '<pattern-expression>',\n description: 'The expression that matches the structure of a log line.',\n minWidth: 20,\n },\n ],\n defaultParams: [''],\n alternativesKey: 'format',\n category: LokiVisualQueryOperationCategory.Formats,\n orderRank: LokiOperationOrder.Parsers,\n renderer: (model, def, innerExpr) => `${innerExpr} | pattern \\`${model.params[0]}\\``,\n addOperationHandler: addLokiOperation,\n explainHandler: () =>\n `The [pattern parser](https://grafana.com/docs/loki/latest/logql/log_queries/#pattern) allows the explicit extraction of fields from log lines by defining a pattern expression (| pattern \\`<pattern-expression>\\`). The expression matches the structure of a log line. The extracted labels can be used in label filter expressions and used as values for a range aggregation via the unwrap operation.`,\n },\n {\n id: LokiOperationId.Unpack,\n name: 'Unpack',\n params: [],\n defaultParams: [],\n alternativesKey: 'format',\n category: LokiVisualQueryOperationCategory.Formats,\n orderRank: LokiOperationOrder.Parsers,\n renderer: pipelineRenderer,\n addOperationHandler: addLokiOperation,\n explainHandler: () =>\n `This will extract all keys and values from a JSON log line, [unpacking](https://grafana.com/docs/loki/latest/logql/log_queries/#unpack) all embedded labels in the pack stage. The extracted labels can be used in label filter expressions and used as values for a range aggregation via the unwrap operation.`,\n },\n {\n id: LokiOperationId.LineFormat,\n name: 'Line format',\n params: [\n {\n name: 'String',\n type: 'string',\n hideName: true,\n placeholder: '{{.status_code}}',\n description: 'A line template that can refer to stream labels and extracted labels.',\n minWidth: 20,\n },\n ],\n defaultParams: [''],\n alternativesKey: 'format',\n category: LokiVisualQueryOperationCategory.Formats,\n orderRank: LokiOperationOrder.PipeOperations,\n renderer: (model, def, innerExpr) => `${innerExpr} | line_format \\`${model.params[0]}\\``,\n addOperationHandler: addLokiOperation,\n explainHandler: () =>\n `This will replace log line using a specified template. The template can refer to stream labels and extracted labels.\n\nExample: \\`{{.status_code}} - {{.message}}\\`\n\n[Read the docs](https://grafana.com/docs/loki/latest/logql/log_queries/#line-format-expression) for more.\n `,\n },\n {\n id: LokiOperationId.LabelFormat,\n name: 'Label format',\n params: [\n { name: 'Label', type: 'string' },\n { name: 'Rename to', type: 'string' },\n ],\n defaultParams: ['', ''],\n alternativesKey: 'format',\n category: LokiVisualQueryOperationCategory.Formats,\n orderRank: LokiOperationOrder.PipeOperations,\n renderer: (model, def, innerExpr) => `${innerExpr} | label_format ${model.params[1]}=${model.params[0]}`,\n addOperationHandler: addLokiOperation,\n explainHandler: () =>\n `This will change name of label to desired new label. In the example below, label \"error_level\" will be renamed to \"level\".\n\nExample: \\`\\`error_level=\\`level\\` \\`\\`\n\n[Read the docs](https://grafana.com/docs/loki/latest/logql/log_queries/#labels-format-expression) for more.\n `,\n },\n\n {\n id: LokiOperationId.LineContains,\n name: 'Line contains',\n params: [\n {\n name: '',\n type: 'string',\n hideName: true,\n restParam: true,\n placeholder: 'Text to find',\n description: 'Find log lines that contains this text',\n minWidth: 20,\n runQueryOnEnter: true,\n },\n ],\n defaultParams: [''],\n alternativesKey: 'line filter',\n category: LokiVisualQueryOperationCategory.LineFilters,\n orderRank: LokiOperationOrder.LineFilters,\n renderer: getLineFilterRenderer('|='),\n addOperationHandler: addLokiOperation,\n explainHandler: (op) => `Return log lines that contain string \\`${op.params?.join('`, or `')}\\`.`,\n },\n {\n id: LokiOperationId.LineContainsNot,\n name: 'Line does not contain',\n params: [\n {\n name: '',\n type: 'string',\n hideName: true,\n restParam: true,\n placeholder: 'Text to exclude',\n description: 'Find log lines that does not contain this text',\n minWidth: 26,\n runQueryOnEnter: true,\n },\n ],\n defaultParams: [''],\n alternativesKey: 'line filter',\n category: LokiVisualQueryOperationCategory.LineFilters,\n orderRank: LokiOperationOrder.LineFilters,\n renderer: getLineFilterRenderer('!='),\n addOperationHandler: addLokiOperation,\n explainHandler: (op) => `Return log lines that does not contain string \\`${op.params?.join('`, or `')}\\`.`,\n },\n {\n id: LokiOperationId.LineContainsCaseInsensitive,\n name: 'Line contains case insensitive',\n params: [\n {\n name: '',\n type: 'string',\n hideName: true,\n restParam: true,\n placeholder: 'Text to find',\n description: 'Find log lines that contains this text',\n minWidth: 33,\n runQueryOnEnter: true,\n },\n ],\n defaultParams: [''],\n alternativesKey: 'line filter',\n category: LokiVisualQueryOperationCategory.LineFilters,\n orderRank: LokiOperationOrder.LineFilters,\n renderer: getLineFilterRenderer('|~', true),\n addOperationHandler: addLokiOperation,\n explainHandler: (op) => `Return log lines that match regex \\`(?i)${op.params?.join('`, or `(?i)')}\\`.`,\n },\n {\n id: LokiOperationId.LineContainsNotCaseInsensitive,\n name: 'Line does not contain case insensitive',\n params: [\n {\n name: '',\n type: 'string',\n hideName: true,\n restParam: true,\n placeholder: 'Text to exclude',\n description: 'Find log lines that does not contain this text',\n minWidth: 40,\n runQueryOnEnter: true,\n },\n ],\n defaultParams: [''],\n alternativesKey: 'line filter',\n category: LokiVisualQueryOperationCategory.LineFilters,\n orderRank: LokiOperationOrder.LineFilters,\n renderer: getLineFilterRenderer('!~', true),\n addOperationHandler: addLokiOperation,\n explainHandler: (op) => `Return log lines that does not match regex \\`(?i)${op.params?.join('`, or `(?i)')}\\`.`,\n },\n {\n id: LokiOperationId.LineMatchesRegex,\n name: 'Line contains regex match',\n params: [\n {\n name: '',\n type: 'string',\n hideName: true,\n restParam: true,\n placeholder: 'Pattern to match',\n description: 'Find log lines that match this regex pattern',\n minWidth: 30,\n runQueryOnEnter: true,\n },\n ],\n defaultParams: [''],\n alternativesKey: 'line filter',\n category: LokiVisualQueryOperationCategory.LineFilters,\n orderRank: LokiOperationOrder.LineFilters,\n renderer: getLineFilterRenderer('|~'),\n addOperationHandler: addLokiOperation,\n explainHandler: (op) => `Return log lines that match a \\`RE2\\` regex pattern. \\`${op.params?.join('`, or `')}\\`.`,\n },\n {\n id: LokiOperationId.LineMatchesRegexNot,\n name: 'Line does not match regex',\n params: [\n {\n name: '',\n type: 'string',\n hideName: true,\n restParam: true,\n placeholder: 'Pattern to exclude',\n description: 'Find log lines that does not match this regex pattern',\n minWidth: 30,\n runQueryOnEnter: true,\n },\n ],\n defaultParams: [''],\n alternativesKey: 'line filter',\n category: LokiVisualQueryOperationCategory.LineFilters,\n orderRank: LokiOperationOrder.LineFilters,\n renderer: getLineFilterRenderer('!~'),\n addOperationHandler: addLokiOperation,\n explainHandler: (op) =>\n `Return log lines that doesn't match a \\`RE2\\` regex pattern. \\`${op.params?.join('`, or `')}\\`.`,\n },\n {\n id: LokiOperationId.LineFilterIpMatches,\n name: 'IP line filter expression',\n params: [\n {\n name: 'Operator',\n type: 'string',\n minWidth: 16,\n options: [lokiOperators.contains, lokiOperators.doesNotContain],\n },\n {\n name: 'Pattern',\n type: 'string',\n placeholder: '<pattern>',\n minWidth: 16,\n runQueryOnEnter: true,\n },\n ],\n defaultParams: ['|=', ''],\n alternativesKey: 'line filter',\n category: LokiVisualQueryOperationCategory.LineFilters,\n orderRank: LokiOperationOrder.LineFilters,\n renderer: (op, def, innerExpr) => `${innerExpr} ${op.params[0]} ip(\\`${op.params[1]}\\`)`,\n addOperationHandler: addLokiOperation,\n explainHandler: (op) => `Return log lines using IP matching of \\`${op.params[1]}\\``,\n },\n {\n id: LokiOperationId.LabelFilter,\n name: 'Label filter expression',\n params: [\n { name: 'Label', type: 'string', minWidth: 14 },\n {\n name: 'Operator',\n type: 'string',\n minWidth: 14,\n options: [\n lokiOperators.equals,\n lokiOperators.doesNotEqual,\n lokiOperators.matchesRegex,\n lokiOperators.doesNotMatchRegex,\n lokiOperators.greaterThan,\n lokiOperators.lessThan,\n lokiOperators.greaterThanOrEqual,\n lokiOperators.lessThanOrEqual,\n ],\n },\n { name: 'Value', type: 'string', minWidth: 14 },\n ],\n defaultParams: ['', '=', ''],\n alternativesKey: 'label filter',\n category: LokiVisualQueryOperationCategory.LabelFilters,\n orderRank: LokiOperationOrder.PipeOperations,\n renderer: labelFilterRenderer,\n addOperationHandler: addLokiOperation,\n explainHandler: () => `Label expression filter allows filtering using original and extracted labels.`,\n },\n {\n id: LokiOperationId.LabelFilterIpMatches,\n name: 'IP label filter expression',\n params: [\n { name: 'Label', type: 'string', minWidth: 14 },\n {\n name: 'Operator',\n type: 'string',\n minWidth: 14,\n options: [lokiOperators.equals, lokiOperators.doesNotEqual],\n },\n { name: 'Value', type: 'string', minWidth: 14 },\n ],\n defaultParams: ['', '=', ''],\n alternativesKey: 'label filter',\n category: LokiVisualQueryOperationCategory.LabelFilters,\n orderRank: LokiOperationOrder.PipeOperations,\n renderer: (model, def, innerExpr) =>\n `${innerExpr} | ${model.params[0]} ${model.params[1]} ip(\\`${model.params[2]}\\`)`,\n addOperationHandler: addLokiOperation,\n explainHandler: (op) => `Return log lines using IP matching of \\`${op.params[2]}\\` for \\`${op.params[0]}\\` label`,\n },\n {\n id: LokiOperationId.LabelFilterNoErrors,\n name: 'No pipeline errors',\n params: [],\n defaultParams: [],\n alternativesKey: 'label filter',\n category: LokiVisualQueryOperationCategory.LabelFilters,\n orderRank: LokiOperationOrder.NoErrors,\n renderer: (model, def, innerExpr) => `${innerExpr} | __error__=\\`\\``,\n addOperationHandler: addLokiOperation,\n explainHandler: () => `Filter out all formatting and parsing errors.`,\n },\n {\n id: LokiOperationId.Unwrap,\n name: 'Unwrap',\n params: [\n {\n name: 'Identifier',\n type: 'string',\n hideName: true,\n minWidth: 16,\n placeholder: 'Label key',\n editor: UnwrapParamEditor,\n },\n {\n name: 'Conversion function',\n hideName: true,\n type: 'string',\n options: ['duration', 'duration_seconds', 'bytes'],\n optional: true,\n },\n ],\n defaultParams: ['', ''],\n alternativesKey: 'format',\n category: LokiVisualQueryOperationCategory.Formats,\n orderRank: LokiOperationOrder.Unwrap,\n renderer: (op, def, innerExpr) =>\n `${innerExpr} | unwrap ${op.params[1] ? `${op.params[1]}(${op.params[0]})` : op.params[0]}`,\n addOperationHandler: addLokiOperation,\n explainHandler: (op) => {\n let label = String(op.params[0]).length > 0 ? op.params[0] : '<label>';\n return `Use the extracted label \\`${label}\\` as sample values instead of log lines for the subsequent range aggregation.${\n op.params[1]\n ? ` Conversion function \\`${op.params[1]}\\` wrapping \\`${label}\\` will attempt to convert this label from a specific format (e.g. 3k, 500ms).`\n : ''\n }`;\n },\n },\n {\n id: LokiOperationId.Decolorize,\n name: 'Decolorize',\n params: [],\n defaultParams: [],\n alternativesKey: 'format',\n category: LokiVisualQueryOperationCategory.Formats,\n orderRank: LokiOperationOrder.PipeOperations,\n renderer: (op, def, innerExpr) => `${innerExpr} | decolorize`,\n addOperationHandler: addLokiOperation,\n explainHandler: () => `This will remove ANSI color codes from log lines.`,\n },\n {\n id: LokiOperationId.Drop,\n name: 'Drop',\n params: [\n // As drop can support both labels (e.g. job) and expressions (e.g. job=\"grafana\"), we\n // use input and not LabelParamEditor.\n {\n name: 'Label',\n type: 'string',\n restParam: true,\n optional: true,\n minWidth: 18,\n placeholder: 'job=\"grafana\"',\n description: 'Specify labels or expressions to drop.',\n },\n ],\n defaultParams: [''],\n alternativesKey: 'format',\n category: LokiVisualQueryOperationCategory.Formats,\n orderRank: LokiOperationOrder.PipeOperations,\n renderer: pipelineRenderer,\n addOperationHandler: addLokiOperation,\n explainHandler: () => 'The drop expression will drop the given labels in the pipeline.',\n },\n {\n id: LokiOperationId.Keep,\n name: 'Keep',\n params: [\n // As keep can support both labels (e.g. job) and expressions (e.g. job=\"grafana\"), we\n // use input and not LabelParamEditor.\n {\n name: 'Label',\n type: 'string',\n restParam: true,\n optional: true,\n minWidth: 18,\n placeholder: 'job=\"grafana\"',\n description: 'Specify labels or expressions to keep.',\n },\n ],\n defaultParams: [''],\n alternativesKey: 'format',\n category: LokiVisualQueryOperationCategory.Formats,\n orderRank: LokiOperationOrder.PipeOperations,\n renderer: pipelineRenderer,\n addOperationHandler: addLokiOperation,\n explainHandler: () =>\n 'The keep expression will keep only the specified labels in the pipeline and drop all the other labels.',\n },\n ...binaryScalarOperations,\n {\n id: LokiOperationId.NestedQuery,\n name: 'Binary operation with query',\n params: [],\n defaultParams: [],\n category: LokiVisualQueryOperationCategory.BinaryOps,\n renderer: (model, def, innerExpr) => innerExpr,\n addOperationHandler: addNestedQueryHandler,\n },\n ];\n\n return list;\n}\n\n// Keeping a local copy as an optimization measure.\nexport const operationDefinitions = getOperationDefinitions();\n\n/**\n * Given an operator, return the corresponding explain.\n * For usage within the Query Editor.\n */\nexport function explainOperator(id: LokiOperationId | string): string {\n const definition = operationDefinitions.find((operation) => operation.id === id);\n\n const explain = definition?.explainHandler?.({ id: '', params: ['<value>'] }) || '';\n\n // Strip markdown links\n return explain.replace(/\\[(.*)\\]\\(.*\\)/g, '$1');\n}\n\nexport function getDefinitionById(id: string): QueryBuilderOperationDefinition | undefined {\n return operationDefinitions.find((x) => x.id === id);\n}\n\nexport function checkParamsAreValid(\n def: QueryBuilderOperationDefinition,\n params: QueryBuilderOperationParamValue[]\n): boolean {\n // For now we only check if the operation has all the required params.\n if (params.length < def.params.filter((param) => !param.optional).length) {\n return false;\n }\n\n return true;\n}\n","import { SyntaxNode } from '@lezer/common';\n\nimport { QueryBuilderLabelFilter, QueryBuilderOperation, QueryBuilderOperationParamValue } from '@grafana/experimental';\nimport {\n And,\n BinOpExpr,\n Bool,\n By,\n ConvOp,\n Decolorize,\n DropLabel,\n DropLabels,\n DropLabelsExpr,\n Filter,\n FilterOp,\n Grouping,\n GroupingLabelList,\n GroupingLabels,\n Identifier,\n Ip,\n IpLabelFilter,\n Json,\n JsonExpressionParser,\n KeepLabel,\n KeepLabels,\n KeepLabelsExpr,\n LabelExtractionExpression,\n LabelFilter,\n LabelFormatMatcher,\n LabelParser,\n LineFilter,\n LineFormatExpr,\n LogfmtExpressionParser,\n LogfmtParser,\n LogRangeExpr,\n Matcher,\n MetricExpr,\n Number as NumberLezer,\n On,\n Or,\n parser,\n ParserFlag,\n Range,\n RangeAggregationExpr,\n RangeOp,\n String,\n UnitFilter,\n Unwrap,\n UnwrapExpr,\n VectorAggregationExpr,\n VectorOp,\n Without,\n BinOpModifier,\n OnOrIgnoringModifier,\n OrFilter,\n} from '@grafana/lezer-logql';\n\nimport { binaryScalarDefs } from './binaryScalarOperations';\nimport { checkParamsAreValid, getDefinitionById } from './operations';\nimport {\n ErrorId,\n getAllByType,\n getLeftMostChild,\n getString,\n makeBinOp,\n makeError,\n replaceVariables,\n} from './parsingUtils';\nimport { LokiOperationId, LokiVisualQuery, LokiVisualQueryBinary } from './types';\n\ninterface Context {\n query: LokiVisualQuery;\n errors: ParsingError[];\n}\n\ninterface ParsingError {\n text: string;\n from?: number;\n to?: number;\n parentType?: string;\n}\n\ninterface GetOperationResult {\n operation?: QueryBuilderOperation;\n error?: string;\n}\n\nexport function buildVisualQueryFromString(expr: string): Context {\n const replacedExpr = replaceVariables(expr);\n const tree = parser.parse(replacedExpr);\n const node = tree.topNode;\n\n // This will be modified in the handleExpression\n const visQuery: LokiVisualQuery = {\n labels: [],\n operations: [],\n };\n\n const context: Context = {\n query: visQuery,\n errors: [],\n };\n\n try {\n handleExpression(replacedExpr, node, context);\n } catch (err) {\n // Not ideal to log it here, but otherwise we would lose the stack trace.\n console.error(err);\n if (err instanceof Error) {\n context.errors.push({\n text: err.message,\n });\n }\n }\n\n // If we have empty query, we want to reset errors\n if (isEmptyQuery(context.query)) {\n context.errors = [];\n }\n return context;\n}\n\nexport function handleExpression(expr: string, node: SyntaxNode, context: Context) {\n const visQuery = context.query;\n switch (node.type.id) {\n case Matcher: {\n visQuery.labels.push(getLabel(expr, node));\n const err = node.getChild(ErrorId);\n if (err) {\n context.errors.push(makeError(expr, err));\n }\n break;\n }\n\n case LineFilter: {\n const { operation, error } = getLineFilter(expr, node);\n if (operation) {\n visQuery.operations.push(operation);\n }\n // Show error for query patterns not supported in visual query builder\n if (error) {\n context.errors.push(createNotSupportedError(expr, node, error));\n }\n break;\n }\n\n case LabelParser: {\n visQuery.operations.push(getLabelParser(expr, node));\n break;\n }\n\n case LabelFilter: {\n const { operation, error } = getLabelFilter(expr, node);\n if (operation) {\n visQuery.operations.push(operation);\n }\n // Show error for query patterns not supported in visual query builder\n if (error) {\n context.errors.push(createNotSupportedError(expr, node, error));\n }\n break;\n }\n case JsonExpressionParser: {\n visQuery.operations.push(getJsonExpressionParser(expr, node));\n break;\n }\n\n case LogfmtParser:\n case LogfmtExpressionParser: {\n const { operation, error } = getLogfmtParser(expr, node);\n if (operation) {\n visQuery.operations.push(operation);\n }\n if (error) {\n context.errors.push(createNotSupportedError(expr, node, error));\n }\n break;\n }\n\n case LineFormatExpr: {\n visQuery.operations.push(getLineFormat(expr, node));\n break;\n }\n\n case LabelFormatMatcher: {\n visQuery.operations.push(getLabelFormat(expr, node));\n break;\n }\n\n case UnwrapExpr: {\n const { operation, error } = handleUnwrapExpr(expr, node, context);\n if (operation) {\n visQuery.operations.push(operation);\n }\n // Show error for query patterns not supported in visual query builder\n if (error) {\n context.errors.push(createNotSupportedError(expr, node, error));\n }\n\n break;\n }\n\n case Decolorize: {\n visQuery.operations.push(getDecolorize());\n break;\n }\n\n case RangeAggregationExpr: {\n visQuery.operations.push(handleRangeAggregation(expr, node, context));\n break;\n }\n\n case VectorAggregationExpr: {\n visQuery.operations.push(handleVectorAggregation(expr, node, context));\n break;\n }\n\n case BinOpExpr: {\n handleBinary(expr, node, context);\n break;\n }\n\n case ErrorId: {\n if (isIntervalVariableError(node)) {\n break;\n }\n context.errors.push(makeError(expr, node));\n break;\n }\n\n case DropLabelsExpr: {\n visQuery.operations.push(handleDropFilter(expr, node, context));\n break;\n }\n\n case KeepLabelsExpr: {\n visQuery.operations.push(handleKeepFilter(expr, node, context));\n break;\n }\n\n default: {\n // Any other nodes we just ignore and go to its children. This should be fine as there are lots of wrapper\n // nodes that can be skipped.\n // TODO: there are probably cases where we will just skip nodes we don't support and we should be able to\n // detect those and report back.\n let child = node.firstChild;\n while (child) {\n handleExpression(expr, child, context);\n child = child.nextSibling;\n }\n }\n }\n}\n\nfunction getLabel(expr: string, node: SyntaxNode): QueryBuilderLabelFilter {\n const labelNode = node.getChild(Identifier);\n const label = getString(expr, labelNode);\n const op = getString(expr, labelNode?.nextSibling);\n let value = getString(expr, node.getChild(String));\n // `value` is wrapped in double quotes, so we need to remove them. As a value can contain double quotes, we can't use RegEx here.\n value = value.substring(1, value.length - 1);\n\n return {\n label,\n op,\n value,\n };\n}\n\nfunction getLineFilter(expr: string, node: SyntaxNode): GetOperationResult {\n const filter = getString(expr, node.getChild(Filter));\n const filterExpr = handleQuotes(getString(expr, node.getChild(String)));\n const ipLineFilter = node.getChild(FilterOp)?.getChild(Ip);\n if (ipLineFilter) {\n return {\n operation: {\n id: LokiOperationId.LineFilterIpMatches,\n params: [filter, filterExpr],\n },\n };\n }\n\n const params = [filterExpr];\n let orFilter = node.getChild(OrFilter);\n while (orFilter) {\n params.push(handleQuotes(getString(expr, orFilter.getChild(String))));\n orFilter = orFilter.getChild(OrFilter);\n }\n\n const mapFilter: Record<string, LokiOperationId> = {\n '|=': LokiOperationId.LineContains,\n '!=': LokiOperationId.LineContainsNot,\n '|~': LokiOperationId.LineMatchesRegex,\n '!~': LokiOperationId.LineMatchesRegexNot,\n };\n\n return {\n operation: {\n id: mapFilter[filter],\n params,\n },\n };\n}\n\nfunction getLabelParser(expr: string, node: SyntaxNode): QueryBuilderOperation {\n const parserNode = node.firstChild;\n const parser = getString(expr, parserNode);\n\n const string = handleQuotes(getString(expr, node.getChild(String)));\n let params: QueryBuilderOperationParamValue[] = !!string ? [string] : [];\n const opDef = getDefinitionById(parser);\n if (opDef && !checkParamsAreValid(opDef, params)) {\n params = opDef?.defaultParams || [];\n }\n\n return {\n id: parser,\n params,\n };\n}\n\nfunction getJsonExpressionParser(expr: string, node: SyntaxNode): QueryBuilderOperation {\n const parserNode = node.getChild(Json);\n const parser = getString(expr, parserNode);\n\n const params = [...getAllByType(expr, node, LabelExtractionExpression)];\n return {\n id: parser,\n params,\n };\n}\n\nfunction getLogfmtParser(expr: string, node: SyntaxNode): GetOperationResult {\n const flags: string[] = [];\n const labels: string[] = [];\n let error: string | undefined = undefined;\n\n const offset = node.from;\n node.toTree().iterate({\n enter: (subNode) => {\n if (subNode.type.id === ParserFlag) {\n flags.push(expr.substring(subNode.from + offset, subNode.to + offset));\n } else if (subNode.type.id === LabelExtractionExpression) {\n labels.push(expr.substring(subNode.from + offset, subNode.to + offset));\n } else if (subNode.type.id === ErrorId) {\n error = `Unexpected string \"${expr.substring(subNode.from + offset, subNode.to + offset)}\"`;\n }\n },\n });\n\n const operation = {\n id: LokiOperationId.Logfmt,\n params: [flags.includes('--strict'), flags.includes('--keep-empty'), ...labels],\n };\n\n return {\n operation,\n error,\n };\n}\n\nfunction getLabelFilter(expr: string, node: SyntaxNode): GetOperationResult {\n // Check for nodes not supported in visual builder and return error\n if (node.getChild(Or) || node.getChild(And) || node.getChild('Comma')) {\n return {\n error: 'Label filter with comma, \"and\", \"or\" not supported in query builder',\n };\n }\n if (node.firstChild!.type.id === IpLabelFilter) {\n const ipLabelFilter = node.firstChild;\n const label = ipLabelFilter?.getChild(Identifier);\n const op = label?.nextSibling;\n const value = ipLabelFilter?.getChild(String);\n const valueString = handleQuotes(getString(expr, value));\n\n return {\n operation: {\n id: LokiOperationId.LabelFilterIpMatches,\n params: [getString(expr, label), getString(expr, op), valueString],\n },\n };\n }\n\n const id = LokiOperationId.LabelFilter;\n if (node.firstChild!.type.id === UnitFilter) {\n const filter = node.firstChild!.firstChild;\n const label = filter!.firstChild;\n const op = label!.nextSibling;\n const value = op!.nextSibling;\n const valueString = handleQuotes(getString(expr, value));\n\n return {\n operation: {\n id,\n params: [getString(expr, label), getString(expr, op), valueString],\n },\n };\n }\n // In this case it is Matcher or NumberFilter\n const filter = node.firstChild;\n const label = filter!.firstChild;\n const op = label!.nextSibling;\n const value = op!.nextSibling;\n const params = [getString(expr, label), getString(expr, op), handleQuotes(getString(expr, value))];\n\n // Special case of pipe filtering - no errors\n if (params.join('') === `__error__=`) {\n return {\n operation: {\n id: LokiOperationId.LabelFilterNoErrors,\n params: [],\n },\n };\n }\n\n return {\n operation: {\n id,\n params,\n },\n };\n}\n\nfunction getLineFormat(expr: string, node: SyntaxNode): QueryBuilderOperation {\n const id = LokiOperationId.LineFormat;\n const string = handleQuotes(getString(expr, node.getChild(String)));\n\n return {\n id,\n params: [string],\n };\n}\n\nfunction getLabelFormat(expr: string, node: SyntaxNode): QueryBuilderOperation {\n const id = LokiOperationId.LabelFormat;\n const renameTo = node.getChild(Identifier);\n const op = renameTo!.nextSibling;\n const originalLabel = op!.nextSibling;\n\n return {\n id,\n params: [getString(expr, originalLabel), handleQuotes(getString(expr, renameTo))],\n };\n}\n\nfunction getDecolorize(): QueryBuilderOperation {\n const id = LokiOperationId.Decolorize;\n\n return {\n id,\n params: [],\n };\n}\n\nfunction handleUnwrapExpr(expr: string, node: SyntaxNode, context: Context): GetOperationResult {\n const unwrapExprChild = node.getChild(UnwrapExpr);\n const labelFilterChild = node.getChild(LabelFilter);\n const unwrapChild = node.getChild(Unwrap);\n\n if (unwrapExprChild) {\n handleExpression(expr, unwrapExprChild, context);\n }\n\n if (labelFilterChild) {\n handleExpression(expr, labelFilterChild, context);\n }\n\n if (unwrapChild) {\n if (unwrapChild.nextSibling?.type.id === ConvOp) {\n const convOp = unwrapChild.nextSibling;\n const identifier = convOp.nextSibling;\n return {\n operation: {\n id: LokiOperationId.Unwrap,\n params: [getString(expr, identifier), getString(expr, convOp)],\n },\n };\n }\n\n return {\n operation: {\n id: LokiOperationId.Unwrap,\n params: [getString(expr, unwrapChild?.nextSibling), ''],\n },\n };\n }\n\n return {};\n}\n\nfunction handleRangeAggregation(expr: string, node: SyntaxNode, context: Context) {\n const nameNode = node.getChild(RangeOp);\n const funcName = getString(expr, nameNode);\n const number = node.getChild(NumberLezer);\n const logExpr = node.getChild(LogRangeExpr);\n const params = number !== null && number !== undefined ? [getString(expr, number)] : [];\n const range = logExpr?.getChild(Range);\n const rangeValue = range ? getString(expr, range) : null;\n const grouping = node.getChild(Grouping);\n\n if (rangeValue) {\n params.unshift(rangeValue.substring(1, rangeValue.length - 1));\n }\n\n if (grouping) {\n params.push(...getAllByType(expr, grouping, Identifier));\n }\n\n const op = {\n id: funcName,\n params,\n };\n\n if (logExpr) {\n handleExpression(expr, logExpr, context);\n }\n\n return op;\n}\n\nfunction handleVectorAggregation(expr: string, node: SyntaxNode, context: Context) {\n const nameNode = node.getChild(VectorOp);\n let funcName = getString(expr, nameNode);\n\n const grouping = node.getChild(Grouping);\n const params = [];\n\n const numberNode = node.getChild(NumberLezer);\n\n if (numberNode) {\n params.push(Number(getString(expr, numberNode)));\n }\n\n if (grouping) {\n const byModifier = grouping.getChild(By);\n if (byModifier && funcName) {\n funcName = `__${funcName}_by`;\n }\n\n const withoutModifier = grouping.getChild(Without);\n if (withoutModifier) {\n funcName = `__${funcName}_without`;\n }\n\n params.push(...getAllByType(expr, grouping, Identifier));\n }\n\n const metricExpr = node.getChild(MetricExpr);\n const op: QueryBuilderOperation = { id: funcName, params };\n\n if (metricExpr) {\n // A vector aggregation expression with a child of metric expression with a child of binary expression is ambiguous after being parsed into a visual query\n if (metricExpr.firstChild?.type.id === BinOpExpr) {\n context.errors.push({\n text: 'Query parsing is ambiguous.',\n from: metricExpr.firstChild.from,\n to: metricExpr.firstChild?.to,\n });\n }\n\n handleExpression(expr, metricExpr, context);\n }\n\n return op;\n}\n\nconst operatorToOpName = binaryScalarDefs.reduce<Record<string, { id: string; comparison?: boolean }>>((acc, def) => {\n acc[def.sign] = {\n id: def.id,\n comparison: def.comparison,\n };\n return acc;\n}, {});\n\n/**\n * Right now binary expressions can be represented in 2 way in visual query. As additional operation in case it is\n * just operation with scalar or it creates a binaryQuery when it's 2 queries.\n * @param expr\n * @param node\n * @param context\n */\nfunction handleBinary(expr: string, node: SyntaxNode, context: Context) {\n const visQuery = context.query;\n const left = node.firstChild!;\n const op = getString(expr, left.nextSibling);\n const binModifier = getBinaryModifier(expr, node.getChild(BinOpModifier));\n\n const right = node.lastChild!;\n\n const opDef = operatorToOpName[op];\n\n const leftNumber = getLastChildWithSelector(left, 'MetricExpr.LiteralExpr.Number');\n const rightNumber = getLastChildWithSelector(right, 'MetricExpr.LiteralExpr.Number');\n\n const rightBinary = right.getChild(BinOpExpr);\n\n if (leftNumber) {\n // TODO: this should be already handled in case parent is binary expression as it has to be added to parent\n // if query starts with a number that isn't handled now.\n } else {\n // If this is binary we don't really know if there is a query or just chained scalars. So\n // we have to traverse a bit deeper to know\n handleExpression(expr, left, context);\n }\n\n if (rightNumber) {\n visQuery.operations.push(makeBinOp(opDef, expr, right, !!binModifier?.isBool));\n } else if (rightBinary) {\n // Due to the way binary ops are parsed we can get a binary operation on the right that starts with a number which\n // is a factor for a current binary operation. So we have to add it as an operation now.\n const leftMostChild = getLeftMostChild(right);\n if (leftMostChild?.type.id === NumberLezer) {\n visQuery.operations.push(makeBinOp(opDef, expr, leftMostChild, !!binModifier?.isBool));\n }\n\n // If we added the first number literal as operation here we still can continue and handle the rest as the first\n // number will be just skipped.\n handleExpression(expr, right, context);\n } else {\n visQuery.binaryQueries = visQuery.binaryQueries || [];\n const binQuery: LokiVisualQueryBinary = {\n operator: op,\n query: {\n labels: [],\n operations: [],\n },\n };\n if (binModifier?.isMatcher) {\n binQuery.vectorMatchesType = binModifier.matchType;\n binQuery.vectorMatches = binModifier.matches;\n }\n visQuery.binaryQueries.push(binQuery);\n handleExpression(expr, right, {\n query: binQuery.query,\n errors: context.errors,\n });\n }\n}\n\nfunction getBinaryModifier(\n expr: string,\n node: SyntaxNode | null\n):\n | { isBool: true; isMatcher: false }\n | { isBool: boolean; isMatcher: true; matches: string; matchType: 'ignoring' | 'on' }\n | undefined {\n if (!node) {\n return undefined;\n }\n const matcher = node.getChild(OnOrIgnoringModifier);\n const boolMatcher = node.getChild(Bool);\n\n if (!matcher && boolMatcher) {\n return { isBool: true, isMatcher: false };\n } else {\n if (!matcher) {\n // Not sure what this could be, maybe should be an error.\n return undefined;\n }\n const labels = getString(expr, matcher.getChild(GroupingLabels)?.getChild(GroupingLabelList));\n return {\n isMatcher: true,\n isBool: !!boolMatcher,\n matches: labels,\n matchType: matcher.getChild(On) ? 'on' : 'ignoring',\n };\n }\n}\n\nfunction isIntervalVariableError(node: SyntaxNode) {\n return node?.parent?.type.id === Range;\n}\n\nexport function handleQuotes(string: string) {\n if (string[0] === `\"` && string[string.length - 1] === `\"`) {\n return string\n .substring(1, string.length - 1)\n .replace(/\\\\\"/g, '\"')\n .replace(/\\\\\\\\/g, '\\\\');\n }\n return string.replace(/`/g, '');\n}\n\n/**\n * Simple helper to traverse the syntax tree. Instead of node.getChild('foo')?.getChild('bar')?.getChild('baz') you\n * can write getChildWithSelector(node, 'foo.bar.baz')\n * @param node\n * @param selector\n */\nfunction getLastChildWithSelector(node: SyntaxNode, selector: string) {\n let child: SyntaxNode | null = node;\n const children = selector.split('.');\n for (const s of children) {\n child = child.getChild(s);\n if (!child) {\n return null;\n }\n }\n return child;\n}\n\n/**\n * Helper function to enrich error text with information that visual query builder doesn't support that logQL\n * @param expr\n * @param node\n * @param error\n */\nfunction createNotSupportedError(expr: string, node: SyntaxNode, error: string) {\n const err = makeError(expr, node);\n err.text = `${error}: ${err.text}`;\n return err;\n}\n\nfunction isEmptyQuery(query: LokiVisualQuery) {\n if (query.labels.length === 0 && query.operations.length === 0) {\n return true;\n }\n return false;\n}\n\nfunction handleDropFilter(expr: string, node: SyntaxNode, context: Context): QueryBuilderOperation {\n const labels: string[] = [];\n let exploringNode = node.getChild(DropLabels);\n while (exploringNode) {\n const label = getString(expr, exploringNode.getChild(DropLabel));\n if (label) {\n labels.push(label);\n }\n exploringNode = exploringNode?.getChild(DropLabels);\n }\n labels.reverse();\n return {\n id: LokiOperationId.Drop,\n params: labels,\n };\n}\n\nfunction handleKeepFilter(expr: string, node: SyntaxNode, context: Context): QueryBuilderOperation {\n const labels: string[] = [];\n let exploringNode = node.getChild(KeepLabels);\n while (exploringNode) {\n const label = getString(expr, exploringNode.getChild(KeepLabel));\n if (label) {\n labels.push(label);\n }\n exploringNode = exploringNode?.getChild(KeepLabels);\n }\n labels.reverse();\n return {\n id: LokiOperationId.Keep,\n params: labels,\n };\n}\n","import { SyntaxNode, TreeCursor } from '@lezer/common';\n\nimport { QueryBuilderOperation, QueryBuilderOperationParamValue } from '@grafana/experimental';\n\n// Although 0 isn't explicitly provided in the @grafana/lezer-logql library as the error node ID, it does appear to be the ID of error nodes within lezer.\nexport const ErrorId = 0;\n\nexport function getLeftMostChild(cur: SyntaxNode): SyntaxNode {\n return cur.firstChild ? getLeftMostChild(cur.firstChild) : cur;\n}\n\nexport function makeError(expr: string, node: SyntaxNode) {\n return {\n text: getString(expr, node),\n // TODO: this are positions in the string with the replaced variables. Means it cannot be used to show exact\n // placement of the error for the user. We need some translation table to positions before the variable\n // replace.\n from: node.from,\n to: node.to,\n parentType: node.parent?.name,\n };\n}\n\n// Taken from template_srv, but copied so to not mess with the regex.index which is manipulated in the service\n/*\n * This regex matches 3 types of variable reference with an optional format specifier\n * \\$(\\w+) $var1\n * \\[\\[([\\s\\S]+?)(?::(\\w+))?\\]\\] [[var2]] or [[var2:fmt2]]\n * \\${(\\w+)(?::(\\w+))?} ${var3} or ${var3:fmt3}\n */\nexport const variableRegex = /\\$(\\w+)|\\[\\[([\\s\\S]+?)(?::(\\w+))?\\]\\]|\\${(\\w+)(?:\\.([^:^\\}]+))?(?::([^\\}]+))?}/g;\n\n/**\n * As variables with $ are creating parsing errors, we first replace them with magic string that is parsable and at\n * the same time we can get the variable and its format back from it.\n * @param expr\n */\nexport function replaceVariables(expr: string) {\n return expr.replace(variableRegex, (match, var1, var2, fmt2, var3, fieldPath, fmt3) => {\n const fmt = fmt2 || fmt3;\n let variable = var1;\n let varType = '0';\n\n if (var2) {\n variable = var2;\n varType = '1';\n }\n\n if (var3) {\n variable = var3;\n varType = '2';\n }\n\n return `__V_${varType}__` + variable + '__V__' + (fmt ? '__F__' + fmt + '__F__' : '');\n });\n}\n\nconst varTypeFunc = [\n (v: string, f?: string) => `\\$${v}`,\n (v: string, f?: string) => `[[${v}${f ? `:${f}` : ''}]]`,\n (v: string, f?: string) => `\\$\\{${v}${f ? `:${f}` : ''}\\}`,\n];\n\n/**\n * Get back the text with variables in their original format.\n * @param expr\n */\nexport function returnVariables(expr: string) {\n return expr.replace(/__V_(\\d)__(.+?)__V__(?:__F__(\\w+)__F__)?/g, (match, type, v, f) => {\n return varTypeFunc[parseInt(type, 10)](v, f);\n });\n}\n\n/**\n * Get the actual string of the expression. That is not stored in the tree so we have to get the indexes from the node\n * and then based on that get it from the expression.\n * @param expr\n * @param node\n */\nexport function getString(expr: string, node: SyntaxNode | TreeCursor | null | undefined) {\n if (!node) {\n return '';\n }\n return returnVariables(expr.substring(node.from, node.to));\n}\n\n/**\n * Create simple scalar binary op object.\n * @param opDef - definition of the op to be created\n * @param expr\n * @param numberNode - the node for the scalar\n * @param hasBool - whether operation has a bool modifier. Is used only for ops for which it makes sense.\n */\nexport function makeBinOp(\n opDef: { id: string; comparison?: boolean },\n expr: string,\n numberNode: SyntaxNode,\n hasBool: boolean\n): QueryBuilderOperation {\n const params: QueryBuilderOperationParamValue[] = [parseFloat(getString(expr, numberNode))];\n if (opDef.comparison) {\n params.push(hasBool);\n }\n return {\n id: opDef.id,\n params,\n };\n}\n\n/**\n * Get all nodes with type in the tree. This traverses the tree so it is safe only when you know there shouldn't be\n * too much nesting but you just want to skip some of the wrappers. For example getting function args this way would\n * not be safe is it would also find arguments of nested functions.\n * @param expr\n * @param cur\n * @param type - can be string or number, some data-sources (loki) haven't migrated over to using numeric constants defined in the lezer parsing library (e.g. lezer-promql).\n * @todo Remove string type definition when all data-sources have migrated to numeric constants\n */\nexport function getAllByType(expr: string, cur: SyntaxNode, type: number | string): string[] {\n if (cur.type.id === type || cur.name === type) {\n return [getString(expr, cur)];\n }\n const values: string[] = [];\n let pos = 0;\n let child = cur.childAfter(pos);\n while (child) {\n values.push(...getAllByType(expr, child, type));\n pos = child.to;\n child = cur.childAfter(pos);\n }\n return values;\n}\n\n/**\n * There aren't any spaces in the metric names, so let's introduce a wildcard into the regex for each space to better facilitate a fuzzy search\n */\nexport const regexifyLabelValuesQueryString = (query: string) => {\n const queryArray = query.split(' ');\n return queryArray.map((query) => `${query}.*`).join('');\n};\n","export function isLogLineJSON(line: string): boolean {\n let parsed;\n try {\n parsed = JSON.parse(line);\n } catch (error) {}\n // The JSON parser should only be used for log lines that are valid serialized JSON objects.\n return typeof parsed === 'object';\n}\n\n// This matches:\n// first a label from start of the string or first white space, then any word chars until \"=\"\n// second either an empty quotes, or anything that starts with quote and ends with unescaped quote,\n// or any non whitespace chars that do not start with quote\nconst LOGFMT_REGEXP = /(?:^|\\s)([\\w\\(\\)\\[\\]\\{\\}]+)=(\"\"|(?:\".*?[^\\\\]\"|[^\"\\s]\\S*))/;\n\nexport function isLogLineLogfmt(line: string): boolean {\n return LOGFMT_REGEXP.test(line);\n}\n\nexport function isLogLinePacked(line: string): boolean {\n let parsed;\n try {\n parsed = JSON.parse(line);\n return parsed.hasOwnProperty('_entry');\n } catch (error) {\n return false;\n }\n}\n","import { DataFrame, FieldType, isValidGoDuration, Labels } from '@grafana/data';\n\nimport { isBytesString, processLabels } from './languageUtils';\nimport { isLogLineJSON, isLogLineLogfmt, isLogLinePacked } from './lineParser';\nimport { LabelType } from './types';\n\nexport function dataFrameHasLokiError(frame: DataFrame): boolean {\n const labelSets: Labels[] = frame.fields.find((f) => f.name === 'labels')?.values ?? [];\n return labelSets.some((labels) => labels.__error__ !== undefined);\n}\n\nexport function dataFrameHasLevelLabel(frame: DataFrame): boolean {\n const labelSets: Labels[] = frame.fields.find((f) => f.name === 'labels')?.values ?? [];\n return labelSets.some((labels) => labels.level !== undefined);\n}\n\nexport function extractLogParserFromDataFrame(frame: DataFrame): {\n hasLogfmt: boolean;\n hasJSON: boolean;\n hasPack: boolean;\n} {\n const lineField = frame.fields.find((field) => field.type === FieldType.string);\n if (lineField == null) {\n return { hasJSON: false, hasLogfmt: false, hasPack: false };\n }\n\n const logLines: string[] = lineField.values;\n\n let hasJSON = false;\n let hasLogfmt = false;\n let hasPack = false;\n\n logLines.forEach((line) => {\n if (isLogLineJSON(line)) {\n hasJSON = true;\n\n hasPack = isLogLinePacked(line);\n }\n if (isLogLineLogfmt(line)) {\n hasLogfmt = true;\n }\n });\n\n return { hasLogfmt, hasJSON, hasPack };\n}\n\nexport function extractLabelKeysFromDataFrame(frame: DataFrame, type: LabelType = LabelType.Indexed): string[] {\n const labelsArray: Array<{ [key: string]: string }> | undefined =\n frame?.fields?.find((field) => field.name === 'labels')?.values ?? [];\n const labelTypeArray: Array<{ [key: string]: string }> | undefined =\n frame?.fields?.find((field) => field.name === 'labelTypes')?.values ?? [];\n\n if (!labelsArray?.length) {\n return [];\n }\n\n // if there are no label types and type is LabelType.Indexed return all label keys\n if (!labelTypeArray?.length) {\n if (type === LabelType.Indexed) {\n const { keys: labelKeys } = processLabels(labelsArray);\n return labelKeys;\n }\n return [];\n }\n\n // If we have label types, we can return only label keys that match type\n let labelsSet = new Set<string>();\n for (let i = 0; i < labelsArray.length; i++) {\n const labels = labelsArray[i];\n const labelsType = labelTypeArray[i];\n\n const allLabelKeys = Object.keys(labels).filter((key) => labelsType[key] === type);\n labelsSet = new Set([...labelsSet, ...allLabelKeys]);\n }\n\n return Array.from(labelsSet);\n}\n\nexport function extractUnwrapLabelKeysFromDataFrame(frame: DataFrame): string[] {\n const labelsArray: Array<{ [key: string]: string }> | undefined =\n frame?.fields?.find((field) => field.name === 'labels')?.values ?? [];\n\n if (!labelsArray?.length) {\n return [];\n }\n\n // We do this only for first label object, because we want to consider only labels that are present in all log lines\n // possibleUnwrapLabels are labels with 1. number value OR 2. value that is valid go duration OR 3. bytes string value\n const possibleUnwrapLabels = Object.keys(labelsArray[0]).filter((key) => {\n const value = labelsArray[0][key];\n if (!value) {\n return false;\n }\n return !isNaN(Number(value)) || isValidGoDuration(value) || isBytesString(value);\n });\n\n // Add only labels that are present in every line to unwrapLabels\n return possibleUnwrapLabels.filter((label) => labelsArray.every((obj) => obj[label]));\n}\n\nexport function extractHasErrorLabelFromDataFrame(frame: DataFrame): boolean {\n const labelField = frame.fields.find((field) => field.name === 'labels' && field.type === FieldType.other);\n if (labelField == null) {\n return false;\n }\n\n const labels: Array<{ [key: string]: string }> = labelField.values;\n return labels.some((label) => label['__error__']);\n}\n\nexport function extractLevelLikeLabelFromDataFrame(frame: DataFrame): string | null {\n const labelField = frame.fields.find((field) => field.name === 'labels' && field.type === FieldType.other);\n if (labelField == null) {\n return null;\n }\n\n // Depending on number of labels, this can be pretty heavy operation.\n // Let's just look at first 2 lines If needed, we can introduce more later.\n const labelsArray: Array<{ [key: string]: string }> = labelField.values.slice(0, 2);\n let levelLikeLabel: string | null = null;\n\n // Find first level-like label\n for (let labels of labelsArray) {\n const label = Object.keys(labels).find((label) => label === 'lvl' || label.includes('level'));\n if (label) {\n levelLikeLabel = label;\n break;\n }\n }\n return levelLikeLabel;\n}\n","import { CoreApp, DashboardLoadedEvent, DataQueryRequest, DataQueryResponse } from '@grafana/data';\nimport { QueryEditorMode } from '@grafana/experimental';\nimport { reportInteraction, config } from '@grafana/runtime';\n\nimport {\n REF_ID_STARTER_ANNOTATION,\n REF_ID_DATA_SAMPLES,\n REF_ID_STARTER_LOG_ROW_CONTEXT,\n REF_ID_STARTER_LOG_VOLUME,\n} from './datasource';\nimport pluginJson from './plugin.json';\nimport { getNormalizedLokiQuery, isLogsQuery, obfuscate } from './queryUtils';\nimport { variableRegex } from './querybuilder/parsingUtils';\nimport { LokiGroupedRequest, LokiQuery, LokiQueryType } from './types';\n\ntype LokiOnDashboardLoadedTrackingEvent = {\n grafana_version?: string;\n dashboard_id?: string;\n org_id?: number;\n\n /* The number of Loki queries present in the dashboard*/\n queries_count: number;\n\n /* The number of Loki logs queries present in the dashboard*/\n logs_queries_count: number;\n\n /* The number of Loki metric queries present in the dashboard*/\n metric_queries_count: number;\n\n /* The number of Loki instant queries present in the dashboard*/\n instant_queries_count: number;\n\n /* The number of Loki range queries present in the dashboard*/\n range_queries_count: number;\n\n /* The number of Loki queries created in builder mode present in the dashboard*/\n builder_mode_queries_count: number;\n\n /* The number of Loki queries created in code mode present in the dashboard*/\n code_mode_queries_count: number;\n\n /* The number of Loki queries with used template variables present in the dashboard*/\n queries_with_template_variables_count: number;\n\n /* The number of Loki queries with changed resolution present in the dashboard*/\n queries_with_changed_resolution_count: number;\n\n /* The number of Loki queries with changed line limit present in the dashboard*/\n queries_with_changed_line_limit_count: number;\n\n /* The number of Loki queries with changed legend present in the dashboard*/\n queries_with_changed_legend_count: number;\n};\n\nexport type LokiTrackingSettings = {\n predefinedOperations?: string;\n};\n\nexport const onDashboardLoadedHandler = ({\n payload: { dashboardId, orgId, grafanaVersion, queries },\n}: DashboardLoadedEvent<LokiQuery>) => {\n try {\n // We only want to track visible Loki queries\n const lokiQueries = queries[pluginJson.id]\n ?.filter((query) => !query.hide)\n ?.map((query) => getNormalizedLokiQuery(query));\n\n if (!lokiQueries?.length) {\n return;\n }\n\n const logsQueries = lokiQueries.filter((query) => isLogsQuery(query.expr));\n const metricQueries = lokiQueries.filter((query) => !isLogsQuery(query.expr));\n const instantQueries = lokiQueries.filter((query) => query.queryType === LokiQueryType.Instant);\n const rangeQueries = lokiQueries.filter((query) => query.queryType === LokiQueryType.Range);\n const builderModeQueries = lokiQueries.filter((query) => query.editorMode === QueryEditorMode.Builder);\n const codeModeQueries = lokiQueries.filter((query) => query.editorMode === QueryEditorMode.Code);\n const queriesWithTemplateVariables = lokiQueries.filter(isQueryWithTemplateVariables);\n const queriesWithChangedResolution = lokiQueries.filter(isQueryWithChangedResolution);\n const queriesWithChangedLineLimit = lokiQueries.filter(isQueryWithChangedLineLimit);\n const queriesWithChangedLegend = lokiQueries.filter(isQueryWithChangedLegend);\n\n const event: LokiOnDashboardLoadedTrackingEvent = {\n grafana_version: grafanaVersion,\n dashboard_id: dashboardId,\n org_id: orgId,\n queries_count: lokiQueries.length,\n logs_queries_count: logsQueries.length,\n metric_queries_count: metricQueries.length,\n instant_queries_count: instantQueries.length,\n range_queries_count: rangeQueries.length,\n builder_mode_queries_count: builderModeQueries.length,\n code_mode_queries_count: codeModeQueries.length,\n queries_with_template_variables_count: queriesWithTemplateVariables.length,\n queries_with_changed_resolution_count: queriesWithChangedResolution.length,\n queries_with_changed_line_limit_count: queriesWithChangedLineLimit.length,\n queries_with_changed_legend_count: queriesWithChangedLegend.length,\n };\n\n reportInteraction('grafana_loki_dashboard_loaded', event);\n } catch (error) {\n console.error('error in loki tracking handler', error);\n }\n};\n\nconst isQueryWithTemplateVariables = (query: LokiQuery): boolean => {\n return variableRegex.test(query.expr);\n};\n\nconst isQueryWithChangedResolution = (query: LokiQuery): boolean => {\n if (!query.resolution) {\n return false;\n }\n // 1 is the default resolution\n return query.resolution !== 1;\n};\n\nconst isQueryWithChangedLineLimit = (query: LokiQuery): boolean => {\n return query.maxLines !== null && query.maxLines !== undefined;\n};\n\nconst isQueryWithChangedLegend = (query: LokiQuery): boolean => {\n if (!query.legendFormat) {\n return false;\n }\n return query.legendFormat !== '';\n};\n\nconst shouldNotReportBasedOnRefId = (refId: string): boolean => {\n const starters = [REF_ID_STARTER_ANNOTATION, REF_ID_STARTER_LOG_ROW_CONTEXT, REF_ID_STARTER_LOG_VOLUME];\n\n if (refId === REF_ID_DATA_SAMPLES || starters.some((starter) => refId.startsWith(starter))) {\n return true;\n }\n return false;\n};\n\nconst calculateTotalBytes = (response: DataQueryResponse): number => {\n let totalBytes = 0;\n for (const frame of response.data) {\n const byteKey = frame.meta?.custom?.lokiQueryStatKey;\n if (byteKey) {\n totalBytes +=\n frame.meta?.stats?.find((stat: { displayName: string }) => stat.displayName === byteKey)?.value ?? 0;\n }\n }\n return totalBytes;\n};\n\nexport function trackQuery(\n response: DataQueryResponse,\n request: DataQueryRequest<LokiQuery>,\n startTime: Date,\n trackingSettings: LokiTrackingSettings = {},\n extraPayload: Record<string, unknown> = {}\n): void {\n // We only want to track usage for these specific apps\n const { app, targets: queries } = request;\n\n if (app === CoreApp.Dashboard || app === CoreApp.PanelViewer) {\n return;\n }\n\n let totalBytes = calculateTotalBytes(response);\n\n for (const query of queries) {\n if (shouldNotReportBasedOnRefId(query.refId)) {\n return;\n }\n\n reportInteraction('grafana_loki_query_executed', {\n app,\n grafana_version: config.buildInfo.version,\n editor_mode: query.editorMode,\n has_data: response.data.some((frame) => frame.length > 0),\n has_error: response.error !== undefined,\n legend: query.legendFormat,\n line_limit: query.maxLines,\n obfuscated_query: obfuscate(query.expr),\n query_type: isLogsQuery(query.expr) ? 'logs' : 'metric',\n query_vector_type: query.queryType,\n resolution: query.resolution,\n simultaneously_executed_query_count: queries.filter((query) => !query.hide).length,\n simultaneously_hidden_query_count: queries.filter((query) => query.hide).length,\n time_range_from: request?.range?.from?.toISOString(),\n time_range_to: request?.range?.to?.toISOString(),\n time_taken: Date.now() - startTime.getTime(),\n bytes_processed: totalBytes,\n is_split: false,\n predefined_operations_applied: trackingSettings.predefinedOperations\n ? query.expr.includes(trackingSettings.predefinedOperations)\n : 'n/a',\n ...extraPayload,\n });\n }\n}\n\nexport function trackGroupedQueries(\n response: DataQueryResponse,\n groupedRequests: LokiGroupedRequest[],\n originalRequest: DataQueryRequest<LokiQuery>,\n startTime: Date,\n trackingSettings: LokiTrackingSettings = {}\n): void {\n const splittingPayload = {\n split_query_group_count: groupedRequests.length,\n split_query_largest_partition_size: Math.max(...groupedRequests.map(({ partition }) => partition.length)),\n split_query_total_request_count: groupedRequests.reduce((total, { partition }) => total + partition.length, 0),\n is_split: true,\n simultaneously_executed_query_count: originalRequest.targets.filter((query) => !query.hide).length,\n simultaneously_hidden_query_count: originalRequest.targets.filter((query) => query.hide).length,\n };\n\n for (const group of groupedRequests) {\n const split_query_partition_size = group.partition.length;\n trackQuery(response, group.request, startTime, trackingSettings, {\n ...splittingPayload,\n split_query_partition_size,\n });\n }\n}\n","export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;","import REGEX from './regex.js';\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\n\nexport default validate;","import { LRParser } from '@lezer/lr';\n\n// This file was generated by lezer-generator. You probably shouldn't edit it.\nconst Json$1 = 1,\n Logfmt$1 = 2,\n Unpack$1 = 3,\n Pattern$1 = 4,\n Regexp$1 = 5,\n Unwrap$1 = 6,\n LabelFormat$1 = 7,\n LineFormat$1 = 8,\n LabelReplace$1 = 9,\n Vector$1 = 10,\n Offset$1 = 11,\n Bool$1 = 12,\n On$1 = 13,\n Ignoring$1 = 14,\n GroupLeft$1 = 15,\n GroupRight$1 = 16,\n Decolorize$1 = 17,\n Drop$1 = 18,\n Keep$1 = 19,\n By$1 = 20,\n Without$1 = 21,\n And$1 = 22,\n Or$1 = 23,\n Unless$1 = 24,\n Sum$1 = 25,\n Avg$1 = 26,\n Count$1 = 27,\n Max$1 = 28,\n Min$1 = 29,\n Stddev$1 = 30,\n Stdvar$1 = 31,\n Bottomk$1 = 32,\n Topk$1 = 33,\n Sort$1 = 34,\n Sort_Desc$1 = 35,\n MetricExpr$1 = 93;\n\nconst keywordTokens = {\n json: Json$1,\n logfmt: Logfmt$1,\n unpack: Unpack$1,\n pattern: Pattern$1,\n regexp: Regexp$1,\n label_format: LabelFormat$1,\n line_format: LineFormat$1,\n label_replace: LabelReplace$1,\n vector: Vector$1,\n offset: Offset$1,\n bool: Bool$1,\n on: On$1,\n ignoring: Ignoring$1,\n group_left: GroupLeft$1,\n group_right: GroupRight$1,\n unwrap: Unwrap$1,\n decolorize: Decolorize$1,\n drop: Drop$1,\n keep: Keep$1,\n};\n\nconst specializeIdentifier = (value) => {\n return keywordTokens[value.toLowerCase()] || -1;\n};\n\nconst contextualKeywordTokens = {\n by: By$1,\n without: Without$1,\n and: And$1,\n or: Or$1,\n unless: Unless$1,\n sum: Sum$1,\n avg: Avg$1,\n count: Count$1,\n max: Max$1,\n min: Min$1,\n stddev: Stddev$1,\n stdvar: Stdvar$1,\n bottomk: Bottomk$1,\n topk: Topk$1,\n sort: Sort$1,\n sort_desc: Sort_Desc$1,\n};\n\nconst extendIdentifier = (value) => {\n return contextualKeywordTokens[value.toLowerCase()] || -1;\n};\n\n// This file was generated by lezer-generator. You probably shouldn't edit it.\nconst spec_Identifier = {__proto__:null,ip:291, count_over_time:297, rate:299, rate_counter:301, bytes_over_time:303, bytes_rate:305, avg_over_time:307, sum_over_time:309, min_over_time:311, max_over_time:313, stddev_over_time:315, stdvar_over_time:317, quantile_over_time:319, first_over_time:321, last_over_time:323, absent_over_time:325, bytes:331, duration:333, duration_seconds:335};\nconst parser = LRParser.deserialize({\n version: 14,\n states: \"EtOYQPOOO#cQPO'#DUO$rQPO'#DTOYQPO'#DTOOQO'#E_'#E_O%PQPO'#E^OOQO'#Ez'#EzO%UQPO'#EyQ%aQPOOOOQO'#FY'#FYO&bQPO'#FYO&gQPO'#FZO&lQPO'#F[OOQO'#E]'#E]OOQO'#DS'#DSOOQO'#E`'#E`OOQO'#Ea'#EaOOQO'#Eb'#EbOOQO'#Ec'#EcOOQO'#Ed'#EdOOQO'#Ee'#EeOOQO'#Ef'#EfOOQO'#Eg'#EgOOQO'#Eh'#EhOOQO'#Ei'#EiOOQO'#Ej'#EjOOQO'#Ek'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Q$O!uR%W$QS#|!t#}W$z#y#{%R%SQ%u$yQ%|%TR&Z%{Q%Q#|Q%u$zQ&]%|R&e&ZQ#{!tS$y#y%RQ%P#|Q%S#}S%x$}%QS&Y%z%|R&f&]R%q$xR%o$xQ}VQ%V$PQ%Z$UQ&^%}R&_&PR$S!xwVOR|!V!{#P#Q#R#S#T#U$V%]&r&s&t&u&v&wQ#P!OQ#Q!PQ#R!QQ#S!RQ#T!SQ#U!TQ&r&xQ&s&yQ&t&zQ&u&{Q&v&|R&w&}h!}!O!P!Q!R!S!T&x&y&z&{&|&}R$]#OQ$Z!|Q%b$[R&T%cR%_$YQ%`$YR&`&R\",\n nodeNames: \"âš Json Logfmt Unpack Pattern Regexp Unwrap LabelFormat LineFormat LabelReplace Vector Offset Bool On Ignoring GroupLeft GroupRight Decolorize Drop Keep By Without And Or Unless Sum Avg Count Max Min Stddev Stdvar Bottomk Topk Sort Sort_Desc LineComment LogQL Expr LogExpr Selector Matchers Matcher Identifier Eq String Neq Re Nre PipelineExpr PipelineStage LineFilters LineFilter Filter PipeExact PipeMatch FilterOp Ip OrFilter Pipe LogfmtParser LogfmtParserFlags ParserFlag LabelParser JsonExpressionParser LabelExtractionExpressionList LabelExtractionExpression LogfmtExpressionParser LabelFilter IpLabelFilter UnitFilter DurationFilter Gtr Duration Gte Lss Lte Eql BytesFilter Bytes NumberFilter Number LineFormatExpr LabelFormatExpr LabelsFormat LabelFormatMatcher DecolorizeExpr DropLabelsExpr DropLabels DropLabel KeepLabelsExpr KeepLabels KeepLabel MetricExpr RangeAggregationExpr RangeOp CountOverTime Rate RateCounter BytesOverTime BytesRate AvgOverTime SumOverTime MinOverTime MaxOverTime StddevOverTime StdvarOverTime QuantileOverTime FirstOverTime LastOverTime AbsentOverTime LogRangeExpr Range OffsetExpr UnwrapExpr ConvOp BytesConv DurationConv DurationSecondsConv Grouping Labels VectorAggregationExpr VectorOp BinOpExpr BinOpModifier OnOrIgnoringModifier GroupingLabels GroupingLabelList Grouping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#[#]-{#_#`/x#a#b0R#d#e/x#g#h/T#h#i/x#k#l0d#m#n1O~,oT{|)^}!O)^!Q![)d!d!e-O#]#^-T~-TO!q~~-WP#U#V-O~-^Q!d!e-O#]#^-T~-iP!k~!Q![-l~-oS!Q![-l#[#]-{#a#b.a#g#h/T~.QP!k~!Q![.T~.WR!Q![.T#a#b.a#g#h/T~.fQ!k~!Q![.l#g#h/O~.oR!Q![.l#a#b.x#g#h/T~.{P#g#h/O~/TO!k~~/YP!k~!Q![/]~/`Q!Q![/]#a#b.x~/iT{|)^}!O)^!Q![)d#U#V-O#]#^-T~/{Q#U#V-O#]#^-T~0WS!k~!Q![.l#U#V-O#]#^-T#g#h/O~0iP!k~!Q![0l~0oT!Q![0l#W#X-d#[#]-{#a#b.a#g#h/T~1TP!k~!Q![1W~1ZU!Q![1W#W#X-d#[#]-{#a#b.a#g#h/T#k#l0d~1pR!Q![1y!c!i1y#T#Z1y~2OR!s~!Q![1y!c!i1y#T#Z1yP2^T{P!Q![2X![!]2X!c!}2X#R#S2X#T#o2X~2rP!m~!_!`2u~2zO!n~~3PQ|~!_!`3V#r#s3[~3[O!o~~3aO!P~~3fP!j~!_!`3i~3nO!l~R3uT{P#uQ!Q![3n![!]2X!c!}3n#R#S3n#T#o3n~4ZO$i~~4`O$j~~4eO#{~~4hRO#S4e#S#T%W#T~4e~4vO$S~~4{Q!]~!_!`5R#r#s5W~5WO!W~~5]O!X~~5bO$U~\",\n tokenizers: [0, 1],\n topRules: {\"LogQL\":[0,37]},\n specialized: [{term: 43, get: (value, stack) => (specializeIdentifier(value) << 1)},{term: 43, get: (value, stack) => (extendIdentifier(value) << 1) | 1},{term: 43, get: value => spec_Identifier[value] || -1}],\n tokenPrec: 0\n});\n// This file was generated by lezer-generator. You probably shouldn't edit it.\nconst Json = 1,\n Logfmt = 2,\n Unpack = 3,\n Pattern = 4,\n Regexp = 5,\n Unwrap = 6,\n LabelFormat = 7,\n LineFormat = 8,\n LabelReplace = 9,\n Vector = 10,\n Offset = 11,\n Bool = 12,\n On = 13,\n Ignoring = 14,\n GroupLeft = 15,\n GroupRight = 16,\n Decolorize = 17,\n Drop = 18,\n Keep = 19,\n By = 20,\n Without = 21,\n And = 22,\n Or = 23,\n Unless = 24,\n Sum = 25,\n Avg = 26,\n Count = 27,\n Max = 28,\n Min = 29,\n Stddev = 30,\n Stdvar = 31,\n Bottomk = 32,\n Topk = 33,\n Sort = 34,\n Sort_Desc = 35,\n LineComment = 36,\n LogQL = 37,\n Expr = 38,\n LogExpr = 39,\n Selector = 40,\n Matchers = 41,\n Matcher = 42,\n Identifier = 43,\n Eq = 44,\n String = 45,\n Neq = 46,\n Re = 47,\n Nre = 48,\n PipelineExpr = 49,\n PipelineStage = 50,\n LineFilters = 51,\n LineFilter = 52,\n Filter = 53,\n PipeExact = 54,\n PipeMatch = 55,\n FilterOp = 56,\n Ip = 57,\n OrFilter = 58,\n Pipe = 59,\n LogfmtParser = 60,\n LogfmtParserFlags = 61,\n ParserFlag = 62,\n LabelParser = 63,\n JsonExpressionParser = 64,\n LabelExtractionExpressionList = 65,\n LabelExtractionExpression = 66,\n LogfmtExpressionParser = 67,\n LabelFilter = 68,\n IpLabelFilter = 69,\n UnitFilter = 70,\n DurationFilter = 71,\n Gtr = 72,\n Duration = 73,\n Gte = 74,\n Lss = 75,\n Lte = 76,\n Eql = 77,\n BytesFilter = 78,\n Bytes = 79,\n NumberFilter = 80,\n Number = 81,\n LineFormatExpr = 82,\n LabelFormatExpr = 83,\n LabelsFormat = 84,\n LabelFormatMatcher = 85,\n DecolorizeExpr = 86,\n DropLabelsExpr = 87,\n DropLabels = 88,\n DropLabel = 89,\n KeepLabelsExpr = 90,\n KeepLabels = 91,\n KeepLabel = 92,\n MetricExpr = 93,\n RangeAggregationExpr = 94,\n RangeOp = 95,\n CountOverTime = 96,\n Rate = 97,\n RateCounter = 98,\n BytesOverTime = 99,\n BytesRate = 100,\n AvgOverTime = 101,\n SumOverTime = 102,\n MinOverTime = 103,\n MaxOverTime = 104,\n StddevOverTime = 105,\n StdvarOverTime = 106,\n QuantileOverTime = 107,\n FirstOverTime = 108,\n LastOverTime = 109,\n AbsentOverTime = 110,\n LogRangeExpr = 111,\n Range = 112,\n OffsetExpr = 113,\n UnwrapExpr = 114,\n ConvOp = 115,\n BytesConv = 116,\n DurationConv = 117,\n DurationSecondsConv = 118,\n Grouping = 119,\n Labels = 120,\n VectorAggregationExpr = 121,\n VectorOp = 122,\n BinOpExpr = 123,\n BinOpModifier = 124,\n OnOrIgnoringModifier = 125,\n GroupingLabels = 126,\n GroupingLabelList = 127,\n GroupingLabel = 128,\n LabelName = 129,\n Add = 130,\n Sub = 131,\n Mul = 132,\n Div = 133,\n Mod = 134,\n Pow = 135,\n LiteralExpr = 136,\n LabelReplaceExpr = 137,\n VectorExpr = 138;\n\nfunction getNodeFromQuery(query, nodeType) {\n const nodes = [];\n const tree = parser.parse(query);\n tree.iterate({\n enter: (node) => {\n if (nodeType === undefined || nodeType === node.type.id) {\n nodes.push(node.node);\n }\n },\n });\n return nodes[0];\n}\n\nfunction isLogsQuery(query) {\n if (getNodeFromQuery(query, MetricExpr$1)) {\n return false;\n }\n return true;\n}\n\nfunction indent(level) {\n return ' '.repeat(level);\n}\n\nfunction indentMultiline(block, level) {\n const lines = block.split('\\n');\n return lines.map((line) => indent(level) + line).join('\\n');\n}\n\nfunction trimMultiline(block) {\n const lines = block.split('\\n');\n return lines.map((line) => line.trimEnd()).join('\\n');\n}\n\nfunction needsBrackets(node, queryType) {\n const childNodeIsSame = node.firstChild?.type.id === queryType;\n let addBrackets = false;\n\n if (node.firstChild && childNodeIsSame) {\n addBrackets = true;\n node = node.firstChild;\n }\n\n return { addBrackets, newNode: node };\n}\n\nfunction iterateNode(node, lookingFor) {\n const nodes = [];\n let child = node.firstChild;\n\n while (child) {\n if (lookingFor.includes(child.type.id)) {\n nodes.push(child);\n }\n\n nodes.push(...iterateNode(child, lookingFor));\n child = child.nextSibling;\n }\n\n return nodes;\n}\n\nfunction buildResponse(pipelineType, lastPipelineType, formattedNode) {\n if (lastPipelineType === pipelineType) {\n return ` ${formattedNode}`;\n }\n\n return `\\n${indent(1)}${formattedNode}`;\n}\n\nfunction trimEnd(input, charactersToTrim) {\n let endIndex = input.length - 1;\n while (endIndex >= 0 && charactersToTrim.includes(input[endIndex])) {\n endIndex--;\n }\n return input.substring(0, endIndex + 1);\n}\n\nconst formatLogExpr = (node, query) => {\n const { addBrackets, newNode } = needsBrackets(node, LogExpr);\n node = newNode;\n\n const tree = parser.parse(query.substring(node.from, node.to));\n let formatted = '';\n\n tree.iterate({\n enter: (ref) => {\n const node = ref.node;\n\n switch (node.type.id) {\n case Selector:\n formatted += formatSelector(node, query);\n break;\n\n case PipelineExpr:\n node.parent?.type.id !== PipelineExpr && (formatted += formatPipelineExpr(node, query));\n break;\n }\n },\n });\n\n return addBrackets ? '(' + formatted + ')' : formatted;\n};\n\nfunction formatSelector(node, query) {\n const selector = query.substring(node.from, node.to);\n const subtree = parser.parse(selector);\n const labelNodes = [];\n let response = '';\n\n subtree.iterate({\n enter: (ref) => {\n const node = ref.node;\n if (node.type.id === Matcher) {\n labelNodes.push(node);\n }\n },\n });\n\n labelNodes.sort((a, b) => {\n const labelNodeA = a.getChild(Identifier);\n const labelNodeB = b.getChild(Identifier);\n\n const labelValueA = labelNodeA && query.substring(labelNodeA.from, labelNodeA.to);\n const labelValueB = labelNodeB && query.substring(labelNodeB.from, labelNodeB.to);\n\n if (!labelValueA || !labelValueB) {\n return 0;\n }\n\n if (labelValueA < labelValueB) {\n return -1;\n }\n\n if (labelValueA > labelValueB) {\n return 1;\n }\n\n return 0;\n });\n\n labelNodes.forEach((node) => {\n const labelNode = node.getChild(Identifier);\n const operatorNode = labelNode ? labelNode.nextSibling : null;\n const valueNode = node.getChild(String);\n\n const label = labelNode ? query.substring(labelNode.from, labelNode.to) : null;\n const operator = operatorNode ? query.substring(operatorNode.from, operatorNode.to) : null;\n const value = valueNode ? query.substring(valueNode.from, valueNode.to) : null;\n\n response += `${label}${operator}${value}, `;\n });\n\n return '{' + trimEnd(response, ', ') + '}';\n}\n\nfunction formatPipelineExpr(node, query) {\n const pipelineExprNodes = [\n LineFilter,\n LabelParser,\n LogfmtParser,\n LabelFilter,\n JsonExpressionParser,\n LineFormatExpr,\n LabelFormatExpr,\n DecolorizeExpr,\n ];\n let lastPipelineType;\n let response = '';\n\n iterateNode(node, pipelineExprNodes).forEach((node) => {\n switch (node.type.id) {\n case LineFilter:\n response += buildResponse(LineFilter, lastPipelineType, formatLineFilter(node, query));\n lastPipelineType = LineFilter;\n break;\n\n case LabelParser:\n response += buildResponse(LabelParser, lastPipelineType, formatLabelParser(node, query));\n lastPipelineType = LabelParser;\n break;\n\n case LogfmtParser:\n response += buildResponse(LogfmtParser, lastPipelineType, formatLabelParser(node, query));\n lastPipelineType = LogfmtParser;\n break;\n\n case JsonExpressionParser:\n response += buildResponse(JsonExpressionParser, lastPipelineType, formatJsonExpressionParser(node, query));\n lastPipelineType = JsonExpressionParser;\n break;\n\n case LabelFilter:\n response += buildResponse(LabelFilter, lastPipelineType, formatLabelFilter(node, query));\n lastPipelineType = LabelFilter;\n break;\n\n case LineFormatExpr:\n response += buildResponse(LineFormatExpr, lastPipelineType, formatLineFormatExpr(node, query));\n lastPipelineType = LineFormatExpr;\n break;\n\n case LabelFormatExpr:\n response += buildResponse(LabelFormatExpr, lastPipelineType, formatLabelFormatExpr(node, query));\n lastPipelineType = LabelFormatExpr;\n break;\n\n case DecolorizeExpr:\n response += buildResponse(DecolorizeExpr, lastPipelineType, formatDecolorizeExpr());\n lastPipelineType = DecolorizeExpr;\n break;\n }\n });\n\n return response;\n}\n\nfunction formatLineFilter(node, query) {\n const filterNode = node.getChild(Filter);\n const filterOperationNode = node.getChild(FilterOp);\n const stringNode = node.getChild(String);\n\n const filter = filterNode && query.substring(filterNode.from, filterNode.to);\n const string = stringNode && query.substring(stringNode.from, stringNode.to);\n\n if (filterOperationNode) {\n return `${filter} ip(${string})`;\n }\n return `${filter} ${string}`;\n}\n\nfunction formatLabelParser(node, query) {\n const hasString = node.getChild(String);\n\n if (hasString) {\n const parserNode = node.getChild(Regexp) || node.getChild(Pattern);\n const stringNode = node.getChild(String);\n\n const parser = parserNode && query.substring(parserNode.from, parserNode.to);\n const string = stringNode && query.substring(stringNode.from, stringNode.to);\n\n return `| ${parser}${string}`;\n }\n\n const labelParser = query.substring(node.from, node.to);\n return `| ${labelParser}`;\n}\n\nfunction formatJsonExpressionParser(node, query) {\n const jsonExpressionNodes = iterateNode(node, [LabelExtractionExpression]);\n let response = '';\n\n jsonExpressionNodes.forEach((node) => {\n const identifierNode = node.getChild(Identifier);\n const valueNode = node.getChild(String);\n\n const identifier = identifierNode && query.substring(identifierNode.from, identifierNode.to);\n const value = valueNode && query.substring(valueNode.from, valueNode.to);\n\n response += `${identifier}=${value}, `;\n });\n\n return `| json ${trimEnd(response, ', ')}`;\n}\n\nfunction formatLabelFilter(node, query) {\n const selectedFilter =\n node.getChild(Matcher) ||\n node.getChild(IpLabelFilter) ||\n node.getChild(NumberFilter) ||\n node.getChild(UnitFilter)?.getChild(DurationFilter) ||\n node.getChild(UnitFilter)?.getChild(BytesFilter);\n\n if (!selectedFilter) {\n return '';\n }\n\n const selectedFilterType = selectedFilter.type.id;\n\n const identifierNode = selectedFilter.getChild(Identifier);\n const operatorNode = identifierNode && identifierNode.nextSibling;\n let valueNode;\n\n if (selectedFilterType === DurationFilter) {\n valueNode = selectedFilter.getChild(Duration);\n } else if (selectedFilterType === BytesFilter) {\n valueNode = selectedFilter.getChild(Bytes);\n } else if (selectedFilterType === NumberFilter) {\n valueNode = selectedFilter.getChild(Number);\n } else {\n valueNode = selectedFilter.getChild(String);\n }\n\n const identifier = identifierNode && query.substring(identifierNode.from, identifierNode.to);\n const operator = operatorNode && query.substring(operatorNode.from, operatorNode.to);\n const value = valueNode && query.substring(valueNode.from, valueNode.to);\n\n if (selectedFilterType === IpLabelFilter) {\n return `| ${identifier}${operator}ip(${value})`;\n }\n\n return `| ${identifier}${operator}${value}`;\n}\n\nfunction formatLineFormatExpr(node, query) {\n const stringNode = node.getChild(String);\n const string = stringNode && query.substring(stringNode.from, stringNode.to);\n return `| line_format ${string}`;\n}\n\nfunction formatLabelFormatExpr(node, query) {\n const labelFormatMatcherNodes = iterateNode(node, [LabelFormatMatcher]);\n let response = '| label_format ';\n\n labelFormatMatcherNodes.forEach((labelFormatMatcherNode) => {\n let identifierNode;\n let valueNode;\n\n if (labelFormatMatcherNode.getChildren(Identifier).length === 2) {\n [identifierNode, valueNode] = labelFormatMatcherNode.getChildren(Identifier);\n } else {\n identifierNode = labelFormatMatcherNode.getChild(Identifier);\n valueNode = labelFormatMatcherNode.getChild(String);\n }\n\n const identifier = identifierNode && query.substring(identifierNode.from, identifierNode.to);\n const value = valueNode && query.substring(valueNode.from, valueNode.to);\n\n response += `${identifier}=${value}, `;\n });\n\n return trimEnd(response, ', ');\n}\n\nfunction formatDecolorizeExpr() {\n return `| decolorize`;\n}\n\nconst formatMetricExpr = (node, query) => {\n const { addBrackets, newNode } = needsBrackets(node, MetricExpr);\n node = newNode;\n let formatted = '';\n\n const childNode = node.firstChild;\n switch (childNode && childNode.type.id) {\n case RangeAggregationExpr:\n formatted = formatRangeAggregationExpr(node, query);\n break;\n\n case VectorAggregationExpr:\n formatted = formatVectorAggregationExpr(node, query);\n break;\n\n case BinOpExpr:\n formatted = formatBinOpExpr(node, query);\n break;\n\n case LiteralExpr:\n formatted = formatLiteralExpr(node, query);\n break;\n\n case LabelReplaceExpr:\n formatted = formatLabelReplaceExpr(node, query);\n break;\n\n case VectorExpr:\n formatted = formatVectorExpr(node, query);\n break;\n }\n\n return addBrackets ? '(' + formatted + ')' : formatted;\n};\n\nfunction formatRangeAggregationExpr(node, query) {\n let response = '';\n\n iterateNode(node, [RangeOp, Number, LogRangeExpr, Grouping]).forEach((node) => {\n if (node.parent?.type.id !== RangeAggregationExpr) {\n return;\n }\n\n switch (node.type.id) {\n case RangeOp:\n response += `${query.substring(node.from, node.to)}(\\n`;\n break;\n\n case Number:\n response += `${indent(1) + query.substring(node.from, node.to)},\\n`;\n break;\n\n case LogRangeExpr:\n response += formatLogRangeExpr(node, query);\n break;\n\n case Grouping:\n response += formatGrouping(node, query);\n break;\n }\n });\n\n return response;\n}\n\nfunction formatLogRangeExpr(node, query) {\n const nodes = [];\n let selector = '';\n let pipeline = '';\n let range = '';\n let offset = '';\n let unwrap = '';\n\n iterateNode(node, [Selector, Range, OffsetExpr, UnwrapExpr, PipelineExpr]).forEach((node) => {\n if (node.parent?.type.id !== LogRangeExpr) {\n return;\n }\n\n nodes.push(node);\n\n switch (node.type.id) {\n case Selector: {\n let logExpr = query.substring(node.from, node.to);\n selector += formatSelector({ ...node, from: 0, to: logExpr.length }, logExpr);\n break;\n }\n\n case PipelineExpr:\n pipeline += formatPipelineExpr(node, query);\n break;\n\n case Range:\n range += query.substring(node.from, node.to);\n break;\n\n case OffsetExpr: {\n const durationNode = node.getChild(Duration);\n offset += ` offset ${durationNode ? query.substring(durationNode.from, durationNode.to) : ''}`;\n break;\n }\n\n case UnwrapExpr:\n iterateNode(node, [Identifier, ConvOp, LabelFilter]).forEach((node, _, arr) => {\n switch (node.type.id) {\n case Identifier: {\n if (node.parent?.type.id !== UnwrapExpr) {\n return;\n }\n\n const hasConvOp = arr.find((node) => node.type.id === ConvOp);\n\n if (hasConvOp) {\n return;\n }\n\n unwrap += `| unwrap ${query.substring(node.from, node.to)} `;\n return;\n }\n\n case ConvOp: {\n const identifierNode = arr.find((node) => node.type.id === Identifier);\n const identifier = identifierNode ? query.substring(identifierNode.from, identifierNode.to) : '';\n unwrap += `| unwrap ${query.substring(node.from, node.to)}(${identifier}) `;\n return;\n }\n\n case LabelFilter:\n unwrap += formatLabelFilter(node, query);\n return;\n }\n });\n break;\n }\n });\n\n let response = '';\n nodes.forEach((node, index, array) => {\n const previousNode = array[index - 1];\n\n if (node.type.id === Selector) {\n response += indent(1) + selector;\n }\n\n if (node.type.id === PipelineExpr) {\n response += indentMultiline(pipeline, 1);\n }\n\n if (node.type.id === Range) {\n response += '\\n' + indent(1) + range;\n }\n\n if (node.type.id === OffsetExpr) {\n response += offset;\n }\n\n if (node.type.id === UnwrapExpr) {\n if (previousNode?.type.id !== OffsetExpr && previousNode?.type.id !== Range) {\n response += '\\n' + indent(1) + unwrap;\n } else {\n response += ' ' + unwrap;\n }\n }\n });\n\n return (response += '\\n)');\n}\n\nfunction formatGrouping(node, query) {\n let response = '';\n\n const labels = iterateNode(node, [Identifier]).map((node) => {\n return query.substring(node.from, node.to);\n });\n\n iterateNode(node, [By, Without]).forEach((node) => {\n if (node.parent?.type.id !== Grouping) {\n return;\n }\n\n switch (node.type.id) {\n case By:\n response = ` by (${labels.join(', ')}) `;\n break;\n\n case Without:\n response = ` without (${labels.join(', ')}) `;\n break;\n }\n });\n\n return response;\n}\n\nfunction formatVectorAggregationExpr(node, query) {\n let response = '';\n\n iterateNode(node, [VectorOp, Number, MetricExpr, Grouping]).forEach((node, _, arr) => {\n if (node.parent?.type.id !== VectorAggregationExpr) {\n return;\n }\n\n switch (node.type.id) {\n case VectorOp:\n response += `${query.substring(node.from, node.to)}`;\n break;\n\n case Number:\n response += `(\\n`;\n response += `${indent(1) + query.substring(node.from, node.to)},\\n`;\n break;\n\n case MetricExpr: {\n const hasNumber = arr.find((node) => node.type.id === Number && node.parent?.type.id === VectorAggregationExpr);\n response += hasNumber ? '' : '(\\n';\n\n const metricExpr = query.substring(node.from, node.to);\n const metricNode = getNodeFromQuery(metricExpr, MetricExpr);\n response += indentMultiline(formatMetricExpr(metricNode, metricExpr), 1);\n response += '\\n)';\n break;\n }\n\n case Grouping:\n response += formatGrouping(node, query);\n break;\n }\n });\n\n return response;\n}\n\nfunction formatBinOpExpr(node, query) {\n let operator;\n\n const [leftExpr, rightExpr] = iterateNode(node, [Expr]).map((node, idx) => {\n if (idx === 0) {\n operator = query.substring(node.nextSibling?.from ?? 0, node.nextSibling?.to);\n }\n\n const expr = query.substring(node.from, node.to);\n let expressionNode;\n\n if (isLogsQuery(expr)) {\n expressionNode = getNodeFromQuery(expr, LogExpr);\n return formatLogExpr(expressionNode, expr);\n } else {\n expressionNode = getNodeFromQuery(expr, MetricExpr);\n return formatMetricExpr(expressionNode, expr);\n }\n });\n\n return leftExpr + '\\n' + operator + '\\n' + rightExpr;\n}\n\nfunction formatLiteralExpr(node, query) {\n node = node.getChild(LiteralExpr) ?? node;\n const addNode = node.getChild(Add);\n const subNode = node.getChild(Sub);\n const numberNode = node.getChild(Number);\n\n if (!numberNode) {\n return '';\n }\n\n if (addNode) {\n return `+${query.substring(numberNode.from, numberNode.to)}`;\n }\n\n if (subNode) {\n return `-${query.substring(numberNode.from, numberNode.to)}`;\n }\n\n return query.substring(numberNode.from, numberNode.to);\n}\n\nfunction formatLabelReplaceExpr(node, query) {\n let response = 'label_replace(\\n';\n\n iterateNode(node, [MetricExpr, String]).forEach((node) => {\n if (node.parent?.type.id !== LabelReplaceExpr) {\n return;\n }\n\n if (node.type.id === MetricExpr) {\n const metricExpr = query.substring(node.from, node.to);\n const metricNode = getNodeFromQuery(metricExpr, MetricExpr);\n response += indentMultiline(formatMetricExpr(metricNode, metricExpr), 1) + ',\\n';\n } else {\n response += indent(1) + query.substring(node.from, node.to) + ',\\n';\n }\n });\n\n return trimEnd(response, ',\\n') + '\\n)';\n}\n\nfunction formatVectorExpr(node, query) {\n node = node.getChild(VectorExpr) ?? node;\n const numberNode = node.getChild(Number);\n\n if (!numberNode) {\n return '';\n }\n\n return `vector(${query.substring(numberNode.from, numberNode.to)})`;\n}\n\n/**\n * @experimental This feature is subject to change or removal in future versions.\n */\nconst formatLokiQuery = (query) => {\n const tree = parser.parse(query);\n let formatted = '';\n\n tree.iterate({\n enter: (ref) => {\n const node = ref.node;\n\n if (node.parent?.type.id !== Expr || node.parent?.parent?.type.id === BinOpExpr) {\n return;\n }\n\n switch (node.type.id) {\n case MetricExpr:\n formatted = formatMetricExpr(node, query);\n return false;\n\n case LogExpr:\n formatted = formatLogExpr(node, query);\n return false;\n }\n },\n });\n\n return trimMultiline(formatted);\n};\n\nexport { AbsentOverTime, Add, And, Avg, AvgOverTime, BinOpExpr, BinOpModifier, Bool, Bottomk, By, Bytes, BytesConv, BytesFilter, BytesOverTime, BytesRate, ConvOp, Count, CountOverTime, Decolorize, DecolorizeExpr, Div, Drop, DropLabel, DropLabels, DropLabelsExpr, Duration, DurationConv, DurationFilter, DurationSecondsConv, Eq, Eql, Expr, Filter, FilterOp, FirstOverTime, GroupLeft, GroupRight, Grouping, GroupingLabel, GroupingLabelList, GroupingLabels, Gte, Gtr, Identifier, Ignoring, Ip, IpLabelFilter, Json, JsonExpressionParser, Keep, KeepLabel, KeepLabels, KeepLabelsExpr, LabelExtractionExpression, LabelExtractionExpressionList, LabelFilter, LabelFormat, LabelFormatExpr, LabelFormatMatcher, LabelName, LabelParser, LabelReplace, LabelReplaceExpr, Labels, LabelsFormat, LastOverTime, LineComment, LineFilter, LineFilters, LineFormat, LineFormatExpr, LiteralExpr, LogExpr, LogQL, LogRangeExpr, Logfmt, LogfmtExpressionParser, LogfmtParser, LogfmtParserFlags, Lss, Lte, Matcher, Matchers, Max, MaxOverTime, MetricExpr, Min, MinOverTime, Mod, Mul, Neq, Nre, Number, NumberFilter, Offset, OffsetExpr, On, OnOrIgnoringModifier, Or, OrFilter, ParserFlag, Pattern, Pipe, PipeExact, PipeMatch, PipelineExpr, PipelineStage, Pow, QuantileOverTime, Range, RangeAggregationExpr, RangeOp, Rate, RateCounter, Re, Regexp, Selector, Sort, Sort_Desc, Stddev, StddevOverTime, Stdvar, StdvarOverTime, String, Sub, Sum, SumOverTime, Topk, UnitFilter, Unless, Unpack, Unwrap, UnwrapExpr, Vector, VectorAggregationExpr, VectorExpr, VectorOp, Without, formatLokiQuery, parser };\n"],"names":["RawQuery","query","language","className","theme","styles","getStyles","highlighted","queryTypeOptions","RESOLUTION_OPTIONS","value","LokiOptionFields","props","lineLimitValue","resolution","onRunQuery","runOnBlur","onChange","queryType","onChangeQueryLimit","nextQuery","preprocessMaxLines","onQueryTypeChange","instant","range","rest","onMaxLinesChange","e","onReturnKeyDown","onResolutionChange","option","type","maxLines","Field","MonacoQueryFieldLazy","MonacoQueryFieldWrapper","lastRunValueRef","handleRunQuery","handleBlur","LokiQueryField","override","prevProps","languageProvider","ExtraFieldElement","datasource","history","placeholder","validateQuery","interpolatedQuery","queryLines","parser","interpolatedErrors","parseQuery","parseErrors","queryErrors","interpolatedError","queryError","parseError","findErrorBoundary","isErrorBoundary","nodeRef","node","isEmptyString","errorNode","error","startPos","endPos","line","boundary","placeHolderScopedVars","perf","warned","PROCESS","emitWarning","msg","code","fn","AC","AS","_","warnACPolyfill","reason","printACPolyfillWarning","shouldWarn","TYPE","isPosInt","n","getUintArray","max","ZeroArray","size","Stack","#constructing","HeapCls","s","LRUCache","#max","#maxSize","#dispose","#disposeAfter","#fetchMethod","#size","#calculatedSize","#keyMap","#keyList","#valList","#next","#prev","#head","#tail","#free","#disposed","#sizes","#starts","#ttls","#hasDispose","#hasFetchMethod","#hasDisposeAfter","c","p","#isBackgroundFetch","k","index","options","context","#backgroundFetch","#moveToTail","#indexes","#rindexes","#isStale","ttl","ttlResolution","ttlAutopurge","updateAgeOnGet","updateAgeOnHas","allowStale","dispose","disposeAfter","noDisposeOnSet","noUpdateTTL","maxSize","maxEntrySize","sizeCalculation","fetchMethod","noDeleteOnFetchRejection","noDeleteOnStaleGet","allowStaleOnFetchRejection","allowStaleOnFetchAbort","ignoreFetchAbort","UintArray","#initializeSizeTracking","#initializeTTLTracking","key","ttls","starts","#setItemTTL","start","t","#updateItemAge","#statusTTL","status","cachedNow","getNow","age","sizes","#removeItemSize","#requireSize","v","#addItemSize","#evict","_i","_s","_st","_k","_v","i","#isValidIndex","getOptions","thisp","deleted","entry","remain","arr","setOptions","oldVal","oldValue","dt","task","val","free","head","hasOptions","peekOptions","ac","signal","fetchOpts","cb","updateCache","aborted","ignoreAbort","fetchFail","bf","eb","er","allowStaleAborted","noDelete","pcall","res","rej","fmp","b","fetchOptions","forceRefresh","stale","isStale","staleVal","fetching","#connect","pi","ni","NS_IN_MS","LokiLanguageProvider","initialValues","url","params","timeRange","streamSelector","interpolatedMatch","end","cacheKey","data","values","match","labelBasedQuery","labelMatchers","label","labels","param","nanoseconds","labelName","streamParam","rangeParams","paramCacheKey","labelValues","empty","config","series","DEFAULT_MAX_LINES_SAMPLE","hasLogfmt","hasJSON","hasPack","DEFAULT_WEBSOCKET_CONFIG","WEBSOCKETSUBJECT_INVALID_ERROR_OBJECT","WebSocketSubject","_super","urlConfigOrSource","destination","_this","Observable","Subject","ReplaySubject","operator","sock","subMsg","unsubMsg","messageFilter","self","observer","err","subscription","x","_a","WebSocketCtor","protocol","binaryType","socket","Subscription","evt","_socket","openObserver","queue","Subscriber","serializer","closingObserver","closeObserver","deserializer","subscriber","source","webSocket","parse","uuid","validate","stringToBytes","str","bytes","DNS","URL","v35","name","version","hashfunc","generateUUID","namespace","buf","offset","_namespace","f","y","z","ROTL","sha1","K","H","l","N","M","j","W","a","d","T","UUID_NAMESPACE","appendResponseToBufferedData","response","streams","tsField","lineField","idField","usedUids","stream","allLabelsString","ts","createUid","labelsString","refId","id","newCount","LiveStreams","target","retryInterval","CircularDataFrame","map","retryWhen","attempts","mergeMap","retryAttempt","timer","throwError","finalize","IS_LOKI_LOG_CONTEXT_UI_OPEN","LokiContextUi","row","logContextProvider","updateFilter","onClose","origQuery","runContextQuery","contextFilters","setContextFilters","showPreservedFiltersAppliedNotification","setShowPreservedFiltersAppliedNotification","initialized","setInitialized","loading","setLoading","isOpen","setIsOpen","includePipelineOperations","setIncludePipelineOperations","SHOULD_INCLUDE_PIPELINE_OPERATIONS","timerHandle","previousInitialized","previousContextFilters","isInitialState","filter","enabled","nonIndexed","preservedLabels","LOKI_LOG_CONTEXT_PRESERVED_LABELS","useAsync","initContextFilters","realLabels","realLabelsEnabled","parsedLabels","parsedLabelsEnabled","contextFilterToSelectFilter","contextFilter","showNonIndexedLabels","queryExpr","Alert","Tooltip","Button","Collapse","Icon","Spinner","Label","keys","actionMeta","InlineFieldRow","InlineField","RenderUserContentAsHTML","SortDirection","makeIndex","field","dir","fieldValues","nanos","isAsc","valA","valB","nanoA","nanoB","sortDataFrameByTime","frame","fields","timeField","SortedVector","LogContextProvider","cacheFilters","direction","processResults","result","processedFrames","app","lastValueFrom","makeRequest","REF_ID_STARTER_LOG_ROW_CONTEXT","catchError","switchMap","of","expr","hasParser","nonIndexedLabels","parsedLabel","currentExpr","newExpr","origExpr","allNodePositions","pipelineStagePositions","position","otherNodePositions","pipelineStagePosition","preservedFiltersApplied","allLabels","preservedLabelsString","arePreservedLabelsUsed","newContextFilters","limit","filters","contextTimeBuffer","queryDirection","FieldCache","tsValue","timestamp","preparedExpression","labelNamesRegex","labelValuesRegex","migrateVariableQuery","rawQuery","queryBase","variableOptions","LokiVariableQueryEditor","setType","setLabel","labelOptions","setLabelOptions","setStream","variableQuery","labelNames","newType","onLabelChange","newLabel","onStreamChange","Select","Input","LokiVariableSupport","scopedVars","request","from","getDerivedFields","dataFrame","derivedFieldConfigs","derivedFieldsGrouped","newFields","fieldFromDerivedFieldConfig","labelFields","intersectingKey","logMatch","dataSourceSrv","dataLinks","acc","derivedFieldConfig","dsSettings","makeTableFrames","instantMetricFrames","framesWithRefId","framesByRefId","frames","makeTableFrame","tableTimeField","tableValueField","allLabelNames","valueField","timeArray","valueArray","text","isMetricFrame","setFrameMeta","meta","oldMeta","newMeta","processStreamFrame","custom","newFrame","derivedFields","processStreamsFrames","queryMap","processMetricInstantFrames","processMetricRangeFrames","groupFrames","streamsFrames","metricInstantFrames","metricRangeFrames","improveError","message","transformBackendResult","queries","dataFrames","LokiAnnotationsQueryEditor","annotation","onAnnotationChange","onChangeQuery","queryWithRefId","EditorRow","EditorField","event","getQueryHints","hints","queryWithParser","parserCount","hasPipelineErrorFiltering","hasLevel","levelLikeLabel","splitTimeRange","startTime","endTime","idealRangeDuration","chunkEndTime","chunkStartTime","step","alignedDuration","alignedStartTime","partitionTimeRange","isLogsQuery","originalTimeRange","stepMs","duration","to","adjustTargetsFromResponseState","targets","targetFrame","updatedMaxLines","runSplitGroupedQueries","requests","responseKey","mergedResponse","totalRequests","partition","longestPartition","shouldStop","subquerySubsciption","runNextRequest","requestN","requestGroup","done","nextRequest","nextRequestN","nextRequestGroup","getNextRequestPointers","group","subRequest","partialResponse","combineResponses","updateLoadingFrame","LOADING_FRAME_NAME","loadingFrame","querySupportsSplitting","runSplitQuery","nonSplittingQueries","normalQueries","logQueries","metricQueries","oneDayMs","rangePartitionedLogQueries","rangePartitionedMetricQueries","chunkRangeMs","resolutionPartition","stepMsPartition","calculateStep","q","tap","intervalMs","interval_regex","newStep","safeStep","getLiveStreamKey","msgUint8","hashBuffer","doLokiChannelStream","ds","maxDelta","maxLength","updateFrame","StreamingDataFrame","defer","convertToWebSocketUrl","backend","DEFAULT_MAX_LINES","LOKI_ENDPOINT","REF_ID_DATA_SAMPLES","REF_ID_STARTER_ANNOTATION","REF_ID_STARTER_LOG_VOLUME","REF_ID_STARTER_LOG_SAMPLE","REF_ID_STARTER_STATS","requestId","hideFromInspector","intervalInfo","LokiDatasource","DataSourceWithBackend","instanceSettings","templateSrv","maxDataPoints","liveTarget","settingsData","normalizedQuery","isQuerySuitable","dropErrorExpression","logsVolumeRequest","logsSampleRequest","fixedRequest","streamQueries","streamRequest","merge","logsQueries","subQueries","baseUrl","adhocFilters","expandedQueries","abstractQueries","existingKeys","abstractQuery","labelMatcher","statsForAll","idx","durations","interpolatedVariableQuery","lokiLogsQuery","variable","lokiRegularEscape","lokiSpecialRegexEscape","lodash","expression","labelType","action","parserPositions","labelFilterPositions","lastPosition","tagKeys","titleFormat","textFormat","annotations","splitKeys","DataFrameView","maybeDuplicatedTags","tags","__auto","__interval","__interval_ms","__range","__range_s","__range_ms","exprWithAdHoc","variables","string","defaults","NodePosition","queryHasFilter","getMatchersWithFilter","removeLabelFromQuery","matchers","matcher","removeLabelFilter","removeSelector","pipelineStage","selector","prefix","suffix","matchVisQuery","tree","labelNode","opNode","valueNode","labelValue","addLabelToQuery","streamSelectorPositions","getStreamSelectorPositions","getParserPositions","getLabelFilterPositions","hasStreamSelectorMatchers","getMatcherInStreamPositions","everyStreamSelectorHasMatcher","streamSelectorPosition","matcherPosition","toLabelFilter","lastPositionsPerExpression","getLastPositionPerExpression","addFilterAsLabelFilter","addFilterToStreamSelector","positions","subExpressions","findLeaves","subPositions","subExpression","findLastPosition","addParserToQuery","lineFilterPositions","getLineFiltersPositions","addParser","addNoPipelineErrorToQuery","addLabelFormatToQuery","labelFormat","logQueryPositions","getLogQueryPositions","addLabelFormat","removeCommentsFromQuery","lineCommentPositions","getLineCommentPositions","newQuery","prev","lineCommentPosition","parserNodeTypes","logPartsPositions","pipeline","unwrap","sorted","vectorSelectorPositions","isLast","labelExists","newLabels","positionsToAddAfter","labelFilter","queryPartPositions","addLineFilter","streamSelectorEnd","current","nodes","getAllPositionsInNodeByType","pos","child","getHighlighterExpressionsFromQuery","input","results","getNodesFromQuery","pipeExact","pipeMatch","strings","getStringsFromLineFilter","filterTerm","backtickedTerm","unwrappedFilterTerm","resultTerm","getNormalizedLokiQuery","getLokiQueryType","tagsToObscure","partsToKeep","obfuscate","obfuscatedQuery","queryPart","parseToNodeNamesArray","queryParts","isQueryWithNode","nodeType","nodeTypes","getNodePositionsFromQuery","getNodeFromQuery","isQueryWithError","isQueryWithParser","getParserFromQuery","parsers","isQueryPipelineErrorFiltering","isQueryWithLabelFormat","getLogQueryFromMetricsQuery","selectorNode","pipelineExprNode","pipelineExpr","getLogQueryFromMetricsQueryAtPosition","metricQuery","isQueryWithLabelFilter","isQueryWithLineFilter","isQueryWithRangeVariable","rangeNodes","getStreamSelectorsFromQuery","requestSupportsSplitting","allQueries","isLokiQuery","getLokiQueryFromDataQuery","formatLogqlQuery","isInvalid","transformedQuery","transformationMatches","pattern","formatted","QueryModellerBase","operationDefinitions","innerQueryPlaceholder","Registry","categories","category","op","def","LokiQueryModeller","queryString","operations","operation","binaryQueries","binQuery","leftOperand","binaryQuery","nested","lokiQueryModeller","binaryScalarDefs","binaryScalarOperations","opDef","defaultParams","getSimpleBinaryRenderer","model","innerExpr","bool","UnwrapParamEditor","operationId","queryModeller","state","setState","loadUnwrapOptions","logExpr","samples","getOperationDefinitions","aggregations","opId","aggregationsWithParam","rangeOperations","rangeOperationsWithGrouping","explainOperator","getDefinitionById","checkParamsAreValid","buildVisualQueryFromString","replacedExpr","handleExpression","isEmptyQuery","visQuery","getLabel","getLineFilter","createNotSupportedError","getLabelParser","getLabelFilter","getJsonExpressionParser","getLogfmtParser","getLineFormat","getLabelFormat","handleUnwrapExpr","getDecolorize","handleRangeAggregation","handleVectorAggregation","handleBinary","isIntervalVariableError","handleDropFilter","handleKeepFilter","filterExpr","handleQuotes","orFilter","parserNode","flags","subNode","ipLabelFilter","valueString","renameTo","originalLabel","unwrapExprChild","labelFilterChild","unwrapChild","convOp","identifier","nameNode","funcName","number","rangeValue","grouping","numberNode","metricExpr","operatorToOpName","left","binModifier","getBinaryModifier","right","leftNumber","getLastChildWithSelector","rightNumber","rightBinary","leftMostChild","boolMatcher","children","exploringNode","ErrorId","getLeftMostChild","cur","makeError","getString","variableRegex","replaceVariables","var1","var2","fmt2","var3","fieldPath","fmt3","fmt","varType","varTypeFunc","returnVariables","makeBinOp","hasBool","getAllByType","regexifyLabelValuesQueryString","isLogLineJSON","parsed","LOGFMT_REGEXP","isLogLineLogfmt","isLogLinePacked","dataFrameHasLokiError","dataFrameHasLevelLabel","extractLogParserFromDataFrame","logLines","extractLabelKeysFromDataFrame","labelsArray","labelTypeArray","labelKeys","labelsSet","labelsType","allLabelKeys","extractUnwrapLabelKeysFromDataFrame","obj","extractHasErrorLabelFromDataFrame","labelField","extractLevelLikeLabelFromDataFrame","onDashboardLoadedHandler","dashboardId","orgId","grafanaVersion","lokiQueries","instantQueries","rangeQueries","builderModeQueries","codeModeQueries","queriesWithTemplateVariables","isQueryWithTemplateVariables","queriesWithChangedResolution","isQueryWithChangedResolution","queriesWithChangedLineLimit","isQueryWithChangedLineLimit","queriesWithChangedLegend","isQueryWithChangedLegend","shouldNotReportBasedOnRefId","starters","starter","calculateTotalBytes","totalBytes","byteKey","stat","trackQuery","trackingSettings","extraPayload","trackGroupedQueries","groupedRequests","originalRequest","splittingPayload","total","split_query_partition_size","Json$1","Logfmt$1","Unpack$1","Pattern$1","Regexp$1","Unwrap$1","LabelFormat$1","LineFormat$1","LabelReplace$1","Vector$1","Offset$1","Bool$1","On$1","Ignoring$1","GroupLeft$1","GroupRight$1","Decolorize$1","Drop$1","Keep$1","By$1","Without$1","And$1","Or$1","Unless$1","Sum$1","Avg$1","Count$1","Max$1","Min$1","Stddev$1","Stdvar$1","Bottomk$1","Topk$1","Sort$1","Sort_Desc$1","MetricExpr$1","keywordTokens","specializeIdentifier","contextualKeywordTokens","extendIdentifier","spec_Identifier","stack","Json","Logfmt","Unpack","Pattern","Regexp","Unwrap","LabelFormat","LineFormat","LabelReplace","Vector","Offset","Bool","On","Ignoring","GroupLeft","GroupRight","Decolorize","Drop","Keep","By","Without","And","Or","Unless","Sum","Avg","Count","Max","Min","Stddev","Stdvar","Bottomk","Topk","Sort","Sort_Desc","LineComment","LogQL","Expr","LogExpr","Selector","Matchers","Matcher","Identifier","Eq","String","Neq","Re","Nre","PipelineExpr","PipelineStage","LineFilters","LineFilter","Filter","PipeExact","PipeMatch","FilterOp","Ip","OrFilter","Pipe","LogfmtParser","LogfmtParserFlags","ParserFlag","LabelParser","JsonExpressionParser","LabelExtractionExpressionList","LabelExtractionExpression","LogfmtExpressionParser","LabelFilter","IpLabelFilter","UnitFilter","DurationFilter","Gtr","Duration","Gte","Lss","Lte","Eql","BytesFilter","Bytes","NumberFilter","Number","LineFormatExpr","LabelFormatExpr","LabelsFormat","LabelFormatMatcher","DecolorizeExpr","DropLabelsExpr","DropLabels","DropLabel","KeepLabelsExpr","KeepLabels","KeepLabel","MetricExpr","RangeAggregationExpr","RangeOp","CountOverTime","Rate","RateCounter","BytesOverTime","BytesRate","AvgOverTime","SumOverTime","MinOverTime","MaxOverTime","StddevOverTime","StdvarOverTime","QuantileOverTime","FirstOverTime","LastOverTime","AbsentOverTime","LogRangeExpr","Range","OffsetExpr","UnwrapExpr","ConvOp","BytesConv","DurationConv","DurationSecondsConv","Grouping","Labels","VectorAggregationExpr","VectorOp","BinOpExpr","BinOpModifier","OnOrIgnoringModifier","GroupingLabels","GroupingLabelList","GroupingLabel","LabelName","Add","Sub","Mul","Div","Mod","Pow","LiteralExpr","LabelReplaceExpr","VectorExpr","indent","level","indentMultiline","block","trimMultiline","needsBrackets","childNodeIsSame","addBrackets","iterateNode","lookingFor","buildResponse","pipelineType","lastPipelineType","formattedNode","trimEnd","charactersToTrim","endIndex","formatLogExpr","newNode","ref","formatSelector","formatPipelineExpr","subtree","labelNodes","labelNodeA","labelNodeB","labelValueA","labelValueB","operatorNode","pipelineExprNodes","formatLineFilter","formatLabelParser","formatJsonExpressionParser","formatLabelFilter","formatLineFormatExpr","formatLabelFormatExpr","formatDecolorizeExpr","filterNode","filterOperationNode","stringNode","jsonExpressionNodes","identifierNode","selectedFilter","selectedFilterType","labelFormatMatcherNodes","labelFormatMatcherNode","formatMetricExpr","childNode","formatRangeAggregationExpr","formatVectorAggregationExpr","formatBinOpExpr","formatLiteralExpr","formatLabelReplaceExpr","formatVectorExpr","formatLogRangeExpr","formatGrouping","durationNode","array","previousNode","hasNumber","metricNode","leftExpr","rightExpr","expressionNode","addNode","formatLokiQuery"],"sourceRoot":""}
Edit
Rename
Chmod
Delete
FILE
FOLDER
INFO
Name
Size
Permission
Action
static
---
0755
0.c88fc16b6533c8976681.js
11857 bytes
0644
0.c88fc16b6533c8976681.js.map
46011 bytes
0644
1118.6d1cbbd2070e00a7483d.js
9459 bytes
0644
1118.6d1cbbd2070e00a7483d.js.map
22012 bytes
0644
1121.6c31bf81768d3312b0d4.js
11557 bytes
0644
1121.6c31bf81768d3312b0d4.js.map
40274 bytes
0644
1122.1b3b5a9bdf4a2fc70a83.js
4310 bytes
0644
1122.1b3b5a9bdf4a2fc70a83.js.map
9301 bytes
0644
1133.cd705902767ed2e9bf55.js
107191 bytes
0644
1133.cd705902767ed2e9bf55.js.map
459177 bytes
0644
1216.ddb58ad09e0c4e3f4079.js
12860 bytes
0644
1216.ddb58ad09e0c4e3f4079.js.map
47906 bytes
0644
1282.2347f27d5b3a18a42a1e.js
2965 bytes
0644
1282.2347f27d5b3a18a42a1e.js.map
6699 bytes
0644
1345.8570fef914aafab94513.js
2223 bytes
0644
1345.8570fef914aafab94513.js.map
5201 bytes
0644
1347.8ad23b870a6e21306189.js
32035 bytes
0644
1347.8ad23b870a6e21306189.js.map
89851 bytes
0644
1420.f2553cafc235b7c32261.js
14576 bytes
0644
1420.f2553cafc235b7c32261.js.map
32839 bytes
0644
1438.897db349b7f48a15b9eb.js
2830 bytes
0644
1438.897db349b7f48a15b9eb.js.map
6911 bytes
0644
1446.babd36e7134aac1046c4.js
1832 bytes
0644
1446.babd36e7134aac1046c4.js.map
3282 bytes
0644
1488.ff35935a06f41b02b6cc.js
316 bytes
0644
1488.ff35935a06f41b02b6cc.js.map
1206 bytes
0644
1560.30962127c91e5eae9982.js
8916 bytes
0644
1560.30962127c91e5eae9982.js.map
20515 bytes
0644
1660.e1f66118fb028d12074f.js
21866 bytes
0644
1660.e1f66118fb028d12074f.js.map
71039 bytes
0644
1698.68ff1ef08e94a87836b3.js
12570 bytes
0644
1698.68ff1ef08e94a87836b3.js.map
46006 bytes
0644
1708.f42a783c0f6c7a317d49.js
2249 bytes
0644
1708.f42a783c0f6c7a317d49.js.map
2954 bytes
0644
1710.d96221051fceaf8c89dd.js
10172 bytes
0644
1710.d96221051fceaf8c89dd.js.map
22097 bytes
0644
1740.e57d920c47a11759ade4.js
6204 bytes
0644
1740.e57d920c47a11759ade4.js.map
13740 bytes
0644
1888.0ede69d3190c536744b9.js
6822 bytes
0644
1888.0ede69d3190c536744b9.js.map
15421 bytes
0644
1914.58113477b565d57e8bfe.js
10710 bytes
0644
1914.58113477b565d57e8bfe.js.map
23555 bytes
0644
198.b84c0e4f5759344ae05a.js
8267 bytes
0644
198.b84c0e4f5759344ae05a.js.map
19446 bytes
0644
205.6c51b5e35c8147226738.js
3542 bytes
0644
205.6c51b5e35c8147226738.js.map
8376 bytes
0644
2058.0e5df44647184aaf02e2.js
1252 bytes
0644
2058.0e5df44647184aaf02e2.js.map
4744 bytes
0644
2077.12b2df3682085a92a810.js
34133 bytes
0644
2077.12b2df3682085a92a810.js.map
122011 bytes
0644
2094.259625d8acf28b9c7361.js
16518 bytes
0644
2094.259625d8acf28b9c7361.js.map
41269 bytes
0644
21.afca69f2d336e287a655.js
6172 bytes
0644
21.afca69f2d336e287a655.js.map
17305 bytes
0644
2136.9c8dcd43d3af327f51f5.js
498667 bytes
0644
2136.9c8dcd43d3af327f51f5.js.map
1908011 bytes
0644
2228.cf629cf4a83c5b6c2671.js
269 bytes
0644
2228.cf629cf4a83c5b6c2671.js.map
457 bytes
0644
2244.9324c28eca7d2ffb7568.js
3396 bytes
0644
2244.9324c28eca7d2ffb7568.js.map
7683 bytes
0644
2261.ac6a26854d5acee00776.js
106373 bytes
0644
2261.ac6a26854d5acee00776.js.map
478562 bytes
0644
2278.bdd73b14b6337c6b14e4.js
5754 bytes
0644
2278.bdd73b14b6337c6b14e4.js.map
13399 bytes
0644
2398.3de0e7aa3057b7dcf9da.js
8016 bytes
0644
2398.3de0e7aa3057b7dcf9da.js.map
18383 bytes
0644
2514.c86950e9813e27962050.js
1983 bytes
0644
2514.c86950e9813e27962050.js.map
4863 bytes
0644
2571.345ecfd2b82551018f2e.js
162139 bytes
0644
2571.345ecfd2b82551018f2e.js.map
2046 bytes
0644
2586.972e9a7d564398afee76.js
6385 bytes
0644
2586.972e9a7d564398afee76.js.map
14676 bytes
0644
2658.f4100815829c4d37d35c.js
5432 bytes
0644
2658.f4100815829c4d37d35c.js.map
13650 bytes
0644
2686.2fbaa7db9c01d59cad8d.js
2815 bytes
0644
2686.2fbaa7db9c01d59cad8d.js.map
6564 bytes
0644
2692.20098ad0182743d98d62.js
2282 bytes
0644
2692.20098ad0182743d98d62.js.map
5680 bytes
0644
2694.a31d749361a36eb167da.js
2726 bytes
0644
2694.a31d749361a36eb167da.js.map
3618 bytes
0644
2745.2e5ec1fdf377d2940fb4.js
33584 bytes
0644
2745.2e5ec1fdf377d2940fb4.js.map
120277 bytes
0644
2962.4c3147d8ee365fe296ef.js
7640 bytes
0644
2962.4c3147d8ee365fe296ef.js.map
17621 bytes
0644
3042.248a4194805a8500fd28.js
19010 bytes
0644
3042.248a4194805a8500fd28.js.map
38148 bytes
0644
3062.4e9a427c2a59d53f902e.js
4663 bytes
0644
3062.4e9a427c2a59d53f902e.js.map
10650 bytes
0644
3082.c09cff56c35d736ee8b6.js
52872 bytes
0644
3082.c09cff56c35d736ee8b6.js.map
56822 bytes
0644
3096.8d41728a4f5010bc56a2.js
4378 bytes
0644
3096.8d41728a4f5010bc56a2.js.map
10739 bytes
0644
3098.f22ad6dab13d06477be0.js
31462 bytes
0644
3098.f22ad6dab13d06477be0.js.map
85588 bytes
0644
3182.1d531f28507c00e391fc.js
13817 bytes
0644
3182.1d531f28507c00e391fc.js.map
26653 bytes
0644
3407.666eb88a718e66b93f72.js
34425 bytes
0644
3407.666eb88a718e66b93f72.js.map
103716 bytes
0644
3418.d31d882b87bd5a2ef66f.js
33061 bytes
0644
3418.d31d882b87bd5a2ef66f.js.map
114234 bytes
0644
3541.8d063e3d43d55745d89b.js
20582 bytes
0644
3541.8d063e3d43d55745d89b.js.map
67154 bytes
0644
3543.eecef49ce94da5ee0418.js
136752 bytes
0644
3543.eecef49ce94da5ee0418.js.map
446118 bytes
0644
3622.976b1aef94b333e450b9.js
1260 bytes
0644
3622.976b1aef94b333e450b9.js.map
2819 bytes
0644
3686.102abfc00452299017bb.js
87 bytes
0644
3718.3993946b7a0eb8f64b4d.js
23620 bytes
0644
3718.3993946b7a0eb8f64b4d.js.map
92024 bytes
0644
3726.3adfe210678d2cd26969.js
31765 bytes
0644
3726.3adfe210678d2cd26969.js.map
118227 bytes
0644
398.4e93ffb675609ea7a9c6.js
2990 bytes
0644
398.4e93ffb675609ea7a9c6.js.map
7145 bytes
0644
4114.953b39a9ce57caa0e87a.js
2536 bytes
0644
4114.953b39a9ce57caa0e87a.js.map
6028 bytes
0644
4120.67bf5d203ed4a2eb5f1b.js
3229 bytes
0644
4120.67bf5d203ed4a2eb5f1b.js.map
7533 bytes
0644
4209.c7060d489834063658f5.js
17352 bytes
0644
4209.c7060d489834063658f5.js.map
30980 bytes
0644
4254.c5f4a5512b252e3a5796.js
71716 bytes
0644
4254.c5f4a5512b252e3a5796.js.map
237783 bytes
0644
4289.d5662b0904798ff437e9.js
16496 bytes
0644
4289.d5662b0904798ff437e9.js.map
32015 bytes
0644
4334.bc078c368a20ed3257b6.js
2598 bytes
0644
4334.bc078c368a20ed3257b6.js.map
6308 bytes
0644
4630.b604ea691184ba563d59.js
5585 bytes
0644
4630.b604ea691184ba563d59.js.map
11866 bytes
0644
4680.358dfdd92851f69ecc97.js
4573 bytes
0644
4680.358dfdd92851f69ecc97.js.map
10841 bytes
0644
4698.696713071ff5d9929a11.js
3682 bytes
0644
4698.696713071ff5d9929a11.js.map
8967 bytes
0644
4787.bd938ea7cb58d64ee246.js
738 bytes
0644
4787.bd938ea7cb58d64ee246.js.map
2168 bytes
0644
4839.17a10e0ceca3eb8954b4.js
39585 bytes
0644
4839.17a10e0ceca3eb8954b4.js.map
145699 bytes
0644
494.8cf705bc1ea509187c88.js
3796 bytes
0644
494.8cf705bc1ea509187c88.js.map
8987 bytes
0644
4958.cd447d877778fc5af081.js
4923 bytes
0644
4958.cd447d877778fc5af081.js.map
11000 bytes
0644
4962.0da526ad79f816a15985.js
2242 bytes
0644
4962.0da526ad79f816a15985.js.map
4978 bytes
0644
50.7b1e44d5b9dbbed566be.js
617497 bytes
0644
50.7b1e44d5b9dbbed566be.js.map
2271464 bytes
0644
5017.003cacead1bba1cba035.js
3567142 bytes
0644
5017.003cacead1bba1cba035.js.map
13214665 bytes
0644
5130.4d31108de97088a3b014.js
2850 bytes
0644
5130.4d31108de97088a3b014.js.map
6536 bytes
0644
5196.064b914693b6a5591a48.js
4035 bytes
0644
5196.064b914693b6a5591a48.js.map
10273 bytes
0644
5240.eceb5f73f807ac22d800.js
704 bytes
0644
5240.eceb5f73f807ac22d800.js.map
2618 bytes
0644
5277.ce6608b6f47246e32767.js
269 bytes
0644
5277.ce6608b6f47246e32767.js.map
457 bytes
0644
5280.4348c762594edebf7d0e.js
16657 bytes
0644
5280.4348c762594edebf7d0e.js.map
89146 bytes
0644
5356.eabc0dc2021a3814a65f.js
10156 bytes
0644
5356.eabc0dc2021a3814a65f.js.map
25249 bytes
0644
5358.7c5e9e1b192582f3082d.js
6173 bytes
0644
5358.7c5e9e1b192582f3082d.js.map
19652 bytes
0644
5364.ac21c32fd45a27bc998a.js
3070 bytes
0644
5364.ac21c32fd45a27bc998a.js.map
7368 bytes
0644
5398.d0c11aa7c1232f4afe44.js
81872 bytes
0644
5398.d0c11aa7c1232f4afe44.js.map
769414 bytes
0644
5428.e85b0800b30feca9d7dc.js
330175 bytes
0644
5428.e85b0800b30feca9d7dc.js.map
530929 bytes
0644
5511.93023985e5c5efe49ae2.js
21275 bytes
0644
5511.93023985e5c5efe49ae2.js.map
93188 bytes
0644
5550.9284e42acc3f2bbdfc9d.js
7039 bytes
0644
5550.9284e42acc3f2bbdfc9d.js.map
16382 bytes
0644
558.701e8b4db7b852c4a10d.js
12211 bytes
0644
558.701e8b4db7b852c4a10d.js.map
24505 bytes
0644
5618.638c32d58d896f3f7261.js
3348 bytes
0644
5618.638c32d58d896f3f7261.js.map
8181 bytes
0644
5648.cb3fd92dbbc06f7d45d2.js
57392 bytes
0644
5648.cb3fd92dbbc06f7d45d2.js.map
60585 bytes
0644
5786.db7abc3b8e4f474a8f7b.js
5325 bytes
0644
5786.db7abc3b8e4f474a8f7b.js.map
11885 bytes
0644
5807.f05d997ece5811bbc849.js
2922915 bytes
0644
5807.f05d997ece5811bbc849.js.map
10524334 bytes
0644
5950.30ec6aaa9dcece6c3b3c.js
4616249 bytes
0644
5950.30ec6aaa9dcece6c3b3c.js.map
19277501 bytes
0644
6018.f4de7ac19ac8f0c774e6.js
5861 bytes
0644
6018.f4de7ac19ac8f0c774e6.js.map
13314 bytes
0644
6029.0549a3fcb50e73c4b256.js
409895 bytes
0644
6029.0549a3fcb50e73c4b256.js.map
998408 bytes
0644
6185.883629fcc773b4968b24.js
2258 bytes
0644
6185.883629fcc773b4968b24.js.map
4788 bytes
0644
6263.e4ef9aaa3073ebacc3a5.js
54594 bytes
0644
6263.e4ef9aaa3073ebacc3a5.js.map
242030 bytes
0644
6302.257b2eb06c25ee74090e.js
8440 bytes
0644
6302.257b2eb06c25ee74090e.js.map
19322 bytes
0644
6359.f824c85233ec703f8cea.js
11411 bytes
0644
6359.f824c85233ec703f8cea.js.map
41881 bytes
0644
6377.45d36c143a694fc45bd3.js
20571 bytes
0644
6377.45d36c143a694fc45bd3.js.map
79590 bytes
0644
6378.27b1e6d863a0a3b85962.js
977993 bytes
0644
6378.27b1e6d863a0a3b85962.js.map
3865587 bytes
0644
6414.192cf271de6ecbbbcb11.js
3984 bytes
0644
6414.192cf271de6ecbbbcb11.js.map
9134 bytes
0644
6446.b4b93ee91aa1bb57ea93.js
7731 bytes
0644
6446.b4b93ee91aa1bb57ea93.js.map
17485 bytes
0644
6464.f379e014f9909e621de6.js
34429 bytes
0644
6464.f379e014f9909e621de6.js.map
113303 bytes
0644
6499.9f52e0855fd4782a8b45.js
78297 bytes
0644
6499.9f52e0855fd4782a8b45.js.map
273155 bytes
0644
6587.bfb1ca0c32c6f325b0df.js
135004 bytes
0644
6587.bfb1ca0c32c6f325b0df.js.map
541974 bytes
0644
660.838743295c2108f3492d.js
43101 bytes
0644
660.838743295c2108f3492d.js.map
100340 bytes
0644
6678.a615dbe07b8a3e591e66.js
14725 bytes
0644
6678.a615dbe07b8a3e591e66.js.map
51145 bytes
0644
680.1a328432fae403eacab3.js
53846 bytes
0644
680.1a328432fae403eacab3.js.map
57615 bytes
0644
6830.0c200fec1efc2be388e2.js
5811 bytes
0644
6830.0c200fec1efc2be388e2.js.map
13972 bytes
0644
6934.fa19d392db34411fb300.js
168944 bytes
0644
6934.fa19d392db34411fb300.js.map
540337 bytes
0644
6940.9c5d3a2dcf9d7d58fa2c.js
3408 bytes
0644
6940.9c5d3a2dcf9d7d58fa2c.js.map
8039 bytes
0644
6969.f8f153735314f9426000.js
1119 bytes
0644
6969.f8f153735314f9426000.js.map
4230 bytes
0644
6990.cc2f5674128929a3f870.js
4418 bytes
0644
6990.cc2f5674128929a3f870.js.map
10503 bytes
0644
7048.117de444b1e1cb5a1360.js
4365 bytes
0644
7048.117de444b1e1cb5a1360.js.map
10316 bytes
0644
7166.480da6892ee84ee8bb53.js
593985 bytes
0644
7166.480da6892ee84ee8bb53.js.map
2430098 bytes
0644
7200.dc60128b9d612fc7b5b0.js
3634 bytes
0644
7200.dc60128b9d612fc7b5b0.js.map
8184 bytes
0644
7246.3adf293a34fa2043387b.js
4306 bytes
0644
7246.3adf293a34fa2043387b.js.map
9084 bytes
0644
7400.024c96bd5b99b8b47a63.js
14112 bytes
0644
7400.024c96bd5b99b8b47a63.js.map
64001 bytes
0644
7409.24316c87d08c1053c46a.js
3287 bytes
0644
7409.24316c87d08c1053c46a.js.map
11649 bytes
0644
7455.845968885abe369e6479.js
19801 bytes
0644
7455.845968885abe369e6479.js.map
77213 bytes
0644
7466.09e6e197d2507f62097d.js
11670 bytes
0644
7466.09e6e197d2507f62097d.js.map
24830 bytes
0644
7515.95323f0dfbd0de010e5c.js
1083 bytes
0644
7515.95323f0dfbd0de010e5c.js.map
1321 bytes
0644
7613.6334cff4df12cc157522.js
808779 bytes
0644
7613.6334cff4df12cc157522.js.map
991378 bytes
0644
7836.6a7e4207e70fc2dc235f.js
7192 bytes
0644
7836.6a7e4207e70fc2dc235f.js.map
17613 bytes
0644
7882.1a3cc418752c83396970.js
3743 bytes
0644
7882.1a3cc418752c83396970.js.map
14950 bytes
0644
7886.485c46f14540aa23cf70.js
8668 bytes
0644
7886.485c46f14540aa23cf70.js.map
20124 bytes
0644
7914.2b1a06c504df18e20fe4.js
2390 bytes
0644
7914.2b1a06c504df18e20fe4.js.map
6418 bytes
0644
7982.6761217193d3060dbf0e.js
188973 bytes
0644
7982.6761217193d3060dbf0e.js.map
1737667 bytes
0644
8054.094788468423bb88ee68.js
38124 bytes
0644
8054.094788468423bb88ee68.js.map
132296 bytes
0644
8107.92bd414247a1d05c014f.js
5144 bytes
0644
8107.92bd414247a1d05c014f.js.map
15320 bytes
0644
8230.2eedae6021a4715c6dea.js
2413 bytes
0644
8230.2eedae6021a4715c6dea.js.map
5812 bytes
0644
8332.f4b05d2f028641445650.js
3177 bytes
0644
8332.f4b05d2f028641445650.js.map
7186 bytes
0644
8334.c95ec0eb6900c0cf7e89.js
7803 bytes
0644
8334.c95ec0eb6900c0cf7e89.js.map
17714 bytes
0644
8390.1fd9505094c8cf8830ab.js
2096 bytes
0644
8390.1fd9505094c8cf8830ab.js.map
5157 bytes
0644
84.a6f8658e6a033d642231.js
30608 bytes
0644
84.a6f8658e6a033d642231.js.map
142543 bytes
0644
8494.4470c87b7093ddf70db7.js
2180 bytes
0644
8494.4470c87b7093ddf70db7.js.map
4863 bytes
0644
8542.1391ab96a455b01963a7.js
1514 bytes
0644
8542.1391ab96a455b01963a7.js.map
3249 bytes
0644
8566.e05562713181c6ca30fe.js
3852 bytes
0644
8566.e05562713181c6ca30fe.js.map
8781 bytes
0644
8730.3dcdd8cbf22c63b45d78.js
2109 bytes
0644
8730.3dcdd8cbf22c63b45d78.js.map
2893 bytes
0644
8786.1b0e43b80c82c73e2096.js
1535 bytes
0644
8786.1b0e43b80c82c73e2096.js.map
4055 bytes
0644
8902.37d0b14aa6ef24687b7b.js
2673 bytes
0644
8902.37d0b14aa6ef24687b7b.js.map
5993 bytes
0644
8990.5a822b8788ebf0bdba81.js
3969 bytes
0644
8990.5a822b8788ebf0bdba81.js.map
9161 bytes
0644
9034.200fc7a09b466256c9a9.js
3486 bytes
0644
9034.200fc7a09b466256c9a9.js.map
8180 bytes
0644
9038.7ae2448b9cc5c423aeca.js
4937 bytes
0644
9038.7ae2448b9cc5c423aeca.js.map
11973 bytes
0644
9118.3121c6b96ec7dc211973.js
48311 bytes
0644
9118.3121c6b96ec7dc211973.js.map
62149 bytes
0644
9150.9eb62d45f9b21cb38850.js
10056 bytes
0644
9150.9eb62d45f9b21cb38850.js.map
21143 bytes
0644
9199.9897e268d6d13e834d4c.js
2307 bytes
0644
9199.9897e268d6d13e834d4c.js.map
8853 bytes
0644
9320.c403e78b78aa6df1d0bd.js
336139 bytes
0644
9320.c403e78b78aa6df1d0bd.js.map
1624993 bytes
0644
9355.421530b20c759bb75633.js
22098 bytes
0644
9355.421530b20c759bb75633.js.map
66961 bytes
0644
9384.a0d5fc49f1b15b3e311e.js
2855 bytes
0644
9384.a0d5fc49f1b15b3e311e.js.map
3717 bytes
0644
9390.fa2af7f3d3d9600c08ee.js
4201 bytes
0644
9390.fa2af7f3d3d9600c08ee.js.map
9682 bytes
0644
946.f2494c0c39a9590349b9.js
9194 bytes
0644
946.f2494c0c39a9590349b9.js.map
22193 bytes
0644
9510.4cfa85a51931dc20573a.js
2949 bytes
0644
9510.4cfa85a51931dc20573a.js.map
6939 bytes
0644
9521.de2a74ca5eb365810ca5.js
46306 bytes
0644
9521.de2a74ca5eb365810ca5.js.map
51040 bytes
0644
9538.996ade7a03ccdb01942d.js
64493 bytes
0644
9538.996ade7a03ccdb01942d.js.map
49212 bytes
0644
9569.a8d60b39654a160cb917.js
27965 bytes
0644
9569.a8d60b39654a160cb917.js.map
99160 bytes
0644
9643.b408884004ca73c102bc.js
627 bytes
0644
9643.b408884004ca73c102bc.js.map
2195 bytes
0644
968.22e079d28acb4131d34c.js
4001 bytes
0644
968.22e079d28acb4131d34c.js.map
9740 bytes
0644
970.a61e37b9b897c8098261.js
5239 bytes
0644
970.a61e37b9b897c8098261.js.map
13858 bytes
0644
9711.d6e977bd60f0e5ba673d.js
13555 bytes
0644
9711.d6e977bd60f0e5ba673d.js.map
43973 bytes
0644
9737.3340c89ea96d33307cc7.js
1001 bytes
0644
9737.3340c89ea96d33307cc7.js.map
3504 bytes
0644
9739.5a801055fcf72bf4d06f.js
1147 bytes
0644
9739.5a801055fcf72bf4d06f.js.map
4390 bytes
0644
9772.49e918c9331237552c0b.js
141 bytes
0644
9772.49e918c9331237552c0b.js.map
416 bytes
0644
9838.b8f01dc360f0c2151291.js
4003 bytes
0644
9838.b8f01dc360f0c2151291.js.map
8118 bytes
0644
AdminAuthentication.b7044adf53b669e61a87.js
22504 bytes
0644
AdminAuthentication.b7044adf53b669e61a87.js.map
67352 bytes
0644
AdminEditOrgPage.96fb6c37346641f44246.js
6369 bytes
0644
AdminEditOrgPage.96fb6c37346641f44246.js.map
20602 bytes
0644
AdminFeatureTogglesPage.22157fe31f358f1c4f09.js
4939 bytes
0644
AdminFeatureTogglesPage.22157fe31f358f1c4f09.js.map
16531 bytes
0644
AdminListOrgsPage.f01c8496fd635e20124b.js
2702 bytes
0644
AdminListOrgsPage.f01c8496fd635e20124b.js.map
7735 bytes
0644
AdminSettings.845c6def917892a0c1f9.js
1903 bytes
0644
AdminSettings.845c6def917892a0c1f9.js.map
5580 bytes
0644
AlertAmRoutes.10a0d9a23a082caf12c8.js
54554 bytes
0644
AlertAmRoutes.10a0d9a23a082caf12c8.js.map
208792 bytes
0644
AlertGroups.efd523dc41621f9f7935.js
10088 bytes
0644
AlertGroups.efd523dc41621f9f7935.js.map
39108 bytes
0644
AlertRuleListIndex.f0b17a6119cc5ea575ed.js
44623 bytes
0644
AlertRuleListIndex.f0b17a6119cc5ea575ed.js.map
156842 bytes
0644
AlertRuleListLegacy.8e675db4469232c87308.js
6270 bytes
0644
AlertRuleListLegacy.8e675db4469232c87308.js.map
18086 bytes
0644
AlertSilences.4ff252ad4c0057124d5d.js
24687 bytes
0644
AlertSilences.4ff252ad4c0057124d5d.js.map
83377 bytes
0644
AlertTabCtrl.d3377d127a336a69beb5.js
9844 bytes
0644
AlertTabCtrl.d3377d127a336a69beb5.js.map
27934 bytes
0644
AlertingAdmin.e62f9c73a69abe6a1ac0.js
10523 bytes
0644
AlertingAdmin.e62f9c73a69abe6a1ac0.js.map
37393 bytes
0644
AlertingFeatureTogglePage.f971bb7b2ad4ceb0acbd.js
672 bytes
0644
AlertingFeatureTogglePage.f971bb7b2ad4ceb0acbd.js.map
1220 bytes
0644
AlertingHome.0d6be993ef4a3df37345.js
33492 bytes
0644
AlertingHome.0d6be993ef4a3df37345.js.map
106868 bytes
0644
AlertingRedirectToRule.37a0040f89e20b99b751.js
3648 bytes
0644
AlertingRedirectToRule.37a0040f89e20b99b751.js.map
10875 bytes
0644
AlertingRuleForm.66bb5b2724b31ae6a5a4.js
79931 bytes
0644
AlertingRuleForm.66bb5b2724b31ae6a5a4.js.map
292923 bytes
0644
AlertingUpgrade.c757b99e306db50cdb16.js
31333 bytes
0644
AlertingUpgrade.c757b99e306db50cdb16.js.map
98330 bytes
0644
AngularApp.7e72879caebef22a5217.js
72809 bytes
0644
AngularApp.7e72879caebef22a5217.js.map
102853 bytes
0644
ApiKeysPage.12b0cd511f7b1e9c50dc.js
8422 bytes
0644
ApiKeysPage.12b0cd511f7b1e9c50dc.js.map
23375 bytes
0644
BenchmarksPage.3a183df3d44714f9a96a.js
2941 bytes
0644
BenchmarksPage.3a183df3d44714f9a96a.js.map
9749 bytes
0644
ChangePasswordPage.5e0562f6a9674bd95cfe.js
470 bytes
0644
ChangePasswordPage.5e0562f6a9674bd95cfe.js.map
1195 bytes
0644
Connections.b53c715b9b9a782d8647.js
32448 bytes
0644
Connections.b53c715b9b9a782d8647.js.map
112998 bytes
0644
CorrelationsFeatureToggle.71addced22f59948b708.js
674 bytes
0644
CorrelationsFeatureToggle.71addced22f59948b708.js.map
1149 bytes
0644
CorrelationsPage.4e02feddf752bdf7cfe6.js
22725 bytes
0644
CorrelationsPage.4e02feddf752bdf7cfe6.js.map
69262 bytes
0644
CreateTeam.dbde5b87278cf087cc5e.js
3046 bytes
0644
CreateTeam.dbde5b87278cf087cc5e.js.map
9594 bytes
0644
DashboardImport.06e6c4c03113061aae6c.js
18153 bytes
0644
DashboardImport.06e6c4c03113061aae6c.js.map
58242 bytes
0644
DashboardListPage.dac1fe75fbaa4f9b1c23.js
30967 bytes
0644
DashboardListPage.dac1fe75fbaa4f9b1c23.js.map
108517 bytes
0644
DashboardPage.5e50193556ad6b828f5d.js
2786 bytes
0644
DashboardPage.5e50193556ad6b828f5d.js.map
8754 bytes
0644
DashboardPageProxy.9a6d60e5cac89c11c71c.js
65136 bytes
0644
DashboardPageProxy.9a6d60e5cac89c11c71c.js.map
226791 bytes
0644
DataTrailsPage.aa19ca6750eb3f91ac5d.js
331 bytes
0644
DataTrailsPage.aa19ca6750eb3f91ac5d.js.map
582 bytes
0644
EditNotificationChannelLegacy.75122e6dbfb215d89d81.js
10507 bytes
0644
EditNotificationChannelLegacy.75122e6dbfb215d89d81.js.map
37444 bytes
0644
EmbeddedDashboard.3856404d3d608c739864.js
1768 bytes
0644
EmbeddedDashboard.3856404d3d608c739864.js.map
5917 bytes
0644
FolderAlerting.a0fe69e3574320c8a74a.js
9633 bytes
0644
FolderAlerting.a0fe69e3574320c8a74a.js.map
29985 bytes
0644
FolderLibraryPanelsPage.95dd7bf6735e202a79d2.js
8599 bytes
0644
FolderLibraryPanelsPage.95dd7bf6735e202a79d2.js.map
25919 bytes
0644
LibraryPanelsPage.4a952d4aa9c21984995a.js
2704 bytes
0644
LibraryPanelsPage.4a952d4aa9c21984995a.js.map
7623 bytes
0644
ListPublicDashboardPage.469a693c4011a5193fcd.js
4713 bytes
0644
ListPublicDashboardPage.469a693c4011a5193fcd.js.map
14309 bytes
0644
MuteTimings.cb66b37f52c9ee3ce1da.js
20855 bytes
0644
MuteTimings.cb66b37f52c9ee3ce1da.js.map
58932 bytes
0644
NewNotificationChannelLegacy.1d57814bc534bb1a3681.js
9785 bytes
0644
NewNotificationChannelLegacy.1d57814bc534bb1a3681.js.map
32951 bytes
0644
NewOrgPage.2bb0e1cab09f0cbd0310.js
1325 bytes
0644
NewOrgPage.2bb0e1cab09f0cbd0310.js.map
3158 bytes
0644
NotificationsListLegacyPage.33212668898a6db361a8.js
2547 bytes
0644
NotificationsListLegacyPage.33212668898a6db361a8.js.map
6671 bytes
0644
NotificationsListPage.1eb9cb05bf88eee08291.js
1620 bytes
0644
NotificationsListPage.1eb9cb05bf88eee08291.js.map
3378 bytes
0644
NotificationsPage.d26b90d7348139106351.js
4646 bytes
0644
NotificationsPage.d26b90d7348139106351.js.map
25381 bytes
0644
OrgDetailsPage.2d5c98f188683c2e1d3b.js
6742 bytes
0644
OrgDetailsPage.2d5c98f188683c2e1d3b.js.map
17850 bytes
0644
PlaylistEditPage.d14b3673a1bb03ca0dbb.js
6892 bytes
0644
PlaylistEditPage.d14b3673a1bb03ca0dbb.js.map
19989 bytes
0644
PlaylistNewPage.13696f39b95b8416ede2.js
6583 bytes
0644
PlaylistNewPage.13696f39b95b8416ede2.js.map
19084 bytes
0644
PlaylistPage.8f45dcc09add615f90e8.js
7895 bytes
0644
PlaylistPage.8f45dcc09add615f90e8.js.map
25502 bytes
0644
PlaylistStartPage.8be462b13a24cddee188.js
275 bytes
0644
PlaylistStartPage.8be462b13a24cddee188.js.map
698 bytes
0644
PluginListPage.815b65d32380d0a800f7.js
12167 bytes
0644
PluginListPage.815b65d32380d0a800f7.js.map
43537 bytes
0644
PluginPage.c790de5e17a0b728dd3a.js
314 bytes
0644
PluginPage.c790de5e17a0b728dd3a.js.map
668 bytes
0644
ProfileFeatureTogglePage.a14257ebc5da1e8c85e0.js
552 bytes
0644
ProfileFeatureTogglePage.a14257ebc5da1e8c85e0.js.map
1012 bytes
0644
PublicDashboardPage.51c7c24941781e091898.js
4295 bytes
0644
PublicDashboardPage.51c7c24941781e091898.js.map
14393 bytes
0644
SelectOrgPage.695c19a5101a3a03ee28.js
1124 bytes
0644
SelectOrgPage.695c19a5101a3a03ee28.js.map
2993 bytes
0644
SendResetMailPage.f16b7172a87070f57227.js
1736 bytes
0644
SendResetMailPage.f16b7172a87070f57227.js.map
4350 bytes
0644
ServerStats.3fbd2493deb8f4598755.js
3863 bytes
0644
ServerStats.3fbd2493deb8f4598755.js.map
11534 bytes
0644
ServiceAccountCreatePage.4f989fb6cd2a41193ff0.js
2440 bytes
0644
ServiceAccountCreatePage.4f989fb6cd2a41193ff0.js.map
7939 bytes
0644
ServiceAccountPage.bc7c35b63b03ccc89628.js
14806 bytes
0644
ServiceAccountPage.bc7c35b63b03ccc89628.js.map
51593 bytes
0644
ServiceAccountsPage.baaa08c045390c05e276.js
14565 bytes
0644
ServiceAccountsPage.baaa08c045390c05e276.js.map
46399 bytes
0644
SignupInvited.81ad56aceb8dd1839e15.js
2360 bytes
0644
SignupInvited.81ad56aceb8dd1839e15.js.map
6096 bytes
0644
SnapshotListPage.519c760ed66124a771ff.js
3061 bytes
0644
SnapshotListPage.519c760ed66124a771ff.js.map
9043 bytes
0644
SoloPanelPage.c729750a88c3fa90d1cc.js
3229 bytes
0644
SoloPanelPage.c729750a88c3fa90d1cc.js.map
12316 bytes
0644
SoloPanelPageOld.6518c21ccaf29701fa97.js
1727 bytes
0644
SoloPanelPageOld.6518c21ccaf29701fa97.js.map
5509 bytes
0644
StoragePage.9b93a99e75f7f2842c11.js
14081 bytes
0644
StoragePage.9b93a99e75f7f2842c11.js.map
48740 bytes
0644
SupportBundles.567d512b3f919b8112e4.js
3058 bytes
0644
SupportBundles.567d512b3f919b8112e4.js.map
8751 bytes
0644
SupportBundlesCreate.fc6b6e4cf6366f751081.js
2779 bytes
0644
SupportBundlesCreate.fc6b6e4cf6366f751081.js.map
8882 bytes
0644
TeamList.2e23d37c91734f608f09.js
9019 bytes
0644
TeamList.2e23d37c91734f608f09.js.map
30348 bytes
0644
TeamPages.4f6177b4c6ec769c72d8.js
22839 bytes
0644
TeamPages.4f6177b4c6ec769c72d8.js.map
66001 bytes
0644
TestStuffPage.8ddabdd17d265b771b17.js
2654 bytes
0644
TestStuffPage.8ddabdd17d265b771b17.js.map
8058 bytes
0644
UserCreatePage.72e86cf2c9a3ce50cff3.js
1470 bytes
0644
UserCreatePage.72e86cf2c9a3ce50cff3.js.map
3788 bytes
0644
UserInvitePage.c8243c9cee4b06e10222.js
2576 bytes
0644
UserInvitePage.c8243c9cee4b06e10222.js.map
6594 bytes
0644
UserListPage.acbb5778a782ca90c7ba.js
25463 bytes
0644
UserListPage.acbb5778a782ca90c7ba.js.map
79671 bytes
0644
UserProfileEditPage.7cc4c218d9e4664250e3.js
14593 bytes
0644
UserProfileEditPage.7cc4c218d9e4664250e3.js.map
42901 bytes
0644
UsersListPage.1b61c82d62ca416b6f2f.js
8800 bytes
0644
UsersListPage.1b61c82d62ca416b6f2f.js.map
30059 bytes
0644
alert-rules-drawer-content.1fd9de3b496d077a5f3a.js
957 bytes
0644
alert-rules-drawer-content.1fd9de3b496d077a5f3a.js.map
3199 bytes
0644
alert-rules-toolbar-button.6f275f0d03748b6c297d.js
1429 bytes
0644
alert-rules-toolbar-button.6f275f0d03748b6c297d.js.map
4041 bytes
0644
alertmanagerPlugin.d13ca72afb3f996bb284.js
3810 bytes
0644
alertmanagerPlugin.d13ca72afb3f996bb284.js.map
10753 bytes
0644
app.b11fde05d43f9632a473.js
920821 bytes
0644
app.b11fde05d43f9632a473.js.map
69088 bytes
0644
assets-manifest.json
280835 bytes
0644
azureMonitorPlugin.0bc37a9d4e3bd8421cc0.js
232 bytes
0644
azureMonitorPlugin.0bc37a9d4e3bd8421cc0.js.map
600 bytes
0644
brace.fcd4b1c7e8b9264ab02c.js
371235 bytes
0644
brace.fcd4b1c7e8b9264ab02c.js.map
1132097 bytes
0644
canvasPanel.a46aa5e57d26b1fcc380.js
485254 bytes
0644
canvasPanel.a46aa5e57d26b1fcc380.js.map
2136916 bytes
0644
cloudMonitoringPlugin.c6ea431eae8e9ad2c7b1.js
198 bytes
0644
cloudMonitoringPlugin.c6ea431eae8e9ad2c7b1.js.map
555 bytes
0644
cloudwatchPlugin.06ef34f60000c4f7ea37.js
192 bytes
0644
cloudwatchPlugin.06ef34f60000c4f7ea37.js.map
544 bytes
0644
dark.7fa24d1908c1c96e6fcc.js
134 bytes
0644
elasticsearchPlugin.3f2edb012f5162b48903.js
214 bytes
0644
elasticsearchPlugin.3f2edb012f5162b48903.js.map
583 bytes
0644
explore-feature-toggle-page.897d9f08c342ad4c0702.js
612 bytes
0644
explore-feature-toggle-page.897d9f08c342ad4c0702.js.map
1280 bytes
0644
explore.476912733278e2a99729.js
165810 bytes
0644
explore.476912733278e2a99729.js.map
579148 bytes
0644
geomapPanel.14b9605971a38c51d262.js
417078 bytes
0644
geomapPanel.14b9605971a38c51d262.js.map
540371 bytes
0644
grafana.dark.8c716fbcf630eae84ced.css
209089 bytes
0644
grafana.light.b8b3904788f25480f4a1.css
209047 bytes
0644
grafanaPlugin.1cb208185a89de28dc3a.js
8654 bytes
0644
grafanaPlugin.1cb208185a89de28dc3a.js.map
28174 bytes
0644
graphPlugin.f47f722cdfc0ceb85136.js
70277 bytes
0644
graphPlugin.f47f722cdfc0ceb85136.js.map
243430 bytes
0644
graphitePlugin.d59175976346917781fe.js
75305 bytes
0644
graphitePlugin.d59175976346917781fe.js.map
272016 bytes
0644
heatmapPanel.f6f29a53ed0f682b4404.js
37545 bytes
0644
heatmapPanel.f6f29a53ed0f682b4404.js.map
158066 bytes
0644
influxdbPlugin.140a7777089f9559c11c.js
68843 bytes
0644
influxdbPlugin.140a7777089f9559c11c.js.map
265085 bytes
0644
jaegerPlugin.d254fd4a19ef0cb5b4f5.js
19727 bytes
0644
jaegerPlugin.d254fd4a19ef0cb5b4f5.js.map
65603 bytes
0644
light.af65e5ce03b9ed0aa2b1.js
134 bytes
0644
loki-query-field.a588d587d9d762b18f22.js
191 bytes
0644
loki-query-field.a588d587d9d762b18f22.js.map
548 bytes
0644
lokiPlugin.77364509de280321b6f8.js
185 bytes
0644
lokiPlugin.77364509de280321b6f8.js.map
536 bytes
0644
mixedPlugin.f36bd557a883d9a67538.js
180 bytes
0644
mssqlPlugin.88775f59ced74c2283c5.js
20457 bytes
0644
mssqlPlugin.88775f59ced74c2283c5.js.map
61420 bytes
0644
mysqlPlugin.72fb44411afd8165d201.js
17323 bytes
0644
mysqlPlugin.72fb44411afd8165d201.js.map
45415 bytes
0644
nodeGraphPanel.9a7cdd8efdae281cbe28.js
2107 bytes
0644
nodeGraphPanel.9a7cdd8efdae281cbe28.js.map
7132 bytes
0644
opentsdbPlugin.418b8c8ea0d97ed99edb.js
22866 bytes
0644
opentsdbPlugin.418b8c8ea0d97ed99edb.js.map
82180 bytes
0644
parcaPlugin.7f2e6dde7161b08ceed2.js
11184 bytes
0644
parcaPlugin.7f2e6dde7161b08ceed2.js.map
42340 bytes
0644
postgresPlugin.f88c598bae2653ae177b.js
18902 bytes
0644
postgresPlugin.f88c598bae2653ae177b.js.map
54304 bytes
0644
prom-query-field.ff217c474ea457bdd65e.js
14104 bytes
0644
prom-query-field.ff217c474ea457bdd65e.js.map
76811 bytes
0644
prometheusPlugin.2ba02c28d3f7293e903e.js
224 bytes
0644
prometheusPlugin.2ba02c28d3f7293e903e.js.map
699 bytes
0644
pyroscopePlugin.eb14b78419d619d90dca.js
22269 bytes
0644
pyroscopePlugin.eb14b78419d619d90dca.js.map
86896 bytes
0644
react-monaco-editor.988b1aa5e90b11f9941a.js
15759 bytes
0644
react-monaco-editor.988b1aa5e90b11f9941a.js.map
51544 bytes
0644
runtime.4b7e1b5735d2ed64b824.js
13640 bytes
0644
runtime.4b7e1b5735d2ed64b824.js.map
35122 bytes
0644
tableOldPlugin.8c72b8399d197aeebe16.js
25242 bytes
0644
tableOldPlugin.8c72b8399d197aeebe16.js.map
80497 bytes
0644
tempoPlugin.efa8c2a55984263b4b61.js
182 bytes
0644
tempoPlugin.efa8c2a55984263b4b61.js.map
529 bytes
0644
testDataDSPlugin.9717509b124d754e4f35.js
120550 bytes
0644
testDataDSPlugin.9717509b124d754e4f35.js.map
303302 bytes
0644
visjs-network.d93b3aa71ac24c8cde84.js
459653 bytes
0644
visjs-network.d93b3aa71ac24c8cde84.js.map
1951742 bytes
0644
zipkinPlugin.70f0f24b6d0b6e673ccb.js
13172 bytes
0644
zipkinPlugin.70f0f24b6d0b6e673ccb.js.map
46861 bytes
0644
N4ST4R_ID | Naxtarrr