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AA,iBAAiBrH,IACxCsH,gBbCI,YAOsB,IAPO,WAClCznB,EADkC,WAElCwI,EAFkC,SAGlCC,EAHkC,MAIlClC,EAJkC,MAKlCiB,EALkC,QAMlCnB,GAC2B,EAC3B,OACE,SAACkC,EAAD,CACEvI,WAAYA,EACZwI,WAAYA,EACZC,SAAUA,EACVlC,MAAOA,EACPF,QAASA,EACTmB,MAAOA,EANT,kBAQE,SAACiN,GAAD,UajBHiT,gBAAgBpM,IAChBqM,qBAAqB7R,IACrB8R,uBAAuBN,K,gDCdX,SAASpe,EAAY5D,GAChC,IAAIuiB,GAAM,IAAAC,UAIV,OAHA,IAAA3e,YAAU,WACN0e,EAAIE,QAAUziB,KAEXuiB,EAAIE","sources":["webpack://grafana/./public/app/plugins/datasource/graphite/state/actions.ts","webpack://grafana/./public/app/plugins/datasource/graphite/lexer.ts","webpack://grafana/./public/app/plugins/datasource/graphite/parser.ts","webpack://grafana/./public/app/plugins/datasource/graphite/graphite_query.ts","webpack://grafana/./public/app/plugins/datasource/graphite/state/helpers.ts","webpack://grafana/./public/app/plugins/datasource/graphite/state/store.ts","webpack://grafana/./public/app/plugins/datasource/graphite/state/context.tsx","webpack://grafana/./public/app/plugins/datasource/graphite/components/helpers.ts","webpack://grafana/./public/app/plugins/datasource/graphite/components/AddGraphiteFunction.tsx","webpack://grafana/./public/app/plugins/datasource/graphite/components/FunctionEditorControls.tsx","webpack://grafana/./public/app/plugins/datasource/graphite/components/FunctionEditor.tsx","webpack://grafana/./public/app/plugins/datasource/graphite/components/FunctionParamEditor.tsx","webpack://grafana/./public/app/plugins/datasource/graphite/components/GraphiteFunctionEditor.tsx","webpack://grafana/./public/app/plugins/datasource/graphite/components/FunctionsSection.tsx","webpack://grafana/./public/app/plugins/datasource/graphite/components/GraphiteTextEditor.tsx","webpack://grafana/./public/app/plugins/datasource/graphite/state/providers.ts","webpack://grafana/./public/app/plugins/datasource/graphite/components/MetricSegment.tsx","webpack://grafana/./public/app/plugins/datasource/graphite/components/MetricsSection.tsx","webpack://grafana/./public/app/plugins/datasource/graphite/components/PlayButton.tsx","webpack://grafana/./public/app/plugins/datasource/graphite/components/TagEditor.tsx","webpack://grafana/./public/app/plugins/datasource/graphite/components/TagsSection.tsx","webpack://grafana/./public/app/plugins/datasource/graphite/components/SeriesSection.tsx","webpack://grafana/./public/app/plugins/datasource/graphite/components/GraphiteQueryEditor.tsx","webpack://grafana/./public/app/plugins/datasource/graphite/meta.ts","webpack://grafana/./public/app/plugins/datasource/graphite/components/MetricTankMetaInspector.tsx","webpack://grafana/./public/app/plugins/datasource/graphite/types.ts","webpack://grafana/./public/app/plugins/datasource/graphite/versions.ts","webpack://grafana/./public/app/plugins/datasource/graphite/configuration/MappingsHelp.tsx","webpack://grafana/./public/app/plugins/datasource/graphite/configuration/MappingsConfiguration.tsx","webpack://grafana/./public/app/plugins/datasource/graphite/configuration/parseLokiLabelMappings.ts","webpack://grafana/./public/app/plugins/datasource/graphite/configuration/ConfigEditor.tsx","webpack://grafana/./public/app/core/utils/version.ts","webpack://grafana/./public/app/plugins/datasource/graphite/gfunc.ts","webpack://grafana/./public/app/plugins/datasource/graphite/datasource.ts","webpack://grafana/./public/app/plugins/datasource/graphite/utils.ts","webpack://grafana/./public/app/plugins/datasource/graphite/module.ts","webpack://grafana/./.yarn/__virtual__/react-use-virtual-00326e70ba/3/opt/drone/yarncache/react-use-npm-17.3.2-a032cbeb01-7379460f51.zip/node_modules/react-use/esm/usePrevious.js"],"sourcesContent":["import { createAction } from '@reduxjs/toolkit';\n\nimport { TimeRange } from '@grafana/data';\n\nimport { FuncInstance } from '../gfunc';\nimport { GraphiteQuery, GraphiteQueryEditorDependencies, GraphiteSegment, GraphiteTag } from '../types';\n\n/**\n * List of possible actions changing the state of QueryEditor\n */\n\nconst init = createAction<GraphiteQueryEditorDependencies>('init');\n\n/**\n * Synchronise editor dependencies with internal state.\n */\nconst timeRangeChanged = createAction<TimeRange | undefined>('time-range-changed');\nconst queriesChanged = createAction<GraphiteQuery[] | undefined>('queries-changed');\nconst queryChanged = createAction<GraphiteQuery>('query-changed');\n\n// Metrics & Tags\nconst segmentValueChanged = createAction<{ segment: GraphiteSegment | string; index: number }>('segment-value-changed');\n\n// Tags\nconst addNewTag = createAction<{ segment: GraphiteSegment }>('add-new-tag');\nconst tagChanged = createAction<{ tag: GraphiteTag; index: number }>('tag-changed');\nconst unpause = createAction('unpause');\n\n// Functions\nconst addFunction = createAction<{ name: string }>('add-function');\nconst removeFunction = createAction<{ func: FuncInstance }>('remove-function');\nconst moveFunction = createAction<{ func: FuncInstance; offset: number }>('move-function');\nconst updateFunctionParam = createAction<{ func: FuncInstance; index: number; value: string }>('change-function-param');\n\n// Text editor\nconst updateQuery = createAction<{ query: string }>('update-query');\nconst runQuery = createAction('run-current-query');\nconst toggleEditorMode = createAction('toggle-editor');\n\nexport const actions = {\n init,\n timeRangeChanged,\n queriesChanged,\n queryChanged,\n segmentValueChanged,\n tagChanged,\n addNewTag,\n unpause,\n addFunction,\n removeFunction,\n moveFunction,\n updateFunctionParam,\n updateQuery,\n runQuery,\n toggleEditorMode,\n};\n","import { bind } from 'lodash';\n\n// This is auto generated from the unicode tables.\n// The tables are at:\n// http://www.fileformat.info/info/unicode/category/Lu/list.htm\n// http://www.fileformat.info/info/unicode/category/Ll/list.htm\n// http://www.fileformat.info/info/unicode/category/Lt/list.htm\n// http://www.fileformat.info/info/unicode/category/Lm/list.htm\n// http://www.fileformat.info/info/unicode/category/Lo/list.htm\n// http://www.fileformat.info/info/unicode/category/Nl/list.htm\n\nconst unicodeLetterTable = [\n 170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886,\n 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369,\n 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786,\n 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069,\n 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425,\n 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525,\n 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649,\n 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749,\n 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908,\n 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975,\n 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133,\n 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294,\n 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461,\n 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716,\n 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757,\n 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980,\n 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256,\n 4293, 4304, 4346, 4348, 4348, 4352, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749,\n 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992,\n 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937,\n 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320,\n 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963,\n 6981, 6987, 7043, 7072, 7086, 7087, 7104, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7424,\n 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061,\n 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182,\n 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484,\n 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312,\n 11358, 11360, 11492, 11499, 11502, 11520, 11557, 11568, 11621, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694,\n 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321,\n 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686,\n 12704, 12730, 12784, 12799, 13312, 13312, 19893, 19893, 19968, 19968, 40907, 40907, 40960, 42124, 42192, 42237, 42240,\n 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894,\n 42896, 42897, 42912, 42921, 43002, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250,\n 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586,\n 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714,\n 43714, 43739, 43741, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 44032,\n 55203, 55203, 55216, 55238, 55243, 55291, 63744, 64045, 64048, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285,\n 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829,\n 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474,\n 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613,\n 65616, 65629, 65664, 65786, 65856, 65908, 66176, 66204, 66208, 66256, 66304, 66334, 66352, 66378, 66432, 66461, 66464,\n 66499, 66504, 66511, 66513, 66517, 66560, 66717, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644,\n 67647, 67669, 67840, 67861, 67872, 67897, 68096, 68096, 68112, 68115, 68117, 68119, 68121, 68147, 68192, 68220, 68352,\n 68405, 68416, 68437, 68448, 68466, 68608, 68680, 69635, 69687, 69763, 69807, 73728, 74606, 74752, 74850, 77824, 78894,\n 92160, 92728, 110592, 110593, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977,\n 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086,\n 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488,\n 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688,\n 120712, 120714, 120744, 120746, 120770, 120772, 120779, 131072, 131072, 173782, 173782, 173824, 173824, 177972,\n 177972, 177984, 177984, 178205, 178205, 194560, 195101,\n];\n\nconst identifierStartTable: any[] = [];\n\nfor (let i = 0; i < 128; i++) {\n identifierStartTable[i] =\n (i >= 48 && i <= 57) || // 0-9\n i === 36 || // $\n i === 126 || // ~\n i === 124 || // |\n (i >= 65 && i <= 90) || // A-Z\n i === 95 || // _\n i === 45 || // -\n i === 42 || // *\n i === 58 || // :\n i === 91 || // templateStart [\n i === 93 || // templateEnd ]\n i === 63 || // ?\n i === 37 || // %\n i === 35 || // #\n i === 61 || // =\n (i >= 97 && i <= 122); // a-z\n}\n\nconst identifierPartTable = identifierStartTable;\n\nexport class Lexer {\n input: any;\n char: number;\n from: number;\n\n constructor(expression: any) {\n this.input = expression;\n this.char = 1;\n this.from = 1;\n }\n\n peek(i?: number) {\n return this.input.charAt(i || 0);\n }\n\n skip(i?: number) {\n i = i || 1;\n this.char += i;\n this.input = this.input.slice(i);\n }\n\n tokenize() {\n const list = [];\n let token = this.next();\n while (token) {\n list.push(token);\n token = this.next();\n }\n return list;\n }\n\n next() {\n this.from = this.char;\n\n // Move to the next non-space character.\n if (/\\s/.test(this.peek())) {\n while (/\\s/.test(this.peek())) {\n this.from += 1;\n this.skip();\n }\n\n if (this.peek() === '') {\n // EOL\n return null;\n }\n }\n\n let match = this.scanStringLiteral();\n if (match) {\n return match;\n }\n\n match = this.scanPunctuator() || this.scanNumericLiteral() || this.scanIdentifier() || this.scanTemplateSequence();\n\n if (match) {\n this.skip(match.value.length);\n return match;\n }\n\n // No token could be matched, give up.\n return null;\n }\n\n scanTemplateSequence() {\n if (this.peek() === '[' && this.peek(1) === '[') {\n return {\n type: 'templateStart',\n value: '[[',\n pos: this.char,\n };\n }\n\n if (this.peek() === ']' && this.peek(1) === ']') {\n return {\n type: 'templateEnd',\n value: '[[',\n pos: this.char,\n };\n }\n\n return null;\n }\n\n /*\n * Extract a JavaScript identifier out of the next sequence of\n * characters or return 'null' if its not possible. In addition,\n * to Identifier this method can also produce BooleanLiteral\n * (true/false) and NullLiteral (null).\n */\n scanIdentifier() {\n let id = '';\n let index = 0;\n let type, char;\n\n // Detects any character in the Unicode categories \"Uppercase\n // letter (Lu)\", \"Lowercase letter (Ll)\", \"Titlecase letter\n // (Lt)\", \"Modifier letter (Lm)\", \"Other letter (Lo)\", or\n // \"Letter number (Nl)\".\n //\n // Both approach and unicodeLetterTable were borrowed from\n // Google's Traceur.\n\n function isUnicodeLetter(code: number) {\n for (let i = 0; i < unicodeLetterTable.length; ) {\n if (code < unicodeLetterTable[i++]) {\n return false;\n }\n\n if (code <= unicodeLetterTable[i++]) {\n return true;\n }\n }\n\n return false;\n }\n\n function isHexDigit(str: string) {\n return /^[0-9a-fA-F]$/.test(str);\n }\n\n const readUnicodeEscapeSequence = bind(function (this: any) {\n index += 1;\n\n if (this.peek(index) !== 'u') {\n return null;\n }\n\n const ch1 = this.peek(index + 1);\n const ch2 = this.peek(index + 2);\n const ch3 = this.peek(index + 3);\n const ch4 = this.peek(index + 4);\n let code;\n\n if (isHexDigit(ch1) && isHexDigit(ch2) && isHexDigit(ch3) && isHexDigit(ch4)) {\n code = parseInt(ch1 + ch2 + ch3 + ch4, 16);\n\n if (isUnicodeLetter(code)) {\n index += 5;\n return '\\\\u' + ch1 + ch2 + ch3 + ch4;\n }\n\n return null;\n }\n\n return null;\n }, this);\n\n const getIdentifierStart = bind(function (this: any) {\n const chr = this.peek(index);\n const code = chr.charCodeAt(0);\n\n if (chr === '*') {\n index += 1;\n return chr;\n }\n\n if (code === 92) {\n return readUnicodeEscapeSequence();\n }\n\n if (code < 128) {\n if (identifierStartTable[code]) {\n index += 1;\n return chr;\n }\n\n return null;\n }\n\n if (isUnicodeLetter(code)) {\n index += 1;\n return chr;\n }\n\n return null;\n }, this);\n\n const getIdentifierPart = bind(function (this: any) {\n const chr = this.peek(index);\n const code = chr.charCodeAt(0);\n\n if (code === 92) {\n return readUnicodeEscapeSequence();\n }\n\n if (code < 128) {\n if (identifierPartTable[code]) {\n index += 1;\n return chr;\n }\n\n return null;\n }\n\n if (isUnicodeLetter(code)) {\n index += 1;\n return chr;\n }\n\n return null;\n }, this);\n\n char = getIdentifierStart();\n if (char === null) {\n return null;\n }\n\n id = char;\n for (;;) {\n char = getIdentifierPart();\n\n if (char === null) {\n break;\n }\n\n id += char;\n }\n\n switch (id) {\n case 'true': {\n type = 'bool';\n break;\n }\n case 'false': {\n type = 'bool';\n break;\n }\n default:\n type = 'identifier';\n }\n\n return {\n type: type,\n value: id,\n pos: this.char,\n };\n }\n\n /*\n * Extract a numeric literal out of the next sequence of\n * characters or return 'null' if its not possible. This method\n * supports all numeric literals described in section 7.8.3\n * of the EcmaScript 5 specification.\n *\n * This method's implementation was heavily influenced by the\n * scanNumericLiteral function in the Esprima parser's source code.\n */\n scanNumericLiteral(): any {\n let index = 0;\n let value = '';\n const length = this.input.length;\n let char = this.peek(index);\n let bad;\n\n function isDecimalDigit(str: string) {\n return /^[0-9]$/.test(str);\n }\n\n function isOctalDigit(str: string) {\n return /^[0-7]$/.test(str);\n }\n\n function isHexDigit(str: string) {\n return /^[0-9a-fA-F]$/.test(str);\n }\n\n function isIdentifierStart(ch: string) {\n return ch === '$' || ch === '_' || ch === '\\\\' || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z');\n }\n\n // handle negative num literals\n if (char === '-') {\n value += char;\n index += 1;\n char = this.peek(index);\n }\n\n // Numbers must start either with a decimal digit or a point.\n if (char !== '.' && !isDecimalDigit(char)) {\n return null;\n }\n\n if (char !== '.') {\n value += this.peek(index);\n index += 1;\n char = this.peek(index);\n\n if (value === '0') {\n // Base-16 numbers.\n if (char === 'x' || char === 'X') {\n index += 1;\n value += char;\n\n while (index < length) {\n char = this.peek(index);\n if (!isHexDigit(char)) {\n break;\n }\n value += char;\n index += 1;\n }\n\n if (value.length <= 2) {\n // 0x\n return {\n type: 'number',\n value: value,\n isMalformed: true,\n pos: this.char,\n };\n }\n\n if (index < length) {\n char = this.peek(index);\n if (isIdentifierStart(char)) {\n return null;\n }\n }\n\n return {\n type: 'number',\n value: value,\n base: 16,\n isMalformed: false,\n pos: this.char,\n };\n }\n\n // Base-8 numbers.\n if (isOctalDigit(char)) {\n index += 1;\n value += char;\n bad = false;\n\n while (index < length) {\n char = this.peek(index);\n\n // Numbers like '019' (note the 9) are not valid octals\n // but we still parse them and mark as malformed.\n\n if (isDecimalDigit(char)) {\n bad = true;\n }\n if (!isOctalDigit(char)) {\n // if the char is a non punctuator then its not a valid number\n if (!this.isPunctuator(char)) {\n return null;\n }\n break;\n }\n value += char;\n index += 1;\n }\n\n if (index < length) {\n char = this.peek(index);\n if (isIdentifierStart(char)) {\n return null;\n }\n }\n\n return {\n type: 'number',\n value: value,\n base: 8,\n isMalformed: bad,\n };\n }\n\n // Decimal numbers that start with '0' such as '09' are illegal\n // but we still parse them and return as malformed.\n\n if (isDecimalDigit(char)) {\n index += 1;\n value += char;\n }\n }\n\n while (index < length) {\n char = this.peek(index);\n if (!isDecimalDigit(char)) {\n break;\n }\n value += char;\n index += 1;\n }\n }\n\n // Decimal digits.\n\n if (char === '.') {\n value += char;\n index += 1;\n\n while (index < length) {\n char = this.peek(index);\n if (!isDecimalDigit(char)) {\n break;\n }\n value += char;\n index += 1;\n }\n }\n\n // Exponent part.\n\n if (char === 'e' || char === 'E') {\n value += char;\n index += 1;\n char = this.peek(index);\n\n if (char === '+' || char === '-') {\n value += this.peek(index);\n index += 1;\n }\n\n char = this.peek(index);\n if (isDecimalDigit(char)) {\n value += char;\n index += 1;\n\n while (index < length) {\n char = this.peek(index);\n if (!isDecimalDigit(char)) {\n break;\n }\n value += char;\n index += 1;\n }\n } else {\n return null;\n }\n }\n\n if (index < length) {\n char = this.peek(index);\n if (!this.isPunctuator(char)) {\n return null;\n }\n }\n\n return {\n type: 'number',\n value: value,\n base: 10,\n pos: this.char,\n isMalformed: !isFinite(+value),\n };\n }\n\n isPunctuator(ch1: string) {\n switch (ch1) {\n case '.':\n case '(':\n case ')':\n case ',':\n case '{':\n case '}':\n return true;\n }\n\n return false;\n }\n\n scanPunctuator() {\n const ch1 = this.peek();\n\n if (this.isPunctuator(ch1)) {\n return {\n type: ch1,\n value: ch1,\n pos: this.char,\n };\n }\n\n return null;\n }\n\n /*\n * Extract a string out of the next sequence of characters and/or\n * lines or return 'null' if its not possible. Since strings can\n * span across multiple lines this method has to move the char\n * pointer.\n *\n * This method recognizes pseudo-multiline JavaScript strings:\n *\n * var str = \"hello\\\n * world\";\n */\n scanStringLiteral() {\n const quote = this.peek();\n\n // String must start with a quote.\n if (quote !== '\"' && quote !== \"'\") {\n return null;\n }\n\n let value = '';\n\n this.skip();\n\n while (this.peek() !== quote) {\n if (this.peek() === '') {\n // End Of Line\n return {\n type: 'string',\n value: value,\n isUnclosed: true,\n quote: quote,\n pos: this.char,\n };\n }\n\n const char = this.peek();\n const jump = 1; // A length of a jump, after we're done\n // parsing this character.\n\n value += char;\n this.skip(jump);\n }\n\n this.skip();\n return {\n type: 'string',\n value: value,\n isUnclosed: false,\n quote: quote,\n pos: this.char,\n };\n }\n}\n","import { Lexer } from './lexer';\n\nexport class Parser {\n expression: any;\n lexer: Lexer;\n tokens: any;\n index: number;\n\n constructor(expression: any) {\n this.expression = expression;\n this.lexer = new Lexer(expression);\n this.tokens = this.lexer.tokenize();\n this.index = 0;\n }\n\n getAst() {\n return this.start();\n }\n\n start() {\n try {\n return this.functionCall() || this.metricExpression();\n } catch (e) {\n return {\n type: 'error',\n message: e.message,\n pos: e.pos,\n };\n }\n }\n\n curlyBraceSegment() {\n if (this.match('identifier', '{') || this.match('{')) {\n let curlySegment = '';\n\n while (!this.match('') && !this.match('}')) {\n curlySegment += this.consumeToken().value;\n }\n\n if (!this.match('}')) {\n this.errorMark(\"Expected closing '}'\");\n }\n\n curlySegment += this.consumeToken().value;\n\n // if curly segment is directly followed by identifier\n // include it in the segment\n if (this.match('identifier')) {\n curlySegment += this.consumeToken().value;\n }\n\n return {\n type: 'segment',\n value: curlySegment,\n };\n } else {\n return null;\n }\n }\n\n metricSegment() {\n const curly = this.curlyBraceSegment();\n if (curly) {\n return curly;\n }\n\n if (this.match('identifier') || this.match('number')) {\n // hack to handle float numbers in metric segments\n const parts = this.consumeToken().value.split('.');\n if (parts.length === 2) {\n this.tokens.splice(this.index, 0, { type: '.' });\n this.tokens.splice(this.index + 1, 0, {\n type: 'number',\n value: parts[1],\n });\n }\n\n return {\n type: 'segment',\n value: parts[0],\n };\n }\n\n if (!this.match('templateStart')) {\n this.errorMark('Expected metric identifier');\n }\n\n this.consumeToken();\n\n if (!this.match('identifier')) {\n this.errorMark('Expected identifier after templateStart');\n }\n\n const node = {\n type: 'template',\n value: this.consumeToken().value,\n };\n\n if (!this.match('templateEnd')) {\n this.errorMark('Expected templateEnd');\n }\n\n this.consumeToken();\n return node;\n }\n\n metricExpression() {\n if (!this.match('templateStart') && !this.match('identifier') && !this.match('number') && !this.match('{')) {\n return null;\n }\n\n const node: any = {\n type: 'metric',\n segments: [],\n };\n\n node.segments.push(this.metricSegment());\n\n while (this.match('.')) {\n this.consumeToken();\n\n const segment = this.metricSegment();\n if (!segment) {\n this.errorMark('Expected metric identifier');\n }\n\n node.segments.push(segment);\n }\n\n return node;\n }\n\n functionCall() {\n if (!this.match('identifier', '(')) {\n return null;\n }\n\n const node: any = {\n type: 'function',\n name: this.consumeToken().value,\n };\n\n // consume left parenthesis\n this.consumeToken();\n\n node.params = this.functionParameters();\n\n if (!this.match(')')) {\n this.errorMark('Expected closing parenthesis');\n }\n\n this.consumeToken();\n\n return node;\n }\n\n boolExpression() {\n if (!this.match('bool')) {\n return null;\n }\n\n return {\n type: 'bool',\n value: this.consumeToken().value === 'true',\n };\n }\n\n functionParameters(): any {\n if (this.match(')') || this.match('')) {\n return [];\n }\n\n const param =\n this.functionCall() ||\n this.numericLiteral() ||\n this.seriesRefExpression() ||\n this.boolExpression() ||\n this.metricExpression() ||\n this.stringLiteral();\n\n if (!this.match(',')) {\n return [param];\n }\n\n this.consumeToken();\n return [param].concat(this.functionParameters());\n }\n\n seriesRefExpression() {\n if (!this.match('identifier')) {\n return null;\n }\n\n const value = this.tokens[this.index].value;\n if (!value.match(/\\#[A-Z]/)) {\n return null;\n }\n\n const token = this.consumeToken();\n\n return {\n type: 'series-ref',\n value: token.value,\n };\n }\n\n numericLiteral() {\n if (!this.match('number')) {\n return null;\n }\n\n return {\n type: 'number',\n value: parseFloat(this.consumeToken().value),\n };\n }\n\n stringLiteral() {\n if (!this.match('string')) {\n return null;\n }\n\n const token = this.consumeToken();\n if (token.isUnclosed) {\n throw { message: 'Unclosed string parameter', pos: token.pos };\n }\n\n return {\n type: 'string',\n value: token.value,\n };\n }\n\n errorMark(text: string) {\n const currentToken = this.tokens[this.index];\n const type = currentToken ? currentToken.type : 'end of string';\n throw {\n message: text + ' instead found ' + type,\n pos: currentToken ? currentToken.pos : this.lexer.char,\n };\n }\n\n // returns token value and incre\n consumeToken() {\n this.index++;\n return this.tokens[this.index - 1];\n }\n\n matchToken(type: any, index: number) {\n const token = this.tokens[this.index + index];\n return (token === undefined && type === '') || (token && token.type === type);\n }\n\n match(token1: any, token2?: any) {\n return this.matchToken(token1, 0) && (!token2 || this.matchToken(token2, 1));\n }\n}\n","import { compact, each, findIndex, flatten, get, join, keyBy, last, map, reduce, without } from 'lodash';\n\nimport { ScopedVars } from '@grafana/data';\nimport { TemplateSrv } from '@grafana/runtime';\nimport { arrayMove } from 'app/core/utils/arrayMove';\n\nimport { GraphiteDatasource } from './datasource';\nimport { FuncInstance } from './gfunc';\nimport { Parser } from './parser';\nimport { GraphiteSegment } from './types';\n\nexport type GraphiteTagOperator = '=' | '=~' | '!=' | '!=~';\n\nexport type GraphiteTag = {\n key: string;\n operator: GraphiteTagOperator;\n value: string;\n};\n\nexport type GraphiteTarget = {\n refId: string | number;\n target: string;\n /**\n * Contains full query after interpolating sub-queries (e.g. \"function(#A)\" referencing query with refId=A)\n */\n targetFull: string;\n textEditor: boolean;\n paused: boolean;\n};\n\nexport default class GraphiteQuery {\n datasource: GraphiteDatasource;\n target: GraphiteTarget;\n functions: FuncInstance[] = [];\n segments: GraphiteSegment[] = [];\n tags: GraphiteTag[] = [];\n error: any;\n seriesByTagUsed = false;\n checkOtherSegmentsIndex = 0;\n removeTagValue: string;\n templateSrv: any;\n scopedVars: any;\n\n /** @ngInject */\n constructor(datasource: any, target: any, templateSrv?: TemplateSrv, scopedVars?: ScopedVars) {\n this.datasource = datasource;\n this.target = target;\n this.templateSrv = templateSrv;\n this.scopedVars = scopedVars;\n this.parseTarget();\n\n this.removeTagValue = '-- remove tag --';\n }\n\n parseTarget() {\n this.functions = [];\n this.segments = [];\n this.tags = [];\n this.seriesByTagUsed = false;\n this.error = null;\n\n if (this.target.textEditor) {\n return;\n }\n\n const parser = new Parser(this.target.target);\n const astNode = parser.getAst();\n if (astNode === null) {\n this.checkOtherSegmentsIndex = 0;\n return;\n }\n\n if (astNode.type === 'error') {\n this.error = astNode.message + ' at position: ' + astNode.pos;\n this.target.textEditor = true;\n return;\n }\n\n try {\n this.parseTargetRecursive(astNode, null);\n } catch (err) {\n console.error('error parsing target:', err.message);\n this.error = err.message;\n this.target.textEditor = true;\n }\n\n this.checkOtherSegmentsIndex = this.segments.length - 1;\n }\n\n getSegmentPathUpTo(index: number) {\n const arr = this.segments.slice(0, index);\n\n return reduce(\n arr,\n (result, segment) => {\n return result ? result + '.' + segment.value : segment.value;\n },\n ''\n );\n }\n\n parseTargetRecursive(astNode: any, func: any): any {\n if (astNode === null) {\n return null;\n }\n\n switch (astNode.type) {\n case 'function':\n const innerFunc = this.datasource.createFuncInstance(astNode.name, {\n withDefaultParams: false,\n });\n each(astNode.params, (param) => {\n this.parseTargetRecursive(param, innerFunc);\n });\n\n innerFunc.updateText();\n this.functions.push(innerFunc);\n\n // extract tags from seriesByTag function and hide function\n if (innerFunc.def.name === 'seriesByTag' && !this.seriesByTagUsed) {\n this.seriesByTagUsed = true;\n innerFunc.hidden = true;\n this.tags = this.splitSeriesByTagParams(innerFunc);\n }\n\n break;\n case 'series-ref':\n if (this.segments.length > 0 || this.getSeriesByTagFuncIndex() >= 0) {\n this.addFunctionParameter(func, astNode.value);\n } else {\n this.segments.push(astNode);\n }\n break;\n case 'bool':\n case 'string':\n case 'number':\n this.addFunctionParameter(func, astNode.value);\n break;\n case 'metric':\n if (this.segments.length || this.tags.length) {\n this.addFunctionParameter(func, join(map(astNode.segments, 'value'), '.'));\n } else {\n this.segments = astNode.segments;\n }\n break;\n }\n }\n\n updateSegmentValue(segment: any, index: number) {\n this.segments[index].value = segment.value;\n }\n\n addSelectMetricSegment() {\n this.segments.push({ value: 'select metric' });\n }\n\n addFunction(newFunc: any) {\n this.functions.push(newFunc);\n }\n\n addFunctionParameter(func: any, value: string) {\n if (func.params.length >= func.def.params.length && !get(last(func.def.params), 'multiple', false)) {\n throw { message: 'too many parameters for function ' + func.def.name };\n }\n func.params.push(value);\n }\n\n removeFunction(func: any) {\n this.functions = without(this.functions, func);\n }\n\n moveFunction(func: any, offset: number) {\n const index = this.functions.indexOf(func);\n arrayMove(this.functions, index, index + offset);\n }\n\n updateModelTarget(targets: any) {\n const wrapFunction = (target: string, func: any) => {\n return func.render(target, (value: string) => {\n return this.templateSrv.replace(value, this.scopedVars);\n });\n };\n\n if (!this.target.textEditor) {\n const metricPath = this.getSegmentPathUpTo(this.segments.length).replace(/\\.?select metric$/, '');\n this.target.target = reduce(this.functions, wrapFunction, metricPath);\n }\n\n this.updateRenderedTarget(this.target, targets);\n\n // loop through other queries and update targetFull as needed\n for (const target of targets || []) {\n if (target.refId !== this.target.refId) {\n this.updateRenderedTarget(target, targets);\n }\n }\n\n // clean-up added param\n this.functions.forEach((func) => (func.added = false));\n }\n\n updateRenderedTarget(target: { refId: string | number; target: any; targetFull: any }, targets: any) {\n // render nested query\n const targetsByRefId = keyBy(targets, 'refId');\n\n // no references to self\n delete targetsByRefId[target.refId];\n\n const nestedSeriesRefRegex = /\\#([A-Z])/g;\n let targetWithNestedQueries = target.target;\n\n // Use ref count to track circular references\n function countTargetRefs(targetsByRefId: any, refId: string) {\n let refCount = 0;\n each(targetsByRefId, (t, id) => {\n if (id !== refId) {\n const match = nestedSeriesRefRegex.exec(t.target);\n const count = match && match.length ? match.length - 1 : 0;\n refCount += count;\n }\n });\n targetsByRefId[refId].refCount = refCount;\n }\n each(targetsByRefId, (t, id) => {\n countTargetRefs(targetsByRefId, id);\n });\n\n // Keep interpolating until there are no query references\n // The reason for the loop is that the referenced query might contain another reference to another query\n while (targetWithNestedQueries.match(nestedSeriesRefRegex)) {\n const updated = targetWithNestedQueries.replace(nestedSeriesRefRegex, (match: string, g1: string) => {\n const t = targetsByRefId[g1];\n if (!t) {\n return match;\n }\n\n // no circular references\n if (t.refCount === 0) {\n delete targetsByRefId[g1];\n }\n t.refCount--;\n\n return t.target;\n });\n\n if (updated === targetWithNestedQueries) {\n break;\n }\n\n targetWithNestedQueries = updated;\n }\n\n delete target.targetFull;\n if (target.target !== targetWithNestedQueries) {\n target.targetFull = targetWithNestedQueries;\n }\n }\n\n splitSeriesByTagParams(func: { params: any }) {\n const tagPattern = /([^\\!=~]+)(\\!?=~?)(.*)/;\n return flatten(\n map(func.params, (param: string) => {\n const matches = tagPattern.exec(param);\n if (matches) {\n const tag = matches.slice(1);\n if (tag.length === 3) {\n return {\n key: tag[0],\n operator: tag[1] as GraphiteTagOperator,\n value: tag[2],\n };\n }\n }\n return [];\n })\n );\n }\n\n getSeriesByTagFuncIndex() {\n return findIndex(this.functions, (func) => func.def.name === 'seriesByTag');\n }\n\n getSeriesByTagFunc() {\n const seriesByTagFuncIndex = this.getSeriesByTagFuncIndex();\n if (seriesByTagFuncIndex >= 0) {\n return this.functions[seriesByTagFuncIndex];\n } else {\n return undefined;\n }\n }\n\n addTag(tag: { key: any; operator: GraphiteTagOperator; value: string }) {\n const newTagParam = renderTagString(tag);\n this.getSeriesByTagFunc()!.params.push(newTagParam);\n this.tags.push(tag);\n }\n\n removeTag(index: number) {\n this.getSeriesByTagFunc()!.params.splice(index, 1);\n this.tags.splice(index, 1);\n }\n\n updateTag(tag: { key: string; operator: GraphiteTagOperator; value: string }, tagIndex: number) {\n this.error = null;\n\n if (tag.key === this.removeTagValue) {\n this.removeTag(tagIndex);\n if (this.tags.length === 0) {\n this.removeFunction(this.getSeriesByTagFunc());\n this.checkOtherSegmentsIndex = 0;\n this.seriesByTagUsed = false;\n }\n return;\n }\n\n this.getSeriesByTagFunc()!.params[tagIndex] = renderTagString(tag);\n this.tags[tagIndex] = tag;\n }\n\n renderTagExpressions(excludeIndex = -1) {\n return compact(\n map(this.tags, (tagExpr, index) => {\n // Don't render tag that we want to lookup\n if (index !== excludeIndex) {\n return tagExpr.key + tagExpr.operator + tagExpr.value;\n } else {\n return undefined;\n }\n })\n );\n }\n}\n\nfunction renderTagString(tag: { key: any; operator?: any; value?: any }) {\n return tag.key + tag.operator + tag.value;\n}\n","import { clone } from 'lodash';\n\nimport { createErrorNotification } from '../../../../core/copy/appNotification';\nimport { notifyApp } from '../../../../core/reducers/appNotification';\nimport { dispatch } from '../../../../store/store';\nimport { FuncInstance } from '../gfunc';\nimport { GraphiteQuery, GraphiteTagOperator } from '../types';\n\nimport { GraphiteQueryEditorState } from './store';\n\n/**\n * Helpers used by reducers and providers. They modify state object directly so should operate on a copy of the state.\n */\n\nexport const GRAPHITE_TAG_OPERATORS: GraphiteTagOperator[] = ['=', '!=', '=~', '!=~'];\n\n/**\n * Tag names and metric names are displayed in a single dropdown. This prefix is used to\n * distinguish both in the UI.\n */\nexport const TAG_PREFIX = 'tag: ';\n\n/**\n * Create new AST based on new query.\n * Build segments from parsed metric name and functions.\n */\nexport async function parseTarget(state: GraphiteQueryEditorState): Promise<void> {\n state.queryModel.parseTarget();\n await buildSegments(state);\n}\n\n/**\n * Create segments out of the current metric path + add \"select metrics\" if it's possible to add more to the path\n */\nexport async function buildSegments(state: GraphiteQueryEditorState, modifyLastSegment = true): Promise<void> {\n // Start with a shallow copy from the model, then check if \"select metric\" segment should be added at the end\n state.segments = clone(state.queryModel.segments);\n\n const checkOtherSegmentsIndex = state.queryModel.checkOtherSegmentsIndex || 0;\n\n await checkOtherSegments(state, checkOtherSegmentsIndex, modifyLastSegment);\n}\n\n/**\n * Add \"select metric\" segment at the end\n */\nexport function addSelectMetricSegment(state: GraphiteQueryEditorState): void {\n state.queryModel.addSelectMetricSegment();\n state.segments.push({ value: 'select metric', fake: true });\n}\n\n/**\n * Validates the state after adding or changing a segment:\n * - adds \"select metric\" only when more segments can be added to the metric name\n * - check if subsequent segments are still valid if in-between segment changes and\n * removes invalid segments.\n */\nexport async function checkOtherSegments(\n state: GraphiteQueryEditorState,\n fromIndex: number,\n modifyLastSegment = true\n): Promise<void> {\n if (state.queryModel.segments.length === 1 && state.queryModel.segments[0].type === 'series-ref') {\n return;\n }\n\n if (fromIndex === 0) {\n addSelectMetricSegment(state);\n return;\n }\n\n const path = state.queryModel.getSegmentPathUpTo(fromIndex + 1);\n if (path === '') {\n return;\n }\n\n try {\n const segments = await state.datasource.metricFindQuery(path);\n if (segments.length === 0) {\n if (path !== '' && modifyLastSegment) {\n state.queryModel.segments = state.queryModel.segments.splice(0, fromIndex);\n state.segments = state.segments.splice(0, fromIndex);\n addSelectMetricSegment(state);\n }\n } else if (segments[0].expandable) {\n if (state.segments.length === fromIndex) {\n addSelectMetricSegment(state);\n } else {\n await checkOtherSegments(state, fromIndex + 1);\n }\n }\n } catch (err) {\n handleMetricsAutoCompleteError(state, err);\n }\n}\n\nexport function spliceSegments(state: GraphiteQueryEditorState, index: number): void {\n state.segments = state.segments.splice(0, index);\n state.queryModel.segments = state.queryModel.segments.splice(0, index);\n}\n\nexport function emptySegments(state: GraphiteQueryEditorState): void {\n state.queryModel.segments = [];\n state.segments = [];\n}\n\n/**\n * When seriesByTag function is added the UI changes it's state and only tags can be added from now.\n */\nexport async function addSeriesByTagFunc(state: GraphiteQueryEditorState, tag: string): Promise<void> {\n const newFunc = state.datasource.createFuncInstance('seriesByTag', {\n withDefaultParams: false,\n });\n const tagParam = `${tag}=`;\n newFunc.params = [tagParam];\n state.queryModel.addFunction(newFunc);\n newFunc.added = true;\n\n emptySegments(state);\n handleTargetChanged(state);\n await parseTarget(state);\n}\n\nexport function smartlyHandleNewAliasByNode(state: GraphiteQueryEditorState, func: FuncInstance): void {\n if (func.def.name !== 'aliasByNode') {\n return;\n }\n\n for (let i = 0; i < state.segments.length; i++) {\n if (state.segments[i].value.indexOf('*') >= 0) {\n func.params[0] = i;\n func.added = false;\n handleTargetChanged(state);\n return;\n }\n }\n}\n\n/**\n * Pauses running the query to allow selecting tag value. This is to prevent getting errors if the query is run\n * for a tag with no selected value.\n */\nexport function pause(state: GraphiteQueryEditorState): void {\n state.paused = true;\n}\n\nexport function removeTagPrefix(value: string): string {\n return value.replace(TAG_PREFIX, '');\n}\n\nexport function handleTargetChanged(state: GraphiteQueryEditorState): void {\n if (state.queryModel.error) {\n return;\n }\n\n const oldTarget = state.queryModel.target.target;\n // Interpolate from other queries:\n // Because of mixed data sources the list may contain queries for non-Graphite data sources. To ensure a valid query\n // is used for interpolation we should check required properties are passed though in theory it allows to interpolate\n // with queries that contain \"target\" property as well.\n state.queryModel.updateModelTarget(\n (state.queries || []).filter((query) => 'target' in query && typeof (query as GraphiteQuery).target === 'string')\n );\n\n if (state.queryModel.target.target !== oldTarget && !state.paused) {\n state.refresh();\n }\n}\n\n/**\n * When metrics autocomplete fails - the error is shown, but only once per page view\n */\nexport function handleMetricsAutoCompleteError(\n state: GraphiteQueryEditorState,\n error: Error\n): GraphiteQueryEditorState {\n if (!state.metricAutoCompleteErrorShown) {\n state.metricAutoCompleteErrorShown = true;\n dispatch(notifyApp(createErrorNotification(`Fetching metrics failed: ${error.message}.`)));\n }\n return state;\n}\n\n/**\n * When tags autocomplete fails - the error is shown, but only once per page view\n */\nexport function handleTagsAutoCompleteError(state: GraphiteQueryEditorState, error: Error): GraphiteQueryEditorState {\n if (!state.tagsAutoCompleteErrorShown) {\n state.tagsAutoCompleteErrorShown = true;\n dispatch(notifyApp(createErrorNotification(`Fetching tags failed: ${error.message}.`)));\n }\n return state;\n}\n","import { AnyAction } from '@reduxjs/toolkit';\nimport { Action, Dispatch } from 'redux';\n\nimport { DataQuery, TimeRange } from '@grafana/data';\nimport { getTemplateSrv } from '@grafana/runtime';\n\nimport { TemplateSrv } from '../../../../features/templating/template_srv';\nimport { GraphiteDatasource } from '../datasource';\nimport { FuncDefs } from '../gfunc';\nimport GraphiteQuery, { GraphiteTarget } from '../graphite_query';\nimport { GraphiteSegment, GraphiteTagOperator } from '../types';\n\nimport { actions } from './actions';\nimport {\n addSeriesByTagFunc,\n buildSegments,\n checkOtherSegments,\n emptySegments,\n handleTargetChanged,\n parseTarget,\n pause,\n removeTagPrefix,\n smartlyHandleNewAliasByNode,\n spliceSegments,\n} from './helpers';\n\nexport type GraphiteQueryEditorState = {\n // external dependencies\n datasource: GraphiteDatasource;\n target: GraphiteTarget;\n refresh: () => void;\n queries?: DataQuery[];\n templateSrv: TemplateSrv;\n range?: TimeRange;\n\n // internal\n supportsTags: boolean;\n paused: boolean;\n removeTagValue: string;\n funcDefs: FuncDefs | null;\n segments: GraphiteSegment[];\n queryModel: GraphiteQuery;\n error: Error | null;\n tagsAutoCompleteErrorShown: boolean;\n metricAutoCompleteErrorShown: boolean;\n};\n\nconst reducer = async (action: Action, state: GraphiteQueryEditorState): Promise<GraphiteQueryEditorState> => {\n state = { ...state };\n\n if (actions.init.match(action)) {\n const deps = action.payload;\n deps.target.target = deps.target.target || '';\n\n await deps.datasource.waitForFuncDefsLoaded();\n\n state = {\n ...state,\n ...deps,\n queryModel: new GraphiteQuery(deps.datasource, deps.target, getTemplateSrv()),\n supportsTags: deps.datasource.supportsTags,\n paused: false,\n removeTagValue: '-- remove tag --',\n funcDefs: deps.datasource.funcDefs,\n queries: deps.queries,\n };\n\n await buildSegments(state, false);\n }\n if (actions.timeRangeChanged.match(action)) {\n state.range = action.payload;\n }\n if (actions.queriesChanged.match(action)) {\n state.queries = action.payload;\n handleTargetChanged(state);\n }\n if (actions.queryChanged.match(action)) {\n state.target.target = action.payload.target || '';\n await parseTarget(state);\n handleTargetChanged(state);\n }\n if (actions.segmentValueChanged.match(action)) {\n const { segment: segmentOrString, index: segmentIndex } = action.payload;\n\n let segment;\n // is segment was changed to a string - create a new segment\n if (typeof segmentOrString === 'string') {\n segment = {\n value: segmentOrString,\n expandable: true,\n fake: false,\n };\n } else {\n segment = segmentOrString as GraphiteSegment;\n }\n\n state.error = null;\n state.segments[segmentIndex] = segment;\n state.queryModel.updateSegmentValue(segment, segmentIndex);\n\n if (state.queryModel.functions.length > 0 && state.queryModel.functions[0].def.fake) {\n state.queryModel.functions = [];\n }\n\n if (segment.type === 'tag') {\n const tag = removeTagPrefix(segment.value);\n pause(state);\n await addSeriesByTagFunc(state, tag);\n return state;\n }\n\n // if newly selected segment can be expanded -> check if the path is correct\n if (segment.expandable) {\n await checkOtherSegments(state, segmentIndex + 1);\n } else {\n // if not expandable -> remove all other segments\n spliceSegments(state, segmentIndex + 1);\n }\n\n handleTargetChanged(state);\n }\n if (actions.tagChanged.match(action)) {\n const { tag, index: tagIndex } = action.payload;\n state.queryModel.updateTag(tag, tagIndex);\n handleTargetChanged(state);\n if (state.queryModel.tags.length === 0) {\n await checkOtherSegments(state, 0);\n state.paused = false;\n }\n }\n if (actions.addNewTag.match(action)) {\n const segment = action.payload.segment;\n const newTagKey = segment.value;\n const newTag = { key: newTagKey, operator: '=' as GraphiteTagOperator, value: '' };\n state.queryModel.addTag(newTag);\n handleTargetChanged(state);\n }\n if (actions.unpause.match(action)) {\n state.paused = false;\n state.refresh();\n }\n if (actions.addFunction.match(action)) {\n const newFunc = state.datasource.createFuncInstance(action.payload.name, {\n withDefaultParams: true,\n });\n newFunc.added = true;\n state.queryModel.addFunction(newFunc);\n smartlyHandleNewAliasByNode(state, newFunc);\n\n if (state.segments.length === 1 && state.segments[0].fake) {\n emptySegments(state);\n }\n\n if (!newFunc.params.length && newFunc.added) {\n handleTargetChanged(state);\n }\n\n if (newFunc.def.name === 'seriesByTag') {\n await parseTarget(state);\n }\n }\n if (actions.removeFunction.match(action)) {\n state.queryModel.removeFunction(action.payload.func);\n handleTargetChanged(state);\n }\n if (actions.moveFunction.match(action)) {\n const { func, offset } = action.payload;\n state.queryModel.moveFunction(func, offset);\n handleTargetChanged(state);\n }\n if (actions.updateFunctionParam.match(action)) {\n const { func, index, value } = action.payload;\n func.updateParam(value, index);\n handleTargetChanged(state);\n }\n if (actions.updateQuery.match(action)) {\n state.target.target = action.payload.query;\n handleTargetChanged(state);\n }\n if (actions.runQuery.match(action)) {\n state.refresh();\n }\n if (actions.toggleEditorMode.match(action)) {\n state.target.textEditor = !state.target.textEditor;\n await parseTarget(state);\n }\n\n return { ...state };\n};\n\nexport const createStore = (onChange: (state: GraphiteQueryEditorState) => void): Dispatch<AnyAction> => {\n let state = {} as GraphiteQueryEditorState;\n\n const dispatch = async (action: AnyAction) => {\n state = await reducer(action, state);\n onChange(state);\n };\n\n return dispatch as Dispatch<AnyAction>;\n};\n","import { AnyAction } from '@reduxjs/toolkit';\nimport React, { createContext, Dispatch, PropsWithChildren, useContext, useEffect, useMemo, useState } from 'react';\nimport { usePrevious } from 'react-use';\n\nimport { QueryEditorProps } from '@grafana/data';\nimport { getTemplateSrv } from 'app/features/templating/template_srv';\n\nimport { GraphiteDatasource } from '../datasource';\nimport { GraphiteOptions, GraphiteQuery } from '../types';\n\nimport { actions } from './actions';\nimport { createStore, GraphiteQueryEditorState } from './store';\n\nconst DispatchContext = createContext<Dispatch<AnyAction>>({} as Dispatch<AnyAction>);\nconst GraphiteStateContext = createContext<GraphiteQueryEditorState>({} as GraphiteQueryEditorState);\n\nexport const useDispatch = () => {\n return useContext(DispatchContext);\n};\n\nexport const useGraphiteState = () => {\n return useContext(GraphiteStateContext);\n};\n\nexport type GraphiteQueryEditorProps = QueryEditorProps<GraphiteDatasource, GraphiteQuery, GraphiteOptions>;\n\nexport const GraphiteQueryEditorContext = ({\n datasource,\n onRunQuery,\n onChange,\n query,\n queries,\n range,\n children,\n}: PropsWithChildren<GraphiteQueryEditorProps>) => {\n const [state, setState] = useState<GraphiteQueryEditorState>();\n const [needsRefresh, setNeedsRefresh] = useState<boolean>(false);\n\n const dispatch = useMemo(() => {\n return createStore((state) => {\n setState(state);\n });\n }, []);\n\n // synchronise changes provided in props with editor's state\n const previousRange = usePrevious(range);\n useEffect(() => {\n if (previousRange?.raw !== range?.raw) {\n dispatch(actions.timeRangeChanged(range));\n }\n }, [dispatch, range, previousRange]);\n\n useEffect(\n () => {\n if (state) {\n dispatch(actions.queriesChanged(queries));\n }\n },\n // adding state to dependencies causes infinite loops\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [dispatch, queries]\n );\n\n useEffect(\n () => {\n if (state && state.target?.target !== query.target) {\n dispatch(actions.queryChanged(query));\n }\n },\n // adding state to dependencies causes infinite loops\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [dispatch, query]\n );\n\n useEffect(\n () => {\n if (needsRefresh && state) {\n setNeedsRefresh(false);\n onChange({ ...query, target: state.target.target });\n onRunQuery();\n }\n },\n // adding state to dependencies causes infinite loops\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [needsRefresh, onChange, onRunQuery, query]\n );\n\n if (!state) {\n dispatch(\n actions.init({\n target: query,\n datasource: datasource,\n range: range,\n templateSrv: getTemplateSrv(),\n // list of queries is passed only when the editor is in Dashboards. This is to allow interpolation\n // of sub-queries which are stored in \"targetFull\" property used by alerting in the backend.\n queries: queries || [],\n refresh: () => {\n // do not run onChange/onRunQuery straight away to ensure the internal state gets updated first\n // to avoid race conditions (onChange could update props before the reducer action finishes)\n setNeedsRefresh(true);\n },\n })\n );\n return null;\n } else {\n return (\n <GraphiteStateContext.Provider value={state}>\n <DispatchContext.Provider value={dispatch}>{children}</DispatchContext.Provider>\n </GraphiteStateContext.Provider>\n );\n }\n};\n","import { forEach, sortBy } from 'lodash';\n\nimport { SelectableValue } from '@grafana/data';\n\nimport { FuncDefs, FuncInstance, ParamDef } from '../gfunc';\nimport { GraphiteSegment } from '../types';\n\nimport { EditableParam } from './FunctionParamEditor';\n\nexport function mapStringsToSelectables<T extends string>(values: T[]): Array<SelectableValue<T>> {\n return values.map((value) => ({\n value,\n label: value,\n }));\n}\n\nexport function mapSegmentsToSelectables(segments: GraphiteSegment[]): Array<SelectableValue<GraphiteSegment>> {\n return segments.map((segment) => ({\n label: segment.value,\n value: segment,\n }));\n}\n\nexport function mapFuncDefsToSelectables(funcDefs: FuncDefs): Array<SelectableValue<string>> {\n const categories: any = {};\n\n forEach(funcDefs, (funcDef) => {\n if (!funcDef.category) {\n return;\n }\n if (!categories[funcDef.category]) {\n categories[funcDef.category] = { label: funcDef.category, value: funcDef.category, options: [] };\n }\n categories[funcDef.category].options.push({\n label: funcDef.name,\n value: funcDef.name,\n });\n });\n\n return sortBy(categories, 'label');\n}\n\nfunction createEditableParam(paramDef: ParamDef, additional: boolean, value?: string | number): EditableParam {\n return {\n name: paramDef.name,\n value: value?.toString() || '',\n optional: !!paramDef.optional || additional, // only first param is required when multiple are allowed\n multiple: !!paramDef.multiple,\n options:\n paramDef.options?.map((option: string | number) => ({\n value: option.toString(),\n label: option.toString(),\n })) ?? [],\n };\n}\n\n/**\n * Create a list of params that can be edited in the function editor.\n */\nexport function mapFuncInstanceToParams(func: FuncInstance): EditableParam[] {\n // list of required parameters (from func.def)\n const params: EditableParam[] = func.def.params.map((paramDef: ParamDef, index: number) =>\n createEditableParam(paramDef, false, func.params[index])\n );\n\n // list of additional (multiple or optional) params entered by the user\n while (params.length < func.params.length) {\n const paramDef = func.def.params[func.def.params.length - 1];\n const value = func.params[params.length];\n params.push(createEditableParam(paramDef, true, value));\n }\n\n // extra \"fake\" param to allow adding more multiple values at the end\n if (params.length && params[params.length - 1].value && params[params.length - 1]?.multiple) {\n const paramDef = func.def.params[func.def.params.length - 1];\n params.push(createEditableParam(paramDef, true, ''));\n }\n\n return params;\n}\n","import { css, cx } from '@emotion/css';\nimport React, { useEffect, useMemo, useState } from 'react';\n\nimport { GrafanaTheme2, SelectableValue } from '@grafana/data';\nimport { Button, Segment, useStyles2 } from '@grafana/ui';\n\nimport { FuncDefs } from '../gfunc';\nimport { actions } from '../state/actions';\nimport { useDispatch } from '../state/context';\n\nimport { mapFuncDefsToSelectables } from './helpers';\n\ntype Props = {\n funcDefs: FuncDefs;\n};\n\nexport function AddGraphiteFunction({ funcDefs }: Props) {\n const dispatch = useDispatch();\n const [value, setValue] = useState<SelectableValue<string> | undefined>(undefined);\n const styles = useStyles2(getStyles);\n\n const options = useMemo(() => mapFuncDefsToSelectables(funcDefs), [funcDefs]);\n\n // Note: actions.addFunction will add a component that will have a dropdown or input in auto-focus\n // (the first param of the function). This auto-focus will cause onBlur() on AddGraphiteFunction's\n // Segment component and trigger onChange once again. (why? we call onChange if the user dismissed\n // the dropdown, see: SegmentSelect.onCloseMenu for more details). To avoid it we need to wait for\n // the Segment to disappear first (hence useEffect) and then dispatch the action that will add new\n // components.\n useEffect(() => {\n if (value?.value !== undefined) {\n dispatch(actions.addFunction({ name: value.value }));\n setValue(undefined);\n }\n }, [value, dispatch]);\n\n return (\n <Segment\n Component={<Button icon=\"plus\" variant=\"secondary\" className={cx(styles.button)} aria-label=\"Add new function\" />}\n options={options}\n onChange={setValue}\n inputMinWidth={150}\n />\n );\n}\n\nfunction getStyles(theme: GrafanaTheme2) {\n return {\n button: css`\n margin-right: ${theme.spacing(0.5)};\n `,\n };\n}\n","import React, { Suspense } from 'react';\n\nimport { Icon, Tooltip } from '@grafana/ui';\n\nimport { FuncInstance } from '../gfunc';\n\nexport interface FunctionEditorControlsProps {\n onMoveLeft: (func: FuncInstance) => void;\n onMoveRight: (func: FuncInstance) => void;\n onRemove: (func: FuncInstance) => void;\n}\n\nconst FunctionDescription = React.lazy(async () => {\n // @ts-ignore\n const { default: rst2html } = await import(/* webpackChunkName: \"rst2html\" */ 'rst2html');\n return {\n default(props: { description?: string }) {\n return <div dangerouslySetInnerHTML={{ __html: rst2html(props.description ?? '') }} />;\n },\n };\n});\n\nconst FunctionHelpButton = (props: { description?: string; name: string }) => {\n if (props.description) {\n let tooltip = (\n <Suspense fallback={<span>Loading description...</span>}>\n <FunctionDescription description={props.description} />\n </Suspense>\n );\n return (\n <Tooltip content={tooltip} placement={'bottom-end'}>\n <Icon className={props.description ? undefined : 'pointer'} name=\"question-circle\" />\n </Tooltip>\n );\n }\n\n return (\n <Icon\n className=\"pointer\"\n name=\"question-circle\"\n onClick={() => {\n window.open(\n 'http://graphite.readthedocs.org/en/latest/functions.html#graphite.render.functions.' + props.name,\n '_blank'\n );\n }}\n />\n );\n};\n\nexport const FunctionEditorControls = (\n props: FunctionEditorControlsProps & {\n func: FuncInstance;\n }\n) => {\n const { func, onMoveLeft, onMoveRight, onRemove } = props;\n return (\n <div\n style={{\n display: 'flex',\n width: '60px',\n justifyContent: 'space-between',\n }}\n >\n <Icon name=\"arrow-left\" onClick={() => onMoveLeft(func)} />\n <FunctionHelpButton name={func.def.name} description={func.def.description} />\n <Icon name=\"times\" onClick={() => onRemove(func)} />\n <Icon name=\"arrow-right\" onClick={() => onMoveRight(func)} />\n </div>\n );\n};\n","import { css } from '@emotion/css';\nimport React from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Icon, Tooltip, useStyles2 } from '@grafana/ui';\n\nimport { FuncInstance } from '../gfunc';\n\nimport { FunctionEditorControls, FunctionEditorControlsProps } from './FunctionEditorControls';\n\ninterface FunctionEditorProps extends FunctionEditorControlsProps {\n func: FuncInstance;\n}\n\nconst getStyles = (theme: GrafanaTheme2) => {\n return {\n icon: css`\n margin-right: ${theme.spacing(0.5)};\n `,\n label: css({\n fontWeight: theme.typography.fontWeightMedium,\n fontSize: theme.typography.bodySmall.fontSize, // to match .gf-form-label\n cursor: 'pointer',\n display: 'inline-block',\n }),\n };\n};\n\nconst FunctionEditor: React.FC<FunctionEditorProps> = ({ onMoveLeft, onMoveRight, func, ...props }) => {\n const styles = useStyles2(getStyles);\n\n const renderContent = ({ updatePopperPosition }: any) => (\n <FunctionEditorControls\n {...props}\n func={func}\n onMoveLeft={() => {\n onMoveLeft(func);\n updatePopperPosition();\n }}\n onMoveRight={() => {\n onMoveRight(func);\n updatePopperPosition();\n }}\n />\n );\n\n return (\n <>\n {func.def.unknown && (\n <Tooltip content={<TooltipContent />} placement=\"bottom\" interactive>\n <Icon data-testid=\"warning-icon\" name=\"exclamation-triangle\" size=\"xs\" className={styles.icon} />\n </Tooltip>\n )}\n <Tooltip content={renderContent} placement=\"top\" interactive>\n <span className={styles.label}>{func.def.name}</span>\n </Tooltip>\n </>\n );\n};\n\nconst TooltipContent = React.memo(() => {\n return (\n <span>\n This function is not supported. Check your function for typos and{' '}\n <a\n target=\"_blank\"\n className=\"external-link\"\n rel=\"noreferrer noopener\"\n href=\"https://graphite.readthedocs.io/en/latest/functions.html\"\n >\n read the docs\n </a>{' '}\n to see whether you need to upgrade your data source’s version to make this function available.\n </span>\n );\n});\nTooltipContent.displayName = 'FunctionEditorTooltipContent';\n\nexport { FunctionEditor };\n","import { css } from '@emotion/css';\nimport React from 'react';\n\nimport { GrafanaTheme2, SelectableValue } from '@grafana/data';\nimport { Segment, SegmentInput, useStyles2 } from '@grafana/ui';\n\nexport type EditableParam = {\n name: string;\n value: string;\n optional: boolean;\n multiple: boolean;\n options: Array<SelectableValue<string>>;\n};\n\ntype FieldEditorProps = {\n editableParam: EditableParam;\n onChange: (value: string) => void;\n onExpandedChange: (expanded: boolean) => void;\n autofocus: boolean;\n};\n\n/**\n * Render a function parameter with a segment dropdown for multiple options or simple input.\n */\nexport function FunctionParamEditor({ editableParam, onChange, onExpandedChange, autofocus }: FieldEditorProps) {\n const styles = useStyles2(getStyles);\n\n if (editableParam.options?.length > 0) {\n return (\n <Segment\n autofocus={autofocus}\n value={editableParam.value}\n inputPlaceholder={editableParam.name}\n className={styles.segment}\n options={editableParam.options}\n placeholder={' +' + editableParam.name}\n onChange={(value) => {\n onChange(value.value || '');\n }}\n onExpandedChange={onExpandedChange}\n inputMinWidth={150}\n allowCustomValue={true}\n allowEmptyValue={true}\n ></Segment>\n );\n } else {\n return (\n <SegmentInput\n autofocus={autofocus}\n className={styles.input}\n value={editableParam.value || ''}\n placeholder={' +' + editableParam.name}\n inputPlaceholder={editableParam.name}\n onChange={(value) => {\n onChange(value.toString());\n }}\n onExpandedChange={onExpandedChange}\n // input style\n style={{ height: '25px', paddingTop: '2px', marginTop: '2px', paddingLeft: '4px', minWidth: '100px' }}\n ></SegmentInput>\n );\n }\n}\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n segment: css({\n margin: 0,\n padding: 0,\n }),\n input: css`\n margin: 0;\n padding: 0;\n input {\n height: 25px;\n },\n `,\n});\n","import { css, cx } from '@emotion/css';\nimport React, { useState } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { HorizontalGroup, InlineLabel, useStyles2 } from '@grafana/ui';\n\nimport { FuncInstance } from '../gfunc';\nimport { actions } from '../state/actions';\nimport { useDispatch } from '../state/context';\n\nimport { FunctionEditor } from './FunctionEditor';\nimport { EditableParam, FunctionParamEditor } from './FunctionParamEditor';\nimport { mapFuncInstanceToParams } from './helpers';\n\nexport type FunctionEditorProps = {\n func: FuncInstance;\n};\n\n/**\n * Allows editing function params and removing/moving a function (note: editing function name is not supported)\n */\nexport function GraphiteFunctionEditor({ func }: FunctionEditorProps) {\n const dispatch = useDispatch();\n const styles = useStyles2(getStyles);\n\n // keep track of mouse over and isExpanded state to display buttons for adding optional/multiple params\n // only when the user mouse over over the function editor OR any param editor is expanded.\n const [mouseOver, setIsMouseOver] = useState(false);\n const [expanded, setIsExpanded] = useState(false);\n\n let params = mapFuncInstanceToParams(func);\n params = params.filter((p: EditableParam, index: number) => {\n // func.added is set for newly added functions - see autofocus below\n return (index < func.def.params.length && !p.optional) || func.added || p.value || expanded || mouseOver;\n });\n\n return (\n <div\n className={cx(styles.container, { [styles.error]: func.def.unknown })}\n onMouseOver={() => setIsMouseOver(true)}\n onMouseLeave={() => setIsMouseOver(false)}\n >\n <HorizontalGroup spacing=\"none\">\n <FunctionEditor\n func={func}\n onMoveLeft={() => {\n dispatch(actions.moveFunction({ func, offset: -1 }));\n }}\n onMoveRight={() => {\n dispatch(actions.moveFunction({ func, offset: 1 }));\n }}\n onRemove={() => {\n dispatch(actions.removeFunction({ func }));\n }}\n />\n <InlineLabel className={styles.label}>(</InlineLabel>\n {params.map((editableParam: EditableParam, index: number) => {\n return (\n <React.Fragment key={index}>\n <FunctionParamEditor\n autofocus={index === 0 && func.added}\n editableParam={editableParam}\n onChange={(value) => {\n if (value !== '' || editableParam.optional) {\n dispatch(actions.updateFunctionParam({ func, index, value }));\n }\n setIsExpanded(false);\n setIsMouseOver(false);\n }}\n onExpandedChange={setIsExpanded}\n />\n {index !== params.length - 1 ? ',' : ''}\n </React.Fragment>\n );\n })}\n <InlineLabel className={styles.label}>)</InlineLabel>\n </HorizontalGroup>\n </div>\n );\n}\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n container: css({\n backgroundColor: theme.colors.background.secondary,\n borderRadius: theme.shape.borderRadius(),\n marginRight: theme.spacing(0.5),\n padding: `0 ${theme.spacing(1)}`,\n height: `${theme.v1.spacing.formInputHeight}px`,\n }),\n error: css`\n border: 1px solid ${theme.colors.error.main};\n `,\n label: css({\n padding: 0,\n margin: 0,\n }),\n button: css({\n padding: theme.spacing(0.5),\n }),\n});\n","import React from 'react';\n\nimport { SegmentSection } from '@grafana/ui';\n\nimport { FuncDefs, FuncInstance } from '../gfunc';\n\nimport { AddGraphiteFunction } from './AddGraphiteFunction';\nimport { GraphiteFunctionEditor } from './GraphiteFunctionEditor';\n\ntype Props = {\n functions: FuncInstance[];\n funcDefs: FuncDefs;\n};\n\nexport function FunctionsSection({ functions = [], funcDefs }: Props) {\n return (\n <SegmentSection label=\"Functions\" fill={true}>\n {functions.map((func: FuncInstance, index: number) => {\n return !func.hidden && <GraphiteFunctionEditor key={index} func={func} />;\n })}\n <AddGraphiteFunction funcDefs={funcDefs} />\n </SegmentSection>\n );\n}\n","import React, { useCallback } from 'react';\n\nimport { QueryField } from '@grafana/ui';\n\nimport { actions } from '../state/actions';\nimport { useDispatch } from '../state/context';\n\ntype Props = {\n rawQuery: string;\n};\n\nexport function GraphiteTextEditor({ rawQuery }: Props) {\n const dispatch = useDispatch();\n\n const updateQuery = useCallback(\n (query: string) => {\n dispatch(actions.updateQuery({ query }));\n },\n [dispatch]\n );\n\n const runQuery = useCallback(() => {\n dispatch(actions.runQuery());\n }, [dispatch]);\n\n return (\n <QueryField\n query={rawQuery}\n onChange={updateQuery}\n onBlur={runQuery}\n onRunQuery={runQuery}\n placeholder={'Enter a Graphite query (run with Shift+Enter)'}\n portalOrigin=\"graphite\"\n />\n );\n}\n","import { eachRight, map, remove } from 'lodash';\n\nimport { SelectableValue } from '@grafana/data';\n\nimport { mapSegmentsToSelectables, mapStringsToSelectables } from '../components/helpers';\nimport { GraphiteSegment, GraphiteTag, GraphiteTagOperator } from '../types';\n\nimport {\n TAG_PREFIX,\n GRAPHITE_TAG_OPERATORS,\n handleMetricsAutoCompleteError,\n handleTagsAutoCompleteError,\n} from './helpers';\nimport { GraphiteQueryEditorState } from './store';\n\n/**\n * All auto-complete lists are updated while typing. To avoid performance issues we do not render more\n * than MAX_SUGGESTIONS limits in a single dropdown.\n *\n * MAX_SUGGESTIONS is per metrics and tags separately. On the very first dropdown where metrics and tags are\n * combined together meaning it may end up with max of 2 * MAX_SUGGESTIONS items in total.\n */\nconst MAX_SUGGESTIONS = 5000;\n\n/**\n * Providers are hooks for views to provide temporal data for autocomplete. They don't modify the state.\n */\n\n/**\n * Return list of available options for a segment with given index\n *\n * It may be:\n * - mixed list of metrics and tags (only when nothing was selected)\n * - list of metric names (if a metric name was selected for this segment)\n */\nasync function getAltSegments(\n state: GraphiteQueryEditorState,\n index: number,\n prefix: string\n): Promise<GraphiteSegment[]> {\n let query = prefix.length > 0 ? '*' + prefix + '*' : '*';\n if (index > 0) {\n query = state.queryModel.getSegmentPathUpTo(index) + '.' + query;\n }\n const options = {\n range: state.range,\n requestId: 'get-alt-segments',\n };\n\n try {\n const segments = await state.datasource.metricFindQuery(query, options);\n const altSegments: GraphiteSegment[] = map(segments, (segment) => {\n return {\n value: segment.text,\n expandable: segment.expandable,\n };\n });\n\n if (index > 0 && altSegments.length === 0) {\n return altSegments;\n }\n\n // add query references\n if (index === 0) {\n eachRight(state.queries, (target) => {\n if (target.refId === state.queryModel.target.refId) {\n return;\n }\n\n altSegments.unshift({\n type: 'series-ref',\n value: '#' + target.refId,\n expandable: false,\n });\n });\n }\n\n // add template variables\n eachRight(state.templateSrv.getVariables(), (variable) => {\n altSegments.unshift({\n type: 'template',\n value: '$' + variable.name,\n expandable: true,\n });\n });\n\n // add wildcard option and limit number of suggestions (API doesn't support limiting\n // hence we are doing it here)\n altSegments.unshift({ value: '*', expandable: true });\n altSegments.splice(MAX_SUGGESTIONS);\n\n if (state.supportsTags && index === 0) {\n removeTaggedEntry(altSegments);\n return await addAltTagSegments(state, prefix, altSegments);\n } else {\n return altSegments;\n }\n } catch (err) {\n handleMetricsAutoCompleteError(state, err);\n }\n\n return [];\n}\n\n/**\n * Get the list of segments with tags and metrics. Suggestions are reduced in getAltSegments and addAltTagSegments so in case\n * we hit MAX_SUGGESTIONS limit there are always some tags and metrics shown.\n */\nexport async function getAltSegmentsSelectables(\n state: GraphiteQueryEditorState,\n index: number,\n prefix: string\n): Promise<Array<SelectableValue<GraphiteSegment>>> {\n return mapSegmentsToSelectables(await getAltSegments(state, index, prefix));\n}\n\nexport function getTagOperatorsSelectables(): Array<SelectableValue<GraphiteTagOperator>> {\n return mapStringsToSelectables(GRAPHITE_TAG_OPERATORS);\n}\n\n/**\n * Returns tags as dropdown options\n */\nasync function getTags(state: GraphiteQueryEditorState, index: number, tagPrefix: string): Promise<string[]> {\n try {\n const tagExpressions = state.queryModel.renderTagExpressions(index);\n const values = await state.datasource.getTagsAutoComplete(tagExpressions, tagPrefix, {\n range: state.range,\n limit: MAX_SUGGESTIONS,\n });\n\n const altTags = map(values, 'text');\n altTags.splice(0, 0, state.removeTagValue);\n return altTags;\n } catch (err) {\n handleTagsAutoCompleteError(state, err);\n }\n\n return [];\n}\n\nexport async function getTagsSelectables(\n state: GraphiteQueryEditorState,\n index: number,\n tagPrefix: string\n): Promise<Array<SelectableValue<string>>> {\n return mapStringsToSelectables(await getTags(state, index, tagPrefix));\n}\n\n/**\n * List of tags when a tag is added. getTags is used for editing.\n * When adding - segment is used. When editing - dropdown is used.\n */\nasync function getTagsAsSegments(state: GraphiteQueryEditorState, tagPrefix: string): Promise<GraphiteSegment[]> {\n let tagsAsSegments: GraphiteSegment[];\n try {\n const tagExpressions = state.queryModel.renderTagExpressions();\n const values = await state.datasource.getTagsAutoComplete(tagExpressions, tagPrefix, {\n range: state.range,\n limit: MAX_SUGGESTIONS,\n });\n tagsAsSegments = map(values, (val) => {\n return {\n value: val.text,\n type: 'tag',\n expandable: false,\n };\n });\n } catch (err) {\n tagsAsSegments = [];\n handleTagsAutoCompleteError(state, err);\n }\n\n return tagsAsSegments;\n}\n\n/**\n * Get list of tags, used when adding additional tags (first tag is selected from a joined list of metrics and tags)\n */\nexport async function getTagsAsSegmentsSelectables(\n state: GraphiteQueryEditorState,\n tagPrefix: string\n): Promise<Array<SelectableValue<GraphiteSegment>>> {\n return mapSegmentsToSelectables(await getTagsAsSegments(state, tagPrefix));\n}\n\nasync function getTagValues(\n state: GraphiteQueryEditorState,\n tag: GraphiteTag,\n index: number,\n valuePrefix: string\n): Promise<string[]> {\n const tagExpressions = state.queryModel.renderTagExpressions(index);\n const tagKey = tag.key;\n const values = await state.datasource.getTagValuesAutoComplete(tagExpressions, tagKey, valuePrefix, {\n limit: MAX_SUGGESTIONS,\n });\n const altValues = map(values, 'text');\n // Add template variables as additional values\n eachRight(state.templateSrv.getVariables(), (variable) => {\n altValues.push('${' + variable.name + ':regex}');\n });\n\n return altValues;\n}\n\nexport async function getTagValuesSelectables(\n state: GraphiteQueryEditorState,\n tag: GraphiteTag,\n index: number,\n valuePrefix: string\n): Promise<Array<SelectableValue<string>>> {\n return mapStringsToSelectables(await getTagValues(state, tag, index, valuePrefix));\n}\n\n/**\n * Add segments with tags prefixed with \"tag: \" to include them in the same list as metrics\n */\nasync function addAltTagSegments(\n state: GraphiteQueryEditorState,\n prefix: string,\n altSegments: GraphiteSegment[]\n): Promise<GraphiteSegment[]> {\n let tagSegments = await getTagsAsSegments(state, prefix);\n\n tagSegments = map(tagSegments, (segment) => {\n segment.value = TAG_PREFIX + segment.value;\n return segment;\n });\n\n return altSegments.concat(...tagSegments);\n}\n\nfunction removeTaggedEntry(altSegments: GraphiteSegment[]) {\n remove(altSegments, (s) => s.value === '_tagged');\n}\n","import { debounce } from 'lodash';\nimport React, { useCallback, useMemo } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { SegmentAsync } from '@grafana/ui';\n\nimport { actions } from '../state/actions';\nimport { useDispatch } from '../state/context';\nimport { getAltSegmentsSelectables } from '../state/providers';\nimport { GraphiteQueryEditorState } from '../state/store';\nimport { GraphiteSegment } from '../types';\n\ntype Props = {\n segment: GraphiteSegment;\n metricIndex: number;\n state: GraphiteQueryEditorState;\n};\n\n/**\n * Represents a single metric node in the metric path at the given index. Allows to change the metric name to one of the\n * provided options or a custom value.\n *\n * Options for tag names and metric names are reloaded while user is typing with backend taking care of auto-complete\n * (auto-complete cannot be implemented in front-end because backend returns only limited number of entries)\n *\n * getAltSegmentsSelectables() also returns list of tags for segment with index=0. Once a tag is selected the editor\n * enters tag-adding mode (see SeriesSection and GraphiteQueryModel.seriesByTagUsed).\n */\nexport function MetricSegment({ metricIndex, segment, state }: Props) {\n const dispatch = useDispatch();\n const loadOptions = useCallback(\n (value: string | undefined) => {\n return getAltSegmentsSelectables(state, metricIndex, value || '');\n },\n [state, metricIndex]\n );\n const debouncedLoadOptions = useMemo(() => debounce(loadOptions, 200, { leading: true }), [loadOptions]);\n\n const onSegmentChanged = useCallback(\n (selectableValue: SelectableValue<GraphiteSegment | string>) => {\n // selectableValue.value is always defined because emptyValues are not allowed in SegmentAsync by default\n dispatch(actions.segmentValueChanged({ segment: selectableValue.value!, index: metricIndex }));\n },\n [dispatch, metricIndex]\n );\n\n // segmentValueChanged action will destroy SegmentAsync immediately if a tag is selected. To give time\n // for the clean up the action is debounced.\n const onSegmentChangedDebounced = useMemo(() => debounce(onSegmentChanged, 100), [onSegmentChanged]);\n\n return (\n <SegmentAsync<GraphiteSegment | string>\n value={segment.value}\n inputMinWidth={150}\n allowCustomValue={true}\n loadOptions={debouncedLoadOptions}\n reloadOptionsOnChange={true}\n onChange={onSegmentChangedDebounced}\n />\n );\n}\n","import React from 'react';\n\nimport { GraphiteQueryEditorState } from '../state/store';\nimport { GraphiteSegment } from '../types';\n\nimport { MetricSegment } from './MetricSegment';\n\ntype Props = {\n segments: GraphiteSegment[];\n state: GraphiteQueryEditorState;\n};\n\nexport function MetricsSection({ segments = [], state }: Props) {\n return (\n <>\n {segments.map((segment, index) => {\n return <MetricSegment segment={segment} metricIndex={index} key={index} state={state} />;\n })}\n </>\n );\n}\n","import React, { useCallback } from 'react';\n\nimport { Button } from '@grafana/ui';\n\nimport { actions } from '../state/actions';\nimport { useDispatch } from '../state/context';\n\nexport function PlayButton() {\n const dispatch = useDispatch();\n const onClick = useCallback(() => {\n dispatch(actions.unpause());\n }, [dispatch]);\n return <Button icon=\"play\" onClick={onClick} type=\"button\" variant=\"secondary\" aria-label=\"Unpause query\" />;\n}\n","import { debounce } from 'lodash';\nimport React, { useCallback, useMemo } from 'react';\n\nimport { Segment, SegmentAsync } from '@grafana/ui';\n\nimport { actions } from '../state/actions';\nimport { useDispatch } from '../state/context';\nimport { getTagOperatorsSelectables, getTagsSelectables, getTagValuesSelectables } from '../state/providers';\nimport { GraphiteQueryEditorState } from '../state/store';\nimport { GraphiteTag, GraphiteTagOperator } from '../types';\n\ntype Props = {\n tag: GraphiteTag;\n tagIndex: number;\n state: GraphiteQueryEditorState;\n};\n\n/**\n * Editor for a tag at given index. Allows changing the name of the tag, operator or value. Tag names are provided with\n * getTagsSelectables and contain only valid tags (it may depend on currently used tags). The dropdown for tag names is\n * also used for removing tag (with a special \"--remove tag--\" option provided by getTagsSelectables).\n *\n * Options for tag names and values are reloaded while user is typing with backend taking care of auto-complete\n * (auto-complete cannot be implemented in front-end because backend returns only limited number of entries)\n */\nexport function TagEditor({ tag, tagIndex, state }: Props) {\n const dispatch = useDispatch();\n const getTagsOptions = useCallback(\n (inputValue: string | undefined) => {\n return getTagsSelectables(state, tagIndex, inputValue || '');\n },\n [state, tagIndex]\n );\n const debouncedGetTagsOptions = useMemo(() => debounce(getTagsOptions, 200, { leading: true }), [getTagsOptions]);\n\n const getTagValueOptions = useCallback(\n (inputValue: string | undefined) => {\n return getTagValuesSelectables(state, tag, tagIndex, inputValue || '');\n },\n [state, tagIndex, tag]\n );\n const debouncedGetTagValueOptions = useMemo(\n () => debounce(getTagValueOptions, 200, { leading: true }),\n [getTagValueOptions]\n );\n\n return (\n <>\n <SegmentAsync\n inputMinWidth={150}\n value={tag.key}\n loadOptions={debouncedGetTagsOptions}\n reloadOptionsOnChange={true}\n onChange={(value) => {\n dispatch(\n actions.tagChanged({\n tag: { ...tag, key: value.value! },\n index: tagIndex,\n })\n );\n }}\n allowCustomValue={true}\n />\n <Segment<GraphiteTagOperator>\n inputMinWidth={50}\n value={tag.operator}\n options={getTagOperatorsSelectables()}\n onChange={(value) => {\n dispatch(\n actions.tagChanged({\n tag: { ...tag, operator: value.value! },\n index: tagIndex,\n })\n );\n }}\n />\n <SegmentAsync\n inputMinWidth={150}\n value={tag.value}\n loadOptions={debouncedGetTagValueOptions}\n reloadOptionsOnChange={true}\n onChange={(value) => {\n dispatch(\n actions.tagChanged({\n tag: { ...tag, value: value.value! },\n index: tagIndex,\n })\n );\n }}\n allowCustomValue={true}\n />\n </>\n );\n}\n","import { css } from '@emotion/css';\nimport { debounce } from 'lodash';\nimport React, { useCallback, useMemo } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Button, SegmentAsync, useStyles2 } from '@grafana/ui';\n\nimport { GraphiteTag } from '../graphite_query';\nimport { actions } from '../state/actions';\nimport { useDispatch } from '../state/context';\nimport { getTagsAsSegmentsSelectables } from '../state/providers';\nimport { GraphiteQueryEditorState } from '../state/store';\nimport { GraphiteSegment } from '../types';\n\nimport { PlayButton } from './PlayButton';\nimport { TagEditor } from './TagEditor';\n\ntype Props = {\n tags: GraphiteTag[];\n state: GraphiteQueryEditorState;\n};\n\n/**\n * Renders all tags and a button allowing to add more tags.\n *\n * Options for tag names are reloaded while user is typing with backend taking care of auto-complete\n * (auto-complete cannot be implemented in front-end because backend returns only limited number of entries)\n */\nexport function TagsSection({ tags, state }: Props) {\n const dispatch = useDispatch();\n const styles = useStyles2(getStyles);\n\n // Options are reloaded while user is typing with backend taking care of auto-complete (auto-complete cannot be\n // implemented in front-end because backend returns only limited number of entries)\n const getTagsAsSegmentsOptions = useCallback(\n (inputValue?: string) => {\n return getTagsAsSegmentsSelectables(state, inputValue || '');\n },\n [state]\n );\n const debouncedGetTagsAsSegments = useMemo(\n () => debounce(getTagsAsSegmentsOptions, 200, { leading: true }),\n [getTagsAsSegmentsOptions]\n );\n\n return (\n <>\n {tags.map((tag, index) => {\n return <TagEditor key={index} tagIndex={index} tag={tag} state={state} />;\n })}\n {tags.length && (\n <SegmentAsync<GraphiteSegment>\n inputMinWidth={150}\n onChange={(value) => {\n dispatch(actions.addNewTag({ segment: value.value! }));\n }}\n loadOptions={debouncedGetTagsAsSegments}\n reloadOptionsOnChange={true}\n Component={<Button icon=\"plus\" variant=\"secondary\" className={styles.button} aria-label=\"Add new tag\" />}\n />\n )}\n {state.paused && <PlayButton />}\n </>\n );\n}\n\nfunction getStyles(theme: GrafanaTheme2) {\n return {\n button: css`\n margin-right: ${theme.spacing(0.5)};\n `,\n };\n}\n","import React from 'react';\n\nimport { SegmentSection } from '@grafana/ui';\n\nimport { GraphiteQueryEditorState } from '../state/store';\n\nimport { MetricsSection } from './MetricsSection';\nimport { TagsSection } from './TagsSection';\n\ntype Props = {\n state: GraphiteQueryEditorState;\n};\n\nexport function SeriesSection({ state }: Props) {\n const sectionContent = state.queryModel?.seriesByTagUsed ? (\n <TagsSection tags={state.queryModel?.tags} state={state} />\n ) : (\n <MetricsSection segments={state.segments} state={state} />\n );\n\n return (\n <SegmentSection label=\"Series\" fill={true}>\n {sectionContent}\n </SegmentSection>\n );\n}\n","import { css } from '@emotion/css';\nimport React from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Button, useStyles2 } from '@grafana/ui';\n\nimport { actions } from '../state/actions';\nimport { GraphiteQueryEditorContext, GraphiteQueryEditorProps, useDispatch, useGraphiteState } from '../state/context';\n\nimport { FunctionsSection } from './FunctionsSection';\nimport { GraphiteTextEditor } from './GraphiteTextEditor';\nimport { SeriesSection } from './SeriesSection';\n\nexport function GraphiteQueryEditor({\n datasource,\n onRunQuery,\n onChange,\n query,\n range,\n queries,\n}: GraphiteQueryEditorProps) {\n return (\n <GraphiteQueryEditorContext\n datasource={datasource}\n onRunQuery={onRunQuery}\n onChange={onChange}\n query={query}\n queries={queries}\n range={range}\n >\n <GraphiteQueryEditorContent />\n </GraphiteQueryEditorContext>\n );\n}\n\nfunction GraphiteQueryEditorContent() {\n const dispatch = useDispatch();\n const state = useGraphiteState();\n const styles = useStyles2(getStyles);\n\n return (\n <div className={styles.container}>\n <div className={styles.visualEditor}>\n {state.target?.textEditor && <GraphiteTextEditor rawQuery={state.target.target} />}\n {!state.target?.textEditor && (\n <>\n <SeriesSection state={state} />\n <FunctionsSection functions={state.queryModel?.functions} funcDefs={state.funcDefs!} />\n </>\n )}\n </div>\n <Button\n className={styles.toggleButton}\n icon=\"pen\"\n variant=\"secondary\"\n aria-label=\"Toggle editor mode\"\n onClick={() => {\n dispatch(actions.toggleEditorMode());\n }}\n />\n </div>\n );\n}\n\nfunction getStyles(theme: GrafanaTheme2) {\n return {\n container: css`\n display: flex;\n `,\n visualEditor: css`\n flex-grow: 1;\n `,\n toggleButton: css`\n margin-left: ${theme.spacing(0.5)};\n `,\n };\n}\n","import { QueryResultMetaNotice } from '@grafana/data';\n\nimport { MetricTankSeriesMeta } from './types';\n\n// https://github.com/grafana/metrictank/blob/master/scripts/config/storage-schemas.conf#L15-L46\n\nexport interface RetentionInfo {\n interval: string;\n retention?: string;\n chunkspan?: string;\n numchunks?: number;\n ready?: boolean | number; // whether, or as of what data timestamp, the archive is ready for querying.\n}\n\nfunction toInteger(val?: string): number | undefined {\n if (val) {\n return parseInt(val, 10);\n }\n return undefined;\n}\n\nfunction toBooleanOrTimestamp(val?: string): number | boolean | undefined {\n if (val) {\n if (val === 'true') {\n return true;\n }\n if (val === 'false') {\n return false;\n }\n return parseInt(val, 10);\n }\n return undefined;\n}\n\nexport function getRollupNotice(metaList: MetricTankSeriesMeta[]): QueryResultMetaNotice | null {\n for (const meta of metaList) {\n const archiveIndex = meta['archive-read'];\n\n if (archiveIndex > 0) {\n const schema = parseSchemaRetentions(meta['schema-retentions']);\n const intervalString = schema[archiveIndex].interval;\n const func = (meta['consolidator-normfetch'] ?? '').replace('Consolidator', '');\n\n return {\n text: `Data is rolled up, aggregated over ${intervalString} using ${func} function`,\n severity: 'info',\n inspect: 'meta',\n };\n }\n }\n\n return null;\n}\n\nexport function getRuntimeConsolidationNotice(metaList: MetricTankSeriesMeta[]): QueryResultMetaNotice | null {\n for (const meta of metaList) {\n const runtimeNr = meta['aggnum-rc'];\n\n if (runtimeNr > 0) {\n const func = (meta['consolidator-rc'] ?? '').replace('Consolidator', '');\n\n return {\n text: `Data is runtime consolidated, ${runtimeNr} datapoints combined using ${func} function`,\n severity: 'info',\n inspect: 'meta',\n };\n }\n }\n\n return null;\n}\n\nexport function parseSchemaRetentions(spec: string): RetentionInfo[] {\n if (!spec) {\n return [];\n }\n return spec.split(',').map((str) => {\n const vals = str.split(':');\n return {\n interval: vals[0],\n retention: vals[1],\n chunkspan: vals[2],\n numchunks: toInteger(vals[3]),\n ready: toBooleanOrTimestamp(vals[4]),\n };\n });\n}\n","import { css, cx } from '@emotion/css';\nimport React, { PureComponent } from 'react';\n\nimport { MetadataInspectorProps, rangeUtil } from '@grafana/data';\nimport { stylesFactory } from '@grafana/ui';\nimport { config } from 'app/core/config';\n\nimport { GraphiteDatasource } from '../datasource';\nimport { parseSchemaRetentions, getRollupNotice, getRuntimeConsolidationNotice } from '../meta';\nimport { GraphiteQuery, GraphiteOptions, MetricTankSeriesMeta } from '../types';\n\nexport type Props = MetadataInspectorProps<GraphiteDatasource, GraphiteQuery, GraphiteOptions>;\n\nexport interface State {\n index: number;\n}\n\nexport class MetricTankMetaInspector extends PureComponent<Props, State> {\n renderMeta(meta: MetricTankSeriesMeta, key: string) {\n const styles = getStyles();\n const buckets = parseSchemaRetentions(meta['schema-retentions']);\n const rollupNotice = getRollupNotice([meta]);\n const runtimeNotice = getRuntimeConsolidationNotice([meta]);\n const normFunc = (meta['consolidator-normfetch'] ?? '').replace('Consolidator', '');\n\n const totalSeconds = buckets.reduce(\n (acc, bucket) => acc + (bucket.retention ? rangeUtil.intervalToSeconds(bucket.retention) : 0),\n 0\n );\n\n return (\n <div className={styles.metaItem} key={key}>\n <div className={styles.metaItemHeader}>\n Schema: {meta['schema-name']}\n <div className=\"small muted\">Series count: {meta.count}</div>\n </div>\n <div className={styles.metaItemBody}>\n <div className={styles.step}>\n <div className={styles.stepHeading}>Step 1: Fetch</div>\n <div className={styles.stepDescription}>\n First data is fetched, either from raw data archive or a rollup archive\n </div>\n\n {rollupNotice && <p>{rollupNotice.text}</p>}\n {!rollupNotice && <p>No rollup archive was used</p>}\n\n <div>\n {buckets.map((bucket, index) => {\n const bucketLength = bucket.retention ? rangeUtil.intervalToSeconds(bucket.retention) : 0;\n const lengthPercent = (bucketLength / totalSeconds) * 100;\n const isActive = index === meta['archive-read'];\n\n return (\n <div key={bucket.retention} className={styles.bucket}>\n <div className={styles.bucketInterval}>{bucket.interval}</div>\n <div\n className={cx(styles.bucketRetention, { [styles.bucketRetentionActive]: isActive })}\n style={{ flexGrow: lengthPercent }}\n />\n <div style={{ flexGrow: 100 - lengthPercent }}>{bucket.retention}</div>\n </div>\n );\n })}\n </div>\n </div>\n\n <div className={styles.step}>\n <div className={styles.stepHeading}>Step 2: Normalization</div>\n <div className={styles.stepDescription}>\n Normalization happens when series with different intervals between points are combined.\n </div>\n\n {meta['aggnum-norm'] > 1 && <p>Normalization did occur using {normFunc}</p>}\n {meta['aggnum-norm'] === 1 && <p>No normalization was needed</p>}\n </div>\n\n <div className={styles.step}>\n <div className={styles.stepHeading}>Step 3: Runtime consolidation</div>\n <div className={styles.stepDescription}>\n If there are too many data points at this point Metrictank will consolidate them down to below max data\n points (set in queries tab).\n </div>\n\n {runtimeNotice && <p>{runtimeNotice.text}</p>}\n {!runtimeNotice && <p>No runtime consolidation</p>}\n </div>\n </div>\n </div>\n );\n }\n\n render() {\n const { data } = this.props;\n\n // away to dedupe them\n const seriesMetas: Record<string, MetricTankSeriesMeta> = {};\n\n for (const series of data) {\n if (series.meta && series.meta.custom) {\n for (const metaItem of series.meta.custom.seriesMetaList as MetricTankSeriesMeta[]) {\n // key is to dedupe as many series will have identitical meta\n const key = `${JSON.stringify(metaItem)}`;\n\n if (seriesMetas[key]) {\n seriesMetas[key].count += metaItem.count;\n } else {\n seriesMetas[key] = metaItem;\n }\n }\n }\n }\n\n if (Object.keys(seriesMetas).length === 0) {\n return <div>No response meta data</div>;\n }\n\n return (\n <div>\n <h2 className=\"page-heading\">Metrictank Lineage</h2>\n {Object.keys(seriesMetas).map((key) => this.renderMeta(seriesMetas[key], key))}\n </div>\n );\n }\n}\n\nconst getStyles = stylesFactory(() => {\n const { theme } = config;\n const borderColor = theme.isDark ? theme.palette.gray25 : theme.palette.gray85;\n const background = theme.isDark ? theme.palette.dark1 : theme.palette.white;\n const headerBg = theme.isDark ? theme.palette.gray15 : theme.palette.gray85;\n\n return {\n metaItem: css`\n background: ${background};\n border: 1px solid ${borderColor};\n margin-bottom: ${theme.spacing.md};\n `,\n metaItemHeader: css`\n background: ${headerBg};\n padding: ${theme.spacing.xs} ${theme.spacing.md};\n font-size: ${theme.typography.size.md};\n display: flex;\n justify-content: space-between;\n `,\n metaItemBody: css`\n padding: ${theme.spacing.md};\n `,\n stepHeading: css`\n font-size: ${theme.typography.size.md};\n `,\n stepDescription: css`\n font-size: ${theme.typography.size.sm};\n color: ${theme.colors.textWeak};\n margin-bottom: ${theme.spacing.sm};\n `,\n step: css`\n margin-bottom: ${theme.spacing.lg};\n\n &:last-child {\n margin-bottom: 0;\n }\n `,\n bucket: css`\n display: flex;\n margin-bottom: ${theme.spacing.sm};\n border-radius: ${theme.border.radius.md};\n `,\n bucketInterval: css`\n flex-grow: 0;\n width: 60px;\n `,\n bucketRetention: css`\n background: linear-gradient(0deg, ${theme.palette.blue85}, ${theme.palette.blue95});\n text-align: center;\n color: ${theme.palette.white};\n margin-right: ${theme.spacing.md};\n border-radius: ${theme.border.radius.md};\n `,\n bucketRetentionActive: css`\n background: linear-gradient(0deg, ${theme.palette.greenBase}, ${theme.palette.greenShade});\n `,\n };\n});\n","import { DataQuery, DataSourceJsonData, TimeRange } from '@grafana/data';\n\nimport { TemplateSrv } from '../../../features/templating/template_srv';\n\nimport { GraphiteDatasource } from './datasource';\n\nexport interface GraphiteQuery extends DataQuery {\n target?: string;\n}\n\nexport interface GraphiteOptions extends DataSourceJsonData {\n graphiteVersion: string;\n graphiteType: GraphiteType;\n rollupIndicatorEnabled?: boolean;\n importConfiguration: GraphiteQueryImportConfiguration;\n}\n\nexport enum GraphiteType {\n Default = 'default',\n Metrictank = 'metrictank',\n}\n\nexport interface MetricTankRequestMeta {\n [key: string]: any;\n}\n\nexport interface MetricTankSeriesMeta {\n 'schema-name': string;\n 'schema-retentions': string; //\"1s:35d:20min:5:1542274085,1min:38d:2h:1:true,10min:120d:6h:1:true,2h:2y:6h:2\",\n 'archive-read': number;\n 'archive-interval': number;\n 'aggnum-norm': number;\n 'consolidator-normfetch': string; //\"MaximumConsolidator\",\n 'aggnum-rc': number;\n 'consolidator-rc': string; //\"MaximumConsolidator\",\n count: number;\n}\n\nexport interface MetricTankMeta {\n request: MetricTankRequestMeta;\n info: MetricTankSeriesMeta[];\n}\n\nexport type GraphiteQueryImportConfiguration = {\n loki: GraphiteToLokiQueryImportConfiguration;\n};\n\nexport type GraphiteToLokiQueryImportConfiguration = {\n mappings: GraphiteLokiMapping[];\n};\n\nexport type GraphiteLokiMapping = {\n matchers: GraphiteMetricLokiMatcher[];\n};\n\nexport type GraphiteMetricLokiMatcher = {\n value: string;\n labelName?: string;\n};\n\nexport type GraphiteSegment = {\n value: string;\n type?: 'tag' | 'metric' | 'series-ref' | 'template';\n expandable?: boolean;\n fake?: boolean;\n};\n\nexport type GraphiteTagOperator = '=' | '!=' | '=~' | '!=~';\n\nexport type GraphiteTag = {\n key: string;\n operator: GraphiteTagOperator;\n value: string;\n};\n\nexport type GraphiteQueryEditorDependencies = {\n target: any;\n datasource: GraphiteDatasource;\n range?: TimeRange;\n templateSrv: TemplateSrv;\n queries: DataQuery[];\n // schedule onChange/onRunQuery after the reducer actions finishes\n refresh: () => void;\n};\n","import { last } from 'lodash';\n\nexport const GRAPHITE_VERSIONS = ['0.9', '1.0', '1.1'];\n\nexport const DEFAULT_GRAPHITE_VERSION = last(GRAPHITE_VERSIONS)!;\n","import React from 'react';\n\nimport { Alert } from '@grafana/ui';\n\ntype Props = {\n onDismiss: () => void;\n};\n\nexport default function MappingsHelp(props: Props): JSX.Element {\n return (\n <Alert severity=\"info\" title=\"How to map Graphite metrics to labels?\" onRemove={props.onDismiss}>\n <p>Mappings are currently supported only between Graphite and Loki queries.</p>\n <p>\n When you switch your data source from Graphite to Loki, your queries are mapped according to the mappings\n defined in the example below. To define a mapping, write the full path of the metric and replace nodes you want\n to map to label with the label name in parentheses. The value of the label is extracted from your Graphite query\n when you switch data sources.\n </p>\n <p>\n All tags are automatically mapped to labels regardless of the mapping configuration. Graphite matching patterns\n (using {}) are converted to Loki's regular expressions matching patterns. When you use functions\n in your queries, the metrics, and tags are extracted to match them with defined mappings.\n </p>\n <p>\n Example: for a mapping = <code>servers.(cluster).(server).*</code>:\n </p>\n <table>\n <thead>\n <tr>\n <th>Graphite query</th>\n <th>Mapped to Loki query</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>\n <code>\n alias(servers.<u>west</u>.<u>001</u>.cpu,1,2)\n </code>\n </td>\n <td>\n <code>\n {cluster="<u>west</u>", server="<u>001</u>"}\n </code>\n </td>\n </tr>\n <tr>\n <td>\n <code>\n alias(servers.*.<u>{001,002}</u>.*,1,2)\n </code>\n </td>\n <td>\n <code>\n {server=~"<u>(001|002)</u>"}\n </code>\n </td>\n </tr>\n <tr>\n <td>\n <code>interpolate(seriesByTag('foo=bar', 'server=002'), inf))</code>\n </td>\n <td>\n <code>{foo="bar", server="002"}</code>\n </td>\n </tr>\n </tbody>\n </table>\n </Alert>\n );\n}\n","import React, { ChangeEvent, useState } from 'react';\n\nimport { Button, Icon, InlineField, InlineFieldRow, Input } from '@grafana/ui';\n\nimport MappingsHelp from './MappingsHelp';\n\ntype Props = {\n mappings: string[];\n onChange: (mappings: string[]) => void;\n onDismiss: () => void;\n onRestoreHelp: () => void;\n showHelp: boolean;\n};\n\nexport const MappingsConfiguration = (props: Props): JSX.Element => {\n const [mappings, setMappings] = useState(props.mappings || []);\n\n return (\n <div>\n <h3 className=\"page-heading\">Label mappings</h3>\n {!props.showHelp && (\n <p>\n <Button fill=\"text\" onClick={props.onRestoreHelp}>\n Learn how label mappings work\n </Button>\n </p>\n )}\n {props.showHelp && <MappingsHelp onDismiss={props.onDismiss} />}\n\n <div className=\"gf-form-group\">\n {mappings.map((mapping, i) => (\n <InlineFieldRow key={i}>\n <InlineField label={`Mapping (${i + 1})`}>\n <Input\n width={50}\n onChange={(changeEvent: ChangeEvent<HTMLInputElement>) => {\n let newMappings = mappings.concat();\n newMappings[i] = changeEvent.target.value;\n setMappings(newMappings);\n }}\n onBlur={() => {\n props.onChange(mappings);\n }}\n placeholder=\"e.g. test.metric.(labelName).*\"\n value={mapping}\n />\n </InlineField>\n <Button\n type=\"button\"\n aria-label=\"Remove header\"\n variant=\"secondary\"\n size=\"xs\"\n onClick={(_) => {\n let newMappings = mappings.concat();\n newMappings.splice(i, 1);\n setMappings(newMappings);\n props.onChange(newMappings);\n }}\n >\n <Icon name=\"trash-alt\" />\n </Button>\n </InlineFieldRow>\n ))}\n <Button\n variant=\"secondary\"\n icon=\"plus\"\n type=\"button\"\n onClick={() => {\n setMappings([...mappings, '']);\n }}\n >\n Add label mapping\n </Button>\n </div>\n </div>\n );\n};\n","import { GraphiteLokiMapping } from '../types';\n\n/**\n * Converts a simple string used in LokiLogsMappings component (e.g. \"servers.(name).*\")\n * to data model saved in data source configuration.\n */\nexport function fromString(text: string): GraphiteLokiMapping {\n return {\n matchers: text.split('.').map((metricNode) => {\n if (metricNode.startsWith('(') && metricNode.endsWith(')')) {\n return {\n value: '*',\n labelName: metricNode.slice(1, -1),\n };\n } else {\n return { value: metricNode };\n }\n }),\n };\n}\n\n/**\n * Coverts configuration stored in data source configuration into a string displayed in LokiLogsMappings component.\n */\nexport function toString(mapping: GraphiteLokiMapping): string {\n return mapping.matchers\n .map((matcher) => {\n return matcher.labelName ? `(${matcher.labelName})` : `${matcher.value}`;\n })\n .join('.');\n}\n","import React, { PureComponent } from 'react';\n\nimport {\n DataSourcePluginOptionsEditorProps,\n updateDatasourcePluginJsonDataOption,\n onUpdateDatasourceJsonDataOptionSelect,\n onUpdateDatasourceJsonDataOptionChecked,\n} from '@grafana/data';\nimport { Alert, DataSourceHttpSettings, InlineFormLabel, LegacyForms } from '@grafana/ui';\nimport store from 'app/core/store';\n\nimport { GraphiteOptions, GraphiteType } from '../types';\nimport { DEFAULT_GRAPHITE_VERSION, GRAPHITE_VERSIONS } from '../versions';\n\nimport { MappingsConfiguration } from './MappingsConfiguration';\nimport { fromString, toString } from './parseLokiLabelMappings';\n\nconst { Select, Switch } = LegacyForms;\nexport const SHOW_MAPPINGS_HELP_KEY = 'grafana.datasources.graphite.config.showMappingsHelp';\n\nconst graphiteVersions = GRAPHITE_VERSIONS.map((version) => ({ label: `${version}.x`, value: version }));\n\nconst graphiteTypes = Object.entries(GraphiteType).map(([label, value]) => ({\n label,\n value,\n}));\n\nexport type Props = DataSourcePluginOptionsEditorProps<GraphiteOptions>;\n\ntype State = {\n showMappingsHelp: boolean;\n};\n\nexport class ConfigEditor extends PureComponent<Props, State> {\n constructor(props: Props) {\n super(props);\n this.state = {\n showMappingsHelp: store.getObject(SHOW_MAPPINGS_HELP_KEY, true),\n };\n }\n\n renderTypeHelp = () => {\n return (\n <p>\n There are different types of Graphite compatible backends. Here you can specify the type you are using. If you\n are using{' '}\n <a href=\"https://github.com/grafana/metrictank\" className=\"pointer\" target=\"_blank\" rel=\"noreferrer\">\n Metrictank\n </a>{' '}\n then select that here. This will enable Metrictank specific features like query processing meta data. Metrictank\n is a multi-tenant timeseries engine for Graphite and friends.\n </p>\n );\n };\n\n componentDidMount() {\n updateDatasourcePluginJsonDataOption(this.props, 'graphiteVersion', this.currentGraphiteVersion);\n }\n\n render() {\n const { options, onOptionsChange } = this.props;\n\n const currentVersion = graphiteVersions.find((item) => item.value === this.currentGraphiteVersion);\n\n return (\n <>\n {options.access === 'direct' && (\n <Alert title=\"Deprecation Notice\" severity=\"warning\">\n This data source uses browser access mode. This mode is deprecated and will be removed in the future. Please\n use server access mode instead.\n </Alert>\n )}\n <DataSourceHttpSettings\n defaultUrl=\"http://localhost:8080\"\n dataSourceConfig={options}\n onChange={onOptionsChange}\n />\n <h3 className=\"page-heading\">Graphite details</h3>\n <div className=\"gf-form-group\">\n <div className=\"gf-form-inline\">\n <div className=\"gf-form\">\n <InlineFormLabel tooltip=\"This option controls what functions are available in the Graphite query editor.\">\n Version\n </InlineFormLabel>\n <Select\n aria-label=\"Graphite version\"\n value={currentVersion}\n options={graphiteVersions}\n width={8}\n onChange={onUpdateDatasourceJsonDataOptionSelect(this.props, 'graphiteVersion')}\n />\n </div>\n </div>\n <div className=\"gf-form-inline\">\n <div className=\"gf-form\">\n <InlineFormLabel tooltip={this.renderTypeHelp}>Type</InlineFormLabel>\n <Select\n aria-label=\"Graphite backend type\"\n options={graphiteTypes}\n value={graphiteTypes.find((type) => type.value === options.jsonData.graphiteType)}\n width={8}\n onChange={onUpdateDatasourceJsonDataOptionSelect(this.props, 'graphiteType')}\n />\n </div>\n </div>\n {options.jsonData.graphiteType === GraphiteType.Metrictank && (\n <div className=\"gf-form-inline\">\n <div className=\"gf-form\">\n <Switch\n label=\"Rollup indicator\"\n labelClass={'width-10'}\n tooltip=\"Shows up as an info icon in panel headers when data is aggregated\"\n checked={!!options.jsonData.rollupIndicatorEnabled}\n onChange={onUpdateDatasourceJsonDataOptionChecked(this.props, 'rollupIndicatorEnabled')}\n />\n </div>\n </div>\n )}\n </div>\n <MappingsConfiguration\n mappings={(options.jsonData.importConfiguration?.loki?.mappings || []).map(toString)}\n showHelp={this.state.showMappingsHelp}\n onDismiss={() => {\n this.setState({ showMappingsHelp: false });\n store.setObject(SHOW_MAPPINGS_HELP_KEY, false);\n }}\n onRestoreHelp={() => {\n this.setState({ showMappingsHelp: true });\n store.setObject(SHOW_MAPPINGS_HELP_KEY, true);\n }}\n onChange={(mappings) => {\n onOptionsChange({\n ...options,\n jsonData: {\n ...options.jsonData,\n importConfiguration: {\n ...options.jsonData.importConfiguration,\n loki: {\n mappings: mappings.map(fromString),\n },\n },\n },\n });\n }}\n />\n </>\n );\n }\n\n private get currentGraphiteVersion() {\n return this.props.options.jsonData.graphiteVersion || DEFAULT_GRAPHITE_VERSION;\n }\n}\n","import { isNumber } from 'lodash';\n\nconst versionPattern = /^(\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))?(?:-([0-9A-Za-z\\.]+))?/;\n\nexport class SemVersion {\n major: number;\n minor: number;\n patch: number;\n meta: string;\n\n constructor(version: string) {\n this.major = 0;\n this.minor = 0;\n this.patch = 0;\n this.meta = '';\n const match = versionPattern.exec(version);\n if (match) {\n this.major = Number(match[1]);\n this.minor = Number(match[2] || 0);\n this.patch = Number(match[3] || 0);\n this.meta = match[4];\n }\n }\n\n isGtOrEq(version: string): boolean {\n const compared = new SemVersion(version);\n\n for (let i = 0; i < this.comparable.length; ++i) {\n if (this.comparable[i] > compared.comparable[i]) {\n return true;\n }\n if (this.comparable[i] < compared.comparable[i]) {\n return false;\n }\n }\n return true;\n }\n\n isValid(): boolean {\n return isNumber(this.major);\n }\n\n get comparable() {\n return [this.major, this.minor, this.patch];\n }\n}\n\nexport function isVersionGtOrEq(a: string, b: string): boolean {\n const aSemver = new SemVersion(a);\n return aSemver.isGtOrEq(b);\n}\n","import { assign, each, filter, forEach, get, includes, isString, last, map, toString, isFinite } from 'lodash';\n\nimport { InterpolateFunction } from '@grafana/data';\nimport { isVersionGtOrEq } from 'app/core/utils/version';\n\nexport type ParamDef = {\n name: string;\n type: string;\n options?: Array<string | number>;\n multiple?: boolean;\n optional?: boolean;\n version?: string;\n};\n\nexport interface FuncDef {\n name: string;\n params: ParamDef[];\n defaultParams: Array<string | number>;\n category?: string;\n shortName?: any;\n fake?: boolean;\n version?: string;\n description?: string;\n /**\n * True if the function was not found on the list of available function descriptions.\n */\n unknown?: boolean;\n}\n\nexport type FuncDefs = {\n [functionName in string]: FuncDef;\n};\n\nconst index: FuncDefs = {};\n\nfunction addFuncDef(funcDef: Partial<FuncDef> & { name: string; category: string }) {\n funcDef.params = funcDef.params || [];\n funcDef.defaultParams = funcDef.defaultParams || [];\n\n index[funcDef.name] = funcDef as FuncDef;\n if (funcDef.shortName) {\n index[funcDef.shortName] = funcDef as FuncDef;\n }\n}\n\nconst optionalSeriesRefArgs = [{ name: 'other', type: 'value_or_series', optional: true, multiple: true }];\n\naddFuncDef({\n name: 'scaleToSeconds',\n category: 'Transform',\n params: [{ name: 'seconds', type: 'int' }],\n defaultParams: [1],\n});\n\naddFuncDef({\n name: 'perSecond',\n category: 'Transform',\n params: [{ name: 'max value', type: 'int', optional: true }],\n defaultParams: [],\n});\n\naddFuncDef({\n name: 'holtWintersForecast',\n category: 'Calculate',\n});\n\naddFuncDef({\n name: 'holtWintersConfidenceBands',\n category: 'Calculate',\n params: [{ name: 'delta', type: 'int' }],\n defaultParams: [3],\n});\n\naddFuncDef({\n name: 'holtWintersAberration',\n category: 'Calculate',\n params: [{ name: 'delta', type: 'int' }],\n defaultParams: [3],\n});\n\naddFuncDef({\n name: 'nPercentile',\n category: 'Calculate',\n params: [{ name: 'Nth percentile', type: 'int' }],\n defaultParams: [95],\n});\n\naddFuncDef({\n name: 'diffSeries',\n params: optionalSeriesRefArgs,\n defaultParams: ['#A'],\n category: 'Combine',\n});\n\naddFuncDef({\n name: 'stddevSeries',\n params: optionalSeriesRefArgs,\n defaultParams: [''],\n category: 'Combine',\n});\n\naddFuncDef({\n name: 'divideSeries',\n params: optionalSeriesRefArgs,\n defaultParams: ['#A'],\n category: 'Combine',\n});\n\naddFuncDef({\n name: 'multiplySeries',\n params: optionalSeriesRefArgs,\n defaultParams: ['#A'],\n category: 'Combine',\n});\n\naddFuncDef({\n name: 'asPercent',\n params: optionalSeriesRefArgs,\n defaultParams: ['#A'],\n category: 'Combine',\n});\n\naddFuncDef({\n name: 'group',\n params: optionalSeriesRefArgs,\n defaultParams: ['#A', '#B'],\n category: 'Combine',\n});\n\naddFuncDef({\n name: 'sumSeries',\n shortName: 'sum',\n category: 'Combine',\n params: optionalSeriesRefArgs,\n defaultParams: [''],\n});\n\naddFuncDef({\n name: 'averageSeries',\n shortName: 'avg',\n category: 'Combine',\n params: optionalSeriesRefArgs,\n defaultParams: [''],\n});\n\naddFuncDef({\n name: 'rangeOfSeries',\n category: 'Combine',\n});\n\naddFuncDef({\n name: 'percentileOfSeries',\n category: 'Combine',\n params: [\n { name: 'n', type: 'int' },\n { name: 'interpolate', type: 'boolean', options: ['true', 'false'] },\n ],\n defaultParams: [95, 'false'],\n});\n\naddFuncDef({\n name: 'sumSeriesWithWildcards',\n category: 'Combine',\n params: [{ name: 'node', type: 'int', multiple: true }],\n defaultParams: [3],\n});\n\naddFuncDef({\n name: 'maxSeries',\n shortName: 'max',\n category: 'Combine',\n});\n\naddFuncDef({\n name: 'minSeries',\n shortName: 'min',\n category: 'Combine',\n});\n\naddFuncDef({\n name: 'averageSeriesWithWildcards',\n category: 'Combine',\n params: [{ name: 'node', type: 'int', multiple: true }],\n defaultParams: [3],\n});\n\naddFuncDef({\n name: 'alias',\n category: 'Alias',\n params: [{ name: 'alias', type: 'string' }],\n defaultParams: ['alias'],\n});\n\naddFuncDef({\n name: 'aliasSub',\n category: 'Alias',\n params: [\n { name: 'search', type: 'string' },\n { name: 'replace', type: 'string' },\n ],\n defaultParams: ['', '\\\\1'],\n});\n\naddFuncDef({\n name: 'consolidateBy',\n category: 'Special',\n params: [\n {\n name: 'function',\n type: 'string',\n options: ['sum', 'average', 'min', 'max'],\n },\n ],\n defaultParams: ['max'],\n});\n\naddFuncDef({\n name: 'cumulative',\n category: 'Special',\n params: [],\n defaultParams: [],\n});\n\naddFuncDef({\n name: 'groupByNode',\n category: 'Combine',\n params: [\n {\n name: 'node',\n type: 'int',\n options: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12],\n },\n {\n name: 'function',\n type: 'string',\n options: ['sum', 'avg', 'maxSeries'],\n },\n ],\n defaultParams: [3, 'sum'],\n});\n\naddFuncDef({\n name: 'aliasByNode',\n category: 'Alias',\n params: [\n {\n name: 'node',\n type: 'int',\n options: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12],\n multiple: true,\n },\n ],\n defaultParams: [3],\n});\n\naddFuncDef({\n name: 'substr',\n category: 'Special',\n params: [\n {\n name: 'start',\n type: 'int',\n options: [-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12],\n },\n {\n name: 'stop',\n type: 'int',\n options: [-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12],\n },\n ],\n defaultParams: [0, 0],\n});\n\naddFuncDef({\n name: 'sortByName',\n category: 'Sorting',\n params: [\n {\n name: 'natural',\n type: 'boolean',\n options: ['true', 'false'],\n optional: true,\n },\n ],\n defaultParams: ['false'],\n});\n\naddFuncDef({\n name: 'sortByMaxima',\n category: 'Sorting',\n});\n\naddFuncDef({\n name: 'sortByMinima',\n category: 'Sorting',\n});\n\naddFuncDef({\n name: 'sortByTotal',\n category: 'Sorting',\n});\n\naddFuncDef({\n name: 'aliasByMetric',\n category: 'Alias',\n});\n\naddFuncDef({\n name: 'randomWalk',\n fake: true,\n category: 'Special',\n params: [{ name: 'name', type: 'string' }],\n defaultParams: ['randomWalk'],\n});\n\naddFuncDef({\n name: 'countSeries',\n category: 'Combine',\n});\n\naddFuncDef({\n name: 'constantLine',\n category: 'Special',\n params: [{ name: 'value', type: 'int' }],\n defaultParams: [10],\n});\n\naddFuncDef({\n name: 'cactiStyle',\n category: 'Special',\n});\n\naddFuncDef({\n name: 'keepLastValue',\n category: 'Transform',\n params: [{ name: 'n', type: 'int' }],\n defaultParams: [100],\n});\n\naddFuncDef({\n name: 'changed',\n category: 'Special',\n params: [],\n defaultParams: [],\n});\n\naddFuncDef({\n name: 'scale',\n category: 'Transform',\n params: [{ name: 'factor', type: 'int' }],\n defaultParams: [1],\n});\n\naddFuncDef({\n name: 'offset',\n category: 'Transform',\n params: [{ name: 'amount', type: 'int' }],\n defaultParams: [10],\n});\n\naddFuncDef({\n name: 'transformNull',\n category: 'Transform',\n params: [{ name: 'amount', type: 'int' }],\n defaultParams: [0],\n});\n\naddFuncDef({\n name: 'integral',\n category: 'Transform',\n});\n\naddFuncDef({\n name: 'derivative',\n category: 'Transform',\n});\n\naddFuncDef({\n name: 'nonNegativeDerivative',\n category: 'Transform',\n params: [{ name: 'max value or 0', type: 'int', optional: true }],\n defaultParams: [''],\n});\n\naddFuncDef({\n name: 'timeShift',\n category: 'Transform',\n params: [\n {\n name: 'amount',\n type: 'select',\n options: ['1h', '6h', '12h', '1d', '2d', '7d', '14d', '30d'],\n },\n ],\n defaultParams: ['1d'],\n});\n\naddFuncDef({\n name: 'timeStack',\n category: 'Transform',\n params: [\n {\n name: 'timeShiftUnit',\n type: 'select',\n options: ['1h', '6h', '12h', '1d', '2d', '7d', '14d', '30d'],\n },\n { name: 'timeShiftStart', type: 'int' },\n { name: 'timeShiftEnd', type: 'int' },\n ],\n defaultParams: ['1d', 0, 7],\n});\n\naddFuncDef({\n name: 'summarize',\n category: 'Transform',\n params: [\n { name: 'interval', type: 'string' },\n {\n name: 'func',\n type: 'select',\n options: ['sum', 'avg', 'min', 'max', 'last'],\n },\n {\n name: 'alignToFrom',\n type: 'boolean',\n optional: true,\n options: ['false', 'true'],\n },\n ],\n defaultParams: ['1h', 'sum', 'false'],\n});\n\naddFuncDef({\n name: 'smartSummarize',\n category: 'Transform',\n params: [\n { name: 'interval', type: 'string' },\n {\n name: 'func',\n type: 'select',\n options: ['sum', 'avg', 'min', 'max', 'last'],\n },\n ],\n defaultParams: ['1h', 'sum'],\n});\n\naddFuncDef({\n name: 'absolute',\n category: 'Transform',\n});\n\naddFuncDef({\n name: 'hitcount',\n category: 'Transform',\n params: [{ name: 'interval', type: 'string' }],\n defaultParams: ['10s'],\n});\n\naddFuncDef({\n name: 'log',\n category: 'Transform',\n params: [{ name: 'base', type: 'int' }],\n defaultParams: ['10'],\n});\n\naddFuncDef({\n name: 'averageAbove',\n category: 'Filter Series',\n params: [{ name: 'n', type: 'int' }],\n defaultParams: [25],\n});\n\naddFuncDef({\n name: 'averageBelow',\n category: 'Filter Series',\n params: [{ name: 'n', type: 'int' }],\n defaultParams: [25],\n});\n\naddFuncDef({\n name: 'currentAbove',\n category: 'Filter Series',\n params: [{ name: 'n', type: 'int' }],\n defaultParams: [25],\n});\n\naddFuncDef({\n name: 'currentBelow',\n category: 'Filter Series',\n params: [{ name: 'n', type: 'int' }],\n defaultParams: [25],\n});\n\naddFuncDef({\n name: 'maximumAbove',\n category: 'Filter Series',\n params: [{ name: 'value', type: 'int' }],\n defaultParams: [0],\n});\n\naddFuncDef({\n name: 'maximumBelow',\n category: 'Filter Series',\n params: [{ name: 'value', type: 'int' }],\n defaultParams: [0],\n});\n\naddFuncDef({\n name: 'minimumAbove',\n category: 'Filter Series',\n params: [{ name: 'value', type: 'int' }],\n defaultParams: [0],\n});\n\naddFuncDef({\n name: 'minimumBelow',\n category: 'Filter Series',\n params: [{ name: 'value', type: 'int' }],\n defaultParams: [0],\n});\n\naddFuncDef({\n name: 'limit',\n category: 'Filter Series',\n params: [{ name: 'n', type: 'int' }],\n defaultParams: [5],\n});\n\naddFuncDef({\n name: 'mostDeviant',\n category: 'Filter Series',\n params: [{ name: 'n', type: 'int' }],\n defaultParams: [10],\n});\n\naddFuncDef({\n name: 'exclude',\n category: 'Filter Series',\n params: [{ name: 'exclude', type: 'string' }],\n defaultParams: ['exclude'],\n});\n\naddFuncDef({\n name: 'highestCurrent',\n category: 'Filter Series',\n params: [{ name: 'count', type: 'int' }],\n defaultParams: [5],\n});\n\naddFuncDef({\n name: 'highestMax',\n category: 'Filter Series',\n params: [{ name: 'count', type: 'int' }],\n defaultParams: [5],\n});\n\naddFuncDef({\n name: 'lowestCurrent',\n category: 'Filter Series',\n params: [{ name: 'count', type: 'int' }],\n defaultParams: [5],\n});\n\naddFuncDef({\n name: 'movingAverage',\n category: 'Calculate',\n params: [\n {\n name: 'windowSize',\n type: 'int_or_interval',\n options: ['5', '7', '10', '5min', '10min', '30min', '1hour'],\n },\n ],\n defaultParams: [10],\n});\n\naddFuncDef({\n name: 'movingMedian',\n category: 'Calculate',\n params: [\n {\n name: 'windowSize',\n type: 'int_or_interval',\n options: ['5', '7', '10', '5min', '10min', '30min', '1hour'],\n },\n ],\n defaultParams: ['5'],\n});\n\naddFuncDef({\n name: 'stdev',\n category: 'Calculate',\n params: [\n { name: 'n', type: 'int' },\n { name: 'tolerance', type: 'int' },\n ],\n defaultParams: [5, 0.1],\n});\n\naddFuncDef({\n name: 'highestAverage',\n category: 'Filter Series',\n params: [{ name: 'count', type: 'int' }],\n defaultParams: [5],\n});\n\naddFuncDef({\n name: 'lowestAverage',\n category: 'Filter Series',\n params: [{ name: 'count', type: 'int' }],\n defaultParams: [5],\n});\n\naddFuncDef({\n name: 'removeAbovePercentile',\n category: 'Filter Data',\n params: [{ name: 'n', type: 'int' }],\n defaultParams: [5],\n});\n\naddFuncDef({\n name: 'removeAboveValue',\n category: 'Filter Data',\n params: [{ name: 'n', type: 'int' }],\n defaultParams: [5],\n});\n\naddFuncDef({\n name: 'removeBelowPercentile',\n category: 'Filter Data',\n params: [{ name: 'n', type: 'int' }],\n defaultParams: [5],\n});\n\naddFuncDef({\n name: 'removeBelowValue',\n category: 'Filter Data',\n params: [{ name: 'n', type: 'int' }],\n defaultParams: [5],\n});\n\naddFuncDef({\n name: 'useSeriesAbove',\n category: 'Filter Series',\n params: [\n { name: 'value', type: 'int' },\n { name: 'search', type: 'string' },\n { name: 'replace', type: 'string' },\n ],\n defaultParams: [0, 'search', 'replace'],\n});\n\n////////////////////\n// Graphite 1.0.x //\n////////////////////\n\naddFuncDef({\n name: 'aggregateLine',\n category: 'Calculate',\n params: [\n {\n name: 'func',\n type: 'select',\n options: ['sum', 'avg', 'min', 'max', 'last'],\n },\n ],\n defaultParams: ['avg'],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'averageOutsidePercentile',\n category: 'Filter Series',\n params: [{ name: 'n', type: 'int' }],\n defaultParams: [95],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'delay',\n category: 'Transform',\n params: [{ name: 'steps', type: 'int' }],\n defaultParams: [1],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'exponentialMovingAverage',\n category: 'Calculate',\n params: [\n {\n name: 'windowSize',\n type: 'int_or_interval',\n options: ['5', '7', '10', '5min', '10min', '30min', '1hour'],\n },\n ],\n defaultParams: [10],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'fallbackSeries',\n category: 'Special',\n params: [{ name: 'fallback', type: 'string' }],\n defaultParams: ['constantLine(0)'],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'grep',\n category: 'Filter Series',\n params: [{ name: 'grep', type: 'string' }],\n defaultParams: ['grep'],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'groupByNodes',\n category: 'Combine',\n params: [\n {\n name: 'function',\n type: 'string',\n options: ['sum', 'avg', 'maxSeries'],\n },\n {\n name: 'node',\n type: 'int',\n options: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12],\n multiple: true,\n },\n ],\n defaultParams: ['sum', 3],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'integralByInterval',\n category: 'Transform',\n params: [\n {\n name: 'intervalUnit',\n type: 'select',\n options: ['1h', '6h', '12h', '1d', '2d', '7d', '14d', '30d'],\n },\n ],\n defaultParams: ['1d'],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'interpolate',\n category: 'Transform',\n params: [{ name: 'limit', type: 'int', optional: true }],\n defaultParams: [],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'invert',\n category: 'Transform',\n version: '1.0',\n});\n\naddFuncDef({\n name: 'isNonNull',\n category: 'Combine',\n version: '1.0',\n});\n\naddFuncDef({\n name: 'linearRegression',\n category: 'Calculate',\n params: [\n {\n name: 'startSourceAt',\n type: 'select',\n options: ['-1h', '-6h', '-12h', '-1d', '-2d', '-7d', '-14d', '-30d'],\n optional: true,\n },\n {\n name: 'endSourceAt',\n type: 'select',\n options: ['-1h', '-6h', '-12h', '-1d', '-2d', '-7d', '-14d', '-30d'],\n optional: true,\n },\n ],\n defaultParams: [],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'mapSeries',\n shortName: 'map',\n params: [{ name: 'node', type: 'int' }],\n defaultParams: [3],\n category: 'Combine',\n version: '1.0',\n});\n\naddFuncDef({\n name: 'movingMin',\n category: 'Calculate',\n params: [\n {\n name: 'windowSize',\n type: 'int_or_interval',\n options: ['5', '7', '10', '5min', '10min', '30min', '1hour'],\n },\n ],\n defaultParams: [10],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'movingMax',\n category: 'Calculate',\n params: [\n {\n name: 'windowSize',\n type: 'int_or_interval',\n options: ['5', '7', '10', '5min', '10min', '30min', '1hour'],\n },\n ],\n defaultParams: [10],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'movingSum',\n category: 'Calculate',\n params: [\n {\n name: 'windowSize',\n type: 'int_or_interval',\n options: ['5', '7', '10', '5min', '10min', '30min', '1hour'],\n },\n ],\n defaultParams: [10],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'multiplySeriesWithWildcards',\n category: 'Combine',\n params: [\n {\n name: 'position',\n type: 'int',\n options: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12],\n multiple: true,\n },\n ],\n defaultParams: [2],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'offsetToZero',\n category: 'Transform',\n version: '1.0',\n});\n\naddFuncDef({\n name: 'pow',\n category: 'Transform',\n params: [{ name: 'factor', type: 'int' }],\n defaultParams: [10],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'powSeries',\n category: 'Transform',\n params: optionalSeriesRefArgs,\n defaultParams: [''],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'reduceSeries',\n shortName: 'reduce',\n params: [\n {\n name: 'function',\n type: 'string',\n options: ['asPercent', 'diffSeries', 'divideSeries'],\n },\n {\n name: 'reduceNode',\n type: 'int',\n options: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],\n },\n { name: 'reduceMatchers', type: 'string', multiple: true },\n ],\n defaultParams: ['asPercent', 2, 'used_bytes'],\n category: 'Combine',\n version: '1.0',\n});\n\naddFuncDef({\n name: 'removeBetweenPercentile',\n category: 'Filter Series',\n params: [{ name: 'n', type: 'int' }],\n defaultParams: [95],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'removeEmptySeries',\n category: 'Filter Series',\n version: '1.0',\n});\n\naddFuncDef({\n name: 'squareRoot',\n category: 'Transform',\n version: '1.0',\n});\n\naddFuncDef({\n name: 'timeSlice',\n category: 'Transform',\n params: [\n {\n name: 'startSliceAt',\n type: 'select',\n options: ['-1h', '-6h', '-12h', '-1d', '-2d', '-7d', '-14d', '-30d'],\n },\n {\n name: 'endSliceAt',\n type: 'select',\n options: ['-1h', '-6h', '-12h', '-1d', '-2d', '-7d', '-14d', '-30d'],\n optional: true,\n },\n ],\n defaultParams: ['-1h'],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'weightedAverage',\n category: 'Combine',\n params: [\n { name: 'other', type: 'value_or_series', optional: true },\n {\n name: 'node',\n type: 'int',\n options: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12],\n },\n ],\n defaultParams: ['#A', 4],\n version: '1.0',\n});\n\naddFuncDef({\n name: 'seriesByTag',\n category: 'Special',\n params: [{ name: 'tagExpression', type: 'string', multiple: true }],\n version: '1.1',\n});\n\naddFuncDef({\n name: 'groupByTags',\n category: 'Combine',\n params: [\n {\n name: 'function',\n type: 'string',\n options: ['sum', 'avg', 'maxSeries'],\n },\n { name: 'tag', type: 'string', multiple: true },\n ],\n defaultParams: ['sum', 'tag'],\n version: '1.1',\n});\n\naddFuncDef({\n name: 'aliasByTags',\n category: 'Alias',\n params: [{ name: 'tag', type: 'string', multiple: true }],\n defaultParams: ['tag'],\n version: '1.1',\n});\n\nfunction isVersionRelatedFunction(obj: { version?: string }, graphiteVersion: string) {\n return !obj.version || isVersionGtOrEq(graphiteVersion, obj.version);\n}\n\nexport class FuncInstance {\n def: FuncDef;\n params: Array<string | number>;\n text: any;\n /**\n * True if this function was just added and not edited yet. It's used to focus on first\n * function param to edit it straight away after adding a function.\n */\n declare added: boolean;\n /**\n * Hidden functions are not displayed in UI but available in text editor\n * This is used for seriesByTagUsed function which when used switches\n * the editor to tag-only mode. Defined tags are provided to seriesByTagUsed\n * as parameters.\n */\n hidden?: boolean;\n\n constructor(funcDef: FuncDef, options?: { withDefaultParams: any }) {\n this.def = funcDef;\n this.params = [];\n\n if (options && options.withDefaultParams && funcDef.defaultParams) {\n this.params = funcDef.defaultParams.slice(0);\n }\n\n this.updateText();\n }\n\n render(metricExp: string, replaceVariables: InterpolateFunction): string {\n const str = this.def.name + '(';\n\n const parameters = map(this.params, (value, index) => {\n let paramType;\n\n if (index < this.def.params.length) {\n paramType = this.def.params[index].type;\n } else if (get(last(this.def.params), 'multiple')) {\n paramType = get(last(this.def.params), 'type');\n }\n\n // param types that should never be quoted\n if (includes(['value_or_series', 'boolean', 'int', 'float', 'node', 'int_or_infinity'], paramType)) {\n return value;\n }\n\n const valueInterpolated = isString(value) ? replaceVariables(value) : value;\n\n // param types that might be quoted\n // To quote variables correctly we need to interpolate it to check if it contains a numeric or string value\n if (includes(['int_or_interval', 'node_or_tag'], paramType) && isFinite(+valueInterpolated)) {\n return toString(value);\n }\n\n return \"'\" + value + \"'\";\n });\n\n // don't send any blank parameters to graphite\n while (parameters[parameters.length - 1] === '') {\n parameters.pop();\n }\n\n if (metricExp) {\n parameters.unshift(metricExp);\n }\n\n return str + parameters.join(', ') + ')';\n }\n\n _hasMultipleParamsInString(strValue: any, index: number) {\n if (strValue.indexOf(',') === -1) {\n return false;\n }\n\n if (this.def.params[index + 1] && this.def.params[index + 1].optional) {\n return true;\n }\n\n if (index + 1 >= this.def.params.length && get(last(this.def.params), 'multiple')) {\n return true;\n }\n\n return false;\n }\n\n updateParam(strValue: any, index: any) {\n // handle optional parameters\n // if string contains ',' and next param is optional, split and update both\n if (this._hasMultipleParamsInString(strValue, index)) {\n each(strValue.split(','), (partVal, idx) => {\n this.updateParam(partVal.trim(), index + idx);\n });\n return;\n }\n\n if (strValue === '' && (index >= this.def.params.length || this.def.params[index].optional)) {\n this.params.splice(index, 1);\n } else {\n this.params[index] = strValue;\n }\n\n this.updateText();\n }\n\n updateText() {\n if (this.params.length === 0) {\n this.text = this.def.name + '()';\n return;\n }\n\n let text = this.def.name + '(';\n text += this.params.join(', ');\n text += ')';\n this.text = text;\n }\n}\n\nfunction createFuncInstance(funcDef: any, options?: { withDefaultParams: any }, idx?: any): FuncInstance {\n if (isString(funcDef)) {\n funcDef = getFuncDef(funcDef, idx);\n }\n return new FuncInstance(funcDef, options);\n}\n\nfunction getFuncDef(name: string, idx?: any): FuncDef {\n if (!(idx || index)[name]) {\n return { name: name, params: [{ name: '', type: '', multiple: true }], defaultParams: [''], unknown: true };\n }\n return (idx || index)[name];\n}\n\nfunction getFuncDefs(graphiteVersion: string, idx?: any): FuncDefs {\n const funcs: FuncDefs = {};\n forEach(idx || index, (funcDef: FuncDef) => {\n if (isVersionRelatedFunction(funcDef, graphiteVersion)) {\n funcs[funcDef.name] = assign({}, funcDef, {\n params: filter(funcDef.params, (param) => {\n return isVersionRelatedFunction(param, graphiteVersion);\n }),\n });\n }\n });\n return funcs;\n}\n\n// parse response from graphite /functions endpoint into internal format\nfunction parseFuncDefs(rawDefs: any): FuncDefs {\n const funcDefs: FuncDefs = {};\n\n forEach(rawDefs || {}, (funcDef, funcName) => {\n // skip graphite graph functions\n if (funcDef.group === 'Graph') {\n return;\n }\n\n let description = funcDef.description;\n if (description) {\n // tidy up some pydoc syntax that rst2html can't handle\n description = description\n .replace(/:py:func:`(.+)( <[^>]*>)?`/g, '``$1``')\n .replace(/.. seealso:: /g, 'See also: ')\n .replace(/.. code-block *:: *none/g, '.. code-block::');\n }\n\n const func: FuncDef = {\n name: funcDef.name,\n description,\n category: funcDef.group,\n params: [],\n defaultParams: [],\n fake: false,\n };\n\n // get rid of the first \"seriesList\" param\n if (/^seriesLists?$/.test(get(funcDef, 'params[0].type', ''))) {\n // handle functions that accept multiple seriesLists\n // we leave the param in place but mark it optional, so users can add more series if they wish\n if (funcDef.params[0].multiple) {\n funcDef.params[0].required = false;\n // otherwise chop off the first param, it'll be handled separately\n } else {\n funcDef.params.shift();\n }\n // tag function as fake\n } else {\n func.fake = true;\n }\n\n forEach(funcDef.params, (rawParam) => {\n const param: any = {\n name: rawParam.name,\n type: 'string',\n optional: !rawParam.required,\n multiple: !!rawParam.multiple,\n options: undefined,\n };\n\n if (rawParam.default !== undefined) {\n if (rawParam.default === Infinity) {\n func.defaultParams.push('inf');\n } else {\n func.defaultParams.push(toString(rawParam.default));\n }\n } else if (rawParam.suggestions) {\n func.defaultParams.push(toString(rawParam.suggestions[0]));\n } else {\n func.defaultParams.push('');\n }\n\n if (rawParam.type === 'boolean') {\n param.type = 'boolean';\n param.options = ['true', 'false'];\n } else if (rawParam.type === 'integer') {\n param.type = 'int';\n } else if (rawParam.type === 'float') {\n param.type = 'float';\n } else if (rawParam.type === 'node') {\n param.type = 'node';\n param.options = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'];\n } else if (rawParam.type === 'nodeOrTag') {\n param.type = 'node_or_tag';\n param.options = ['name', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'];\n } else if (rawParam.type === 'intOrInterval') {\n param.type = 'int_or_interval';\n } else if (rawParam.type === 'seriesList') {\n param.type = 'value_or_series';\n } else if (rawParam.type === 'intOrInf') {\n param.type = 'int_or_infinity';\n }\n\n if (rawParam.options) {\n param.options = map(rawParam.options, toString);\n } else if (rawParam.suggestions) {\n param.options = map(rawParam.suggestions, toString);\n }\n\n func.params.push(param);\n });\n\n funcDefs[funcName] = func;\n });\n\n return funcDefs;\n}\n\nexport default {\n createFuncInstance: createFuncInstance,\n getFuncDef: getFuncDef,\n getFuncDefs: getFuncDefs,\n parseFuncDefs: parseFuncDefs,\n};\n","import { each, indexOf, isArray, isString, map as _map } from 'lodash';\nimport { lastValueFrom, Observable, of, OperatorFunction, pipe, throwError } from 'rxjs';\nimport { catchError, map } from 'rxjs/operators';\n\nimport {\n DataFrame,\n DataQueryRequest,\n DataQueryResponse,\n DataSourceApi,\n DataSourceWithQueryExportSupport,\n dateMath,\n AbstractQuery,\n AbstractLabelOperator,\n AbstractLabelMatcher,\n MetricFindValue,\n QueryResultMetaStat,\n ScopedVars,\n TimeRange,\n toDataFrame,\n} from '@grafana/data';\nimport { getBackendSrv } from '@grafana/runtime';\nimport { isVersionGtOrEq, SemVersion } from 'app/core/utils/version';\nimport { getTemplateSrv, TemplateSrv } from 'app/features/templating/template_srv';\nimport { getRollupNotice, getRuntimeConsolidationNotice } from 'app/plugins/datasource/graphite/meta';\n\nimport { getSearchFilterScopedVar } from '../../../features/variables/utils';\n\nimport gfunc, { FuncDefs, FuncInstance } from './gfunc';\nimport GraphiteQueryModel from './graphite_query';\n// Types\nimport {\n GraphiteLokiMapping,\n GraphiteMetricLokiMatcher,\n GraphiteOptions,\n GraphiteQuery,\n GraphiteQueryImportConfiguration,\n GraphiteType,\n MetricTankRequestMeta,\n} from './types';\nimport { reduceError } from './utils';\nimport { DEFAULT_GRAPHITE_VERSION } from './versions';\n\nconst GRAPHITE_TAG_COMPARATORS = {\n '=': AbstractLabelOperator.Equal,\n '!=': AbstractLabelOperator.NotEqual,\n '=~': AbstractLabelOperator.EqualRegEx,\n '!=~': AbstractLabelOperator.NotEqualRegEx,\n};\n\n/**\n * Converts Graphite glob-like pattern to a regular expression\n */\nfunction convertGlobToRegEx(text: string): string {\n if (text.includes('*') || text.includes('{')) {\n return '^' + text.replace(/\\*/g, '.*').replace(/\\{/g, '(').replace(/}/g, ')').replace(/,/g, '|');\n } else {\n return text;\n }\n}\n\nexport class GraphiteDatasource\n extends DataSourceApi<GraphiteQuery, GraphiteOptions, GraphiteQueryImportConfiguration>\n implements DataSourceWithQueryExportSupport<GraphiteQuery>\n{\n basicAuth: string;\n url: string;\n name: string;\n graphiteVersion: any;\n supportsTags: boolean;\n isMetricTank: boolean;\n rollupIndicatorEnabled: boolean;\n cacheTimeout: any;\n withCredentials: boolean;\n funcDefs: FuncDefs | null = null;\n funcDefsPromise: Promise<any> | null = null;\n _seriesRefLetters: string;\n private readonly metricMappings: GraphiteLokiMapping[];\n\n constructor(instanceSettings: any, private readonly templateSrv: TemplateSrv = getTemplateSrv()) {\n super(instanceSettings);\n this.basicAuth = instanceSettings.basicAuth;\n this.url = instanceSettings.url;\n this.name = instanceSettings.name;\n // graphiteVersion is set when a datasource is created but it hadn't been set in the past so we're\n // still falling back to the default behavior here for backwards compatibility (see also #17429)\n this.graphiteVersion = instanceSettings.jsonData.graphiteVersion || DEFAULT_GRAPHITE_VERSION;\n this.metricMappings = instanceSettings.jsonData.importConfiguration?.loki?.mappings || [];\n this.isMetricTank = instanceSettings.jsonData.graphiteType === GraphiteType.Metrictank;\n this.supportsTags = supportsTags(this.graphiteVersion);\n this.cacheTimeout = instanceSettings.cacheTimeout;\n this.rollupIndicatorEnabled = instanceSettings.jsonData.rollupIndicatorEnabled;\n this.withCredentials = instanceSettings.withCredentials;\n this.funcDefs = null;\n this.funcDefsPromise = null;\n this._seriesRefLetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n }\n\n getQueryOptionsInfo() {\n return {\n maxDataPoints: true,\n cacheTimeout: true,\n links: [\n {\n text: 'Help',\n url: 'http://docs.grafana.org/features/datasources/graphite/#using-graphite-in-grafana',\n },\n ],\n };\n }\n\n getImportQueryConfiguration(): GraphiteQueryImportConfiguration {\n return {\n loki: {\n mappings: this.metricMappings,\n },\n };\n }\n\n async exportToAbstractQueries(queries: GraphiteQuery[]): Promise<AbstractQuery[]> {\n return queries.map((query) => this.exportToAbstractQuery(query));\n }\n\n exportToAbstractQuery(query: GraphiteQuery): AbstractQuery {\n const graphiteQuery: GraphiteQueryModel = new GraphiteQueryModel(\n this,\n {\n ...query,\n target: query.target || '',\n textEditor: false,\n },\n getTemplateSrv()\n );\n graphiteQuery.parseTarget();\n\n let labels: AbstractLabelMatcher[] = [];\n const config = this.getImportQueryConfiguration().loki;\n\n if (graphiteQuery.seriesByTagUsed) {\n graphiteQuery.tags.forEach((tag) => {\n labels.push({\n name: tag.key,\n operator: GRAPHITE_TAG_COMPARATORS[tag.operator],\n value: tag.value,\n });\n });\n } else {\n const targetNodes = graphiteQuery.segments.map((segment) => segment.value);\n let mappings = config.mappings.filter((mapping) => mapping.matchers.length <= targetNodes.length);\n\n for (let mapping of mappings) {\n const matchers = mapping.matchers.concat();\n\n matchers.every((matcher: GraphiteMetricLokiMatcher, index: number) => {\n if (matcher.labelName) {\n let value = (targetNodes[index] as string)!;\n\n if (value === '*') {\n return true;\n }\n\n const converted = convertGlobToRegEx(value);\n labels.push({\n name: matcher.labelName,\n operator: converted !== value ? AbstractLabelOperator.EqualRegEx : AbstractLabelOperator.Equal,\n value: converted,\n });\n return true;\n }\n return targetNodes[index] === matcher.value || matcher.value === '*';\n });\n }\n }\n\n return {\n refId: query.refId,\n labelMatchers: labels,\n };\n }\n\n query(options: DataQueryRequest<GraphiteQuery>): Observable<DataQueryResponse> {\n const graphOptions = {\n from: this.translateTime(options.range.raw.from, false, options.timezone),\n until: this.translateTime(options.range.raw.to, true, options.timezone),\n targets: options.targets,\n format: (options as any).format,\n cacheTimeout: options.cacheTimeout || this.cacheTimeout,\n maxDataPoints: options.maxDataPoints,\n };\n\n const params = this.buildGraphiteParams(graphOptions, options.scopedVars);\n if (params.length === 0) {\n return of({ data: [] });\n }\n\n if (this.isMetricTank) {\n params.push('meta=true');\n }\n\n const httpOptions: any = {\n method: 'POST',\n url: '/render',\n data: params.join('&'),\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n };\n\n this.addTracingHeaders(httpOptions, options);\n\n if (options.panelId) {\n httpOptions.requestId = this.name + '.panelId.' + options.panelId;\n }\n\n return this.doGraphiteRequest(httpOptions).pipe(map(this.convertResponseToDataFrames));\n }\n\n addTracingHeaders(httpOptions: { headers: any }, options: { dashboardId?: number; panelId?: number }) {\n const proxyMode = !this.url.match(/^http/);\n if (proxyMode) {\n if (options.dashboardId) {\n httpOptions.headers['X-Dashboard-Id'] = options.dashboardId;\n }\n if (options.panelId) {\n httpOptions.headers['X-Panel-Id'] = options.panelId;\n }\n }\n }\n\n convertResponseToDataFrames = (result: any): DataQueryResponse => {\n const data: DataFrame[] = [];\n if (!result || !result.data) {\n return { data };\n }\n\n // Series are either at the root or under a node called 'series'\n const series = result.data.series || result.data;\n\n if (!isArray(series)) {\n throw { message: 'Missing series in result', data: result };\n }\n\n for (let i = 0; i < series.length; i++) {\n const s = series[i];\n\n // Disables Grafana own series naming\n s.title = s.target;\n\n for (let y = 0; y < s.datapoints.length; y++) {\n s.datapoints[y][1] *= 1000;\n }\n\n const frame = toDataFrame(s);\n\n // Metrictank metadata\n if (s.meta) {\n frame.meta = {\n custom: {\n requestMetaList: result.data.meta, // info for the whole request\n seriesMetaList: s.meta, // Array of metadata\n },\n };\n\n if (this.rollupIndicatorEnabled) {\n const rollupNotice = getRollupNotice(s.meta);\n const runtimeNotice = getRuntimeConsolidationNotice(s.meta);\n\n if (rollupNotice) {\n frame.meta.notices = [rollupNotice];\n } else if (runtimeNotice) {\n frame.meta.notices = [runtimeNotice];\n }\n }\n\n // only add the request stats to the first frame\n if (i === 0 && result.data.meta.stats) {\n frame.meta.stats = this.getRequestStats(result.data.meta);\n }\n }\n\n data.push(frame);\n }\n\n return { data };\n };\n\n getRequestStats(meta: MetricTankRequestMeta): QueryResultMetaStat[] {\n const stats: QueryResultMetaStat[] = [];\n\n for (const key in meta.stats) {\n let unit: string | undefined = undefined;\n\n if (key.endsWith('.ms')) {\n unit = 'ms';\n }\n\n stats.push({ displayName: key, value: meta.stats[key], unit });\n }\n\n return stats;\n }\n\n parseTags(tagString: string) {\n let tags: string[] = [];\n tags = tagString.split(',');\n if (tags.length === 1) {\n tags = tagString.split(' ');\n if (tags[0] === '') {\n tags = [];\n }\n }\n return tags;\n }\n\n interpolateVariablesInQueries(queries: GraphiteQuery[], scopedVars: ScopedVars): GraphiteQuery[] {\n let expandedQueries = queries;\n if (queries && queries.length > 0) {\n expandedQueries = queries.map((query) => {\n const expandedQuery = {\n ...query,\n datasource: this.getRef(),\n target: this.templateSrv.replace(query.target ?? '', scopedVars),\n };\n return expandedQuery;\n });\n }\n return expandedQueries;\n }\n\n annotationQuery(options: any) {\n // Graphite metric as annotation\n if (options.annotation.target) {\n const target = this.templateSrv.replace(options.annotation.target, {}, 'glob');\n const graphiteQuery = {\n range: options.range,\n targets: [{ target: target }],\n format: 'json',\n maxDataPoints: 100,\n } as unknown as DataQueryRequest<GraphiteQuery>;\n\n return lastValueFrom(\n this.query(graphiteQuery).pipe(\n map((result: any) => {\n const list = [];\n\n for (let i = 0; i < result.data.length; i++) {\n const target = result.data[i];\n\n for (let y = 0; y < target.length; y++) {\n const time = target.fields[0].values.get(y);\n const value = target.fields[1].values.get(y);\n\n if (!value) {\n continue;\n }\n\n list.push({\n annotation: options.annotation,\n time,\n title: target.name,\n });\n }\n }\n\n return list;\n })\n )\n );\n } else {\n // Graphite event as annotation\n const tags = this.templateSrv.replace(options.annotation.tags);\n return this.events({ range: options.range, tags: tags }).then((results: any) => {\n const list = [];\n if (!isArray(results.data)) {\n console.error(`Unable to get annotations from ${results.url}.`);\n return [];\n }\n for (let i = 0; i < results.data.length; i++) {\n const e = results.data[i];\n\n let tags = e.tags;\n if (isString(e.tags)) {\n tags = this.parseTags(e.tags);\n }\n\n list.push({\n annotation: options.annotation,\n time: e.when * 1000,\n title: e.what,\n tags: tags,\n text: e.data,\n });\n }\n\n return list;\n });\n }\n }\n\n events(options: { range: TimeRange; tags: any; timezone?: any }) {\n try {\n let tags = '';\n if (options.tags) {\n tags = '&tags=' + options.tags;\n }\n return lastValueFrom(\n this.doGraphiteRequest({\n method: 'GET',\n url:\n '/events/get_data?from=' +\n this.translateTime(options.range.raw.from, false, options.timezone) +\n '&until=' +\n this.translateTime(options.range.raw.to, true, options.timezone) +\n tags,\n })\n );\n } catch (err) {\n return Promise.reject(err);\n }\n }\n\n targetContainsTemplate(target: GraphiteQuery) {\n return this.templateSrv.containsTemplate(target.target ?? '');\n }\n\n translateTime(date: any, roundUp: any, timezone: any) {\n if (isString(date)) {\n if (date === 'now') {\n return 'now';\n } else if (date.indexOf('now-') >= 0 && date.indexOf('/') === -1) {\n date = date.substring(3);\n date = date.replace('m', 'min');\n date = date.replace('M', 'mon');\n return date;\n }\n date = dateMath.parse(date, roundUp, timezone);\n }\n\n // graphite' s from filter is exclusive\n // here we step back one minute in order\n // to guarantee that we get all the data that\n // exists for the specified range\n if (roundUp) {\n if (date.get('s')) {\n date.add(1, 's');\n }\n } else if (roundUp === false) {\n if (date.get('s')) {\n date.subtract(1, 's');\n }\n }\n\n return date.unix();\n }\n\n metricFindQuery(query: string, optionalOptions?: any): Promise<MetricFindValue[]> {\n const options: any = optionalOptions || {};\n\n // First attempt to check for tag-related functions (using empty wildcard for interpolation)\n let interpolatedQuery = this.templateSrv.replace(\n query,\n getSearchFilterScopedVar({ query, wildcardChar: '', options: optionalOptions })\n );\n\n // special handling for tag_values(<tag>[,<expression>]*), this is used for template variables\n let allParams = interpolatedQuery.match(/^tag_values\\((.*)\\)$/);\n let expressions = allParams ? allParams[1].split(',').filter((p) => !!p) : undefined;\n if (expressions) {\n options.limit = 10000;\n return this.getTagValuesAutoComplete(expressions.slice(1), expressions[0], undefined, options);\n }\n\n // special handling for tags(<expression>[,<expression>]*), this is used for template variables\n allParams = interpolatedQuery.match(/^tags\\((.*)\\)$/);\n expressions = allParams ? allParams[1].split(',').filter((p) => !!p) : undefined;\n if (expressions) {\n options.limit = 10000;\n return this.getTagsAutoComplete(expressions, undefined, options);\n }\n\n // If no tag-related query was found, perform metric-based search (using * as the wildcard for interpolation)\n let useExpand = query.match(/^expand\\((.*)\\)$/);\n query = useExpand ? useExpand[1] : query;\n\n interpolatedQuery = this.templateSrv.replace(\n query,\n getSearchFilterScopedVar({ query, wildcardChar: '*', options: optionalOptions })\n );\n\n let range;\n if (options.range) {\n range = {\n from: this.translateTime(options.range.from, false, options.timezone),\n until: this.translateTime(options.range.to, true, options.timezone),\n };\n }\n\n if (useExpand) {\n return this.requestMetricExpand(interpolatedQuery, options.requestId, range);\n } else {\n return this.requestMetricFind(interpolatedQuery, options.requestId, range);\n }\n }\n\n /**\n * Search for metrics matching giving pattern using /metrics/find endpoint. It will\n * return all possible values at the last level of the query, for example:\n *\n * metrics: prod.servers.001.cpu, prod.servers.002.cpu\n * query: *.servers.*\n * result: 001, 002\n *\n * For more complex searches use requestMetricExpand\n */\n private requestMetricFind(\n query: string,\n requestId: string,\n range?: { from: any; until: any }\n ): Promise<MetricFindValue[]> {\n const httpOptions: any = {\n method: 'POST',\n url: '/metrics/find',\n params: {},\n data: `query=${query}`,\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n // for cancellations\n requestId: requestId,\n };\n\n if (range) {\n httpOptions.params.from = range.from;\n httpOptions.params.until = range.until;\n }\n\n return lastValueFrom(\n this.doGraphiteRequest(httpOptions).pipe(\n map((results: any) => {\n return _map(results.data, (metric) => {\n return {\n text: metric.text,\n expandable: metric.expandable ? true : false,\n };\n });\n })\n )\n );\n }\n\n /**\n * Search for metrics matching giving pattern using /metrics/expand endpoint.\n * The result will contain all metrics (with full name) matching provided query.\n * It's a more flexible version of /metrics/find endpoint (@see requestMetricFind)\n */\n private requestMetricExpand(\n query: string,\n requestId: string,\n range?: { from: any; until: any }\n ): Promise<MetricFindValue[]> {\n const httpOptions: any = {\n method: 'GET',\n url: '/metrics/expand',\n params: { query },\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n // for cancellations\n requestId,\n };\n\n if (range) {\n httpOptions.params.from = range.from;\n httpOptions.params.until = range.until;\n }\n\n return lastValueFrom(\n this.doGraphiteRequest(httpOptions).pipe(\n map((results: any) => {\n return _map(results.data.results, (metric) => {\n return {\n text: metric,\n expandable: false,\n };\n });\n })\n )\n );\n }\n\n getTags(optionalOptions: any) {\n const options = optionalOptions || {};\n\n const httpOptions: any = {\n method: 'GET',\n url: '/tags',\n // for cancellations\n requestId: options.requestId,\n };\n\n if (options.range) {\n httpOptions.params.from = this.translateTime(options.range.from, false, options.timezone);\n httpOptions.params.until = this.translateTime(options.range.to, true, options.timezone);\n }\n\n return lastValueFrom(\n this.doGraphiteRequest(httpOptions).pipe(\n map((results: any) => {\n return _map(results.data, (tag) => {\n return {\n text: tag.tag,\n id: tag.id,\n };\n });\n })\n )\n );\n }\n\n getTagValues(options: any = {}) {\n const httpOptions: any = {\n method: 'GET',\n url: '/tags/' + this.templateSrv.replace(options.key),\n // for cancellations\n requestId: options.requestId,\n };\n\n if (options.range) {\n httpOptions.params.from = this.translateTime(options.range.from, false, options.timezone);\n httpOptions.params.until = this.translateTime(options.range.to, true, options.timezone);\n }\n\n return lastValueFrom(\n this.doGraphiteRequest(httpOptions).pipe(\n map((results: any) => {\n if (results.data && results.data.values) {\n return _map(results.data.values, (value) => {\n return {\n text: value.value,\n id: value.id,\n };\n });\n } else {\n return [];\n }\n })\n )\n );\n }\n\n getTagsAutoComplete(expressions: any[], tagPrefix: any, optionalOptions?: any) {\n const options = optionalOptions || {};\n\n const httpOptions: any = {\n method: 'GET',\n url: '/tags/autoComplete/tags',\n params: {\n expr: _map(expressions, (expression) => this.templateSrv.replace((expression || '').trim())),\n },\n // for cancellations\n requestId: options.requestId,\n };\n\n if (tagPrefix) {\n httpOptions.params.tagPrefix = tagPrefix;\n }\n if (options.limit) {\n httpOptions.params.limit = options.limit;\n }\n if (options.range) {\n httpOptions.params.from = this.translateTime(options.range.from, false, options.timezone);\n httpOptions.params.until = this.translateTime(options.range.to, true, options.timezone);\n }\n return lastValueFrom(this.doGraphiteRequest(httpOptions).pipe(mapToTags()));\n }\n\n getTagValuesAutoComplete(expressions: any[], tag: any, valuePrefix: any, optionalOptions: any) {\n const options = optionalOptions || {};\n\n const httpOptions: any = {\n method: 'GET',\n url: '/tags/autoComplete/values',\n params: {\n expr: _map(expressions, (expression) => this.templateSrv.replace((expression || '').trim())),\n tag: this.templateSrv.replace((tag || '').trim()),\n },\n // for cancellations\n requestId: options.requestId,\n };\n\n if (valuePrefix) {\n httpOptions.params.valuePrefix = valuePrefix;\n }\n if (options.limit) {\n httpOptions.params.limit = options.limit;\n }\n if (options.range) {\n httpOptions.params.from = this.translateTime(options.range.from, false, options.timezone);\n httpOptions.params.until = this.translateTime(options.range.to, true, options.timezone);\n }\n return lastValueFrom(this.doGraphiteRequest(httpOptions).pipe(mapToTags()));\n }\n\n getVersion(optionalOptions: any) {\n const options = optionalOptions || {};\n\n const httpOptions = {\n method: 'GET',\n url: '/version',\n requestId: options.requestId,\n };\n\n return lastValueFrom(\n this.doGraphiteRequest(httpOptions).pipe(\n map((results: any) => {\n if (results.data) {\n const semver = new SemVersion(results.data);\n return semver.isValid() ? results.data : '';\n }\n return '';\n }),\n catchError(() => {\n return of('');\n })\n )\n );\n }\n\n createFuncInstance(funcDef: any, options?: any): FuncInstance {\n return gfunc.createFuncInstance(funcDef, options, this.funcDefs);\n }\n\n getFuncDef(name: string) {\n return gfunc.getFuncDef(name, this.funcDefs);\n }\n\n waitForFuncDefsLoaded() {\n return this.getFuncDefs();\n }\n\n getFuncDefs() {\n if (this.funcDefsPromise !== null) {\n return this.funcDefsPromise;\n }\n\n if (!supportsFunctionIndex(this.graphiteVersion)) {\n this.funcDefs = gfunc.getFuncDefs(this.graphiteVersion);\n this.funcDefsPromise = Promise.resolve(this.funcDefs);\n return this.funcDefsPromise;\n }\n\n const httpOptions = {\n method: 'GET',\n url: '/functions',\n // add responseType because if this is not defined,\n // backend_srv defaults to json\n responseType: 'text',\n };\n\n return lastValueFrom(\n this.doGraphiteRequest(httpOptions).pipe(\n map((results: any) => {\n // Fix for a Graphite bug: https://github.com/graphite-project/graphite-web/issues/2609\n // There is a fix for it https://github.com/graphite-project/graphite-web/pull/2612 but\n // it was merged to master in July 2020 but it has never been released (the last Graphite\n // release was 1.1.7 - March 2020). The bug was introduced in Graphite 1.1.7, in versions\n // 1.1.0 - 1.1.6 /functions endpoint returns a valid JSON\n const fixedData = JSON.parse(results.data.replace(/\"default\": ?Infinity/g, '\"default\": 1e9999'));\n this.funcDefs = gfunc.parseFuncDefs(fixedData);\n return this.funcDefs;\n }),\n catchError((error: any) => {\n console.error('Fetching graphite functions error', error);\n this.funcDefs = gfunc.getFuncDefs(this.graphiteVersion);\n return of(this.funcDefs);\n })\n )\n );\n }\n\n testDatasource() {\n const query = {\n panelId: 3,\n rangeRaw: { from: 'now-1h', to: 'now' },\n range: {\n raw: { from: 'now-1h', to: 'now' },\n },\n targets: [{ target: 'constantLine(100)' }],\n maxDataPoints: 300,\n } as unknown as DataQueryRequest<GraphiteQuery>;\n\n return lastValueFrom(this.query(query)).then(() => ({ status: 'success', message: 'Data source is working' }));\n }\n\n doGraphiteRequest(options: {\n method?: string;\n url: any;\n requestId?: any;\n withCredentials?: any;\n headers?: any;\n inspect?: any;\n }) {\n if (this.basicAuth || this.withCredentials) {\n options.withCredentials = true;\n }\n if (this.basicAuth) {\n options.headers = options.headers || {};\n options.headers.Authorization = this.basicAuth;\n }\n\n options.url = this.url + options.url;\n options.inspect = { type: 'graphite' };\n\n return getBackendSrv()\n .fetch(options)\n .pipe(\n catchError((err: any) => {\n return throwError(reduceError(err));\n })\n );\n }\n\n buildGraphiteParams(options: any, scopedVars?: ScopedVars): string[] {\n const graphiteOptions = ['from', 'until', 'rawData', 'format', 'maxDataPoints', 'cacheTimeout'];\n const cleanOptions = [],\n targets: any = {};\n let target, targetValue, i;\n const regex = /\\#([A-Z])/g;\n const intervalFormatFixRegex = /'(\\d+)m'/gi;\n let hasTargets = false;\n\n options['format'] = 'json';\n\n function fixIntervalFormat(match: any) {\n return match.replace('m', 'min').replace('M', 'mon');\n }\n\n for (i = 0; i < options.targets.length; i++) {\n target = options.targets[i];\n if (!target.target) {\n continue;\n }\n\n if (!target.refId) {\n target.refId = this._seriesRefLetters[i];\n }\n\n targetValue = this.templateSrv.replace(target.target, scopedVars);\n targetValue = targetValue.replace(intervalFormatFixRegex, fixIntervalFormat);\n targets[target.refId] = targetValue;\n }\n\n function nestedSeriesRegexReplacer(match: any, g1: string | number) {\n return targets[g1] || match;\n }\n\n for (i = 0; i < options.targets.length; i++) {\n target = options.targets[i];\n if (!target.target) {\n continue;\n }\n\n targetValue = targets[target.refId];\n targetValue = targetValue.replace(regex, nestedSeriesRegexReplacer);\n targets[target.refId] = targetValue;\n\n if (!target.hide) {\n hasTargets = true;\n cleanOptions.push('target=' + encodeURIComponent(targetValue));\n }\n }\n\n each(options, (value, key) => {\n if (indexOf(graphiteOptions, key) === -1) {\n return;\n }\n if (value) {\n cleanOptions.push(key + '=' + encodeURIComponent(value));\n }\n });\n\n if (!hasTargets) {\n return [];\n }\n\n return cleanOptions;\n }\n}\n\nfunction supportsTags(version: string): boolean {\n return isVersionGtOrEq(version, '1.1');\n}\n\nfunction supportsFunctionIndex(version: string): boolean {\n return isVersionGtOrEq(version, '1.1');\n}\n\nfunction mapToTags(): OperatorFunction<any, Array<{ text: string }>> {\n return pipe(\n map((results: any) => {\n if (results.data) {\n return _map(results.data, (value) => {\n return { text: value };\n });\n } else {\n return [];\n }\n })\n );\n}\n","import { last } from 'lodash';\n\n/**\n * Graphite-web before v1.6 returns HTTP 500 with full stack traces in an HTML page\n * when a query fails. It results in massive error alerts with HTML tags in the UI.\n * This function removes all HTML tags and keeps only the last line from the stack\n * trace which should be the most meaningful.\n */\nexport function reduceError(error: any): any {\n if (error && error.status === 500 && error.data?.message?.startsWith('<body')) {\n // Remove all HTML tags and take the last line from the stack trace\n const newMessage = last<string>(\n error.data.message\n .replace(/(<([^>]+)>)/gi, '')\n .trim()\n .split(/\\n/)\n )!.replace(/u?&#[^;]+;/g, '');\n error.data.message = `Graphite encountered an unexpected error while handling your request. ${newMessage}`;\n }\n return error;\n}\n","import { DataSourcePlugin } from '@grafana/data';\n\nimport { GraphiteQueryEditor } from './components/GraphiteQueryEditor';\nimport { MetricTankMetaInspector } from './components/MetricTankMetaInspector';\nimport { ConfigEditor } from './configuration/ConfigEditor';\nimport { GraphiteDatasource } from './datasource';\n\nclass AnnotationsQueryCtrl {\n static templateUrl = 'partials/annotations.editor.html';\n}\n\nexport const plugin = new DataSourcePlugin(GraphiteDatasource)\n .setQueryEditor(GraphiteQueryEditor)\n .setConfigEditor(ConfigEditor)\n .setMetadataInspector(MetricTankMetaInspector)\n .setAnnotationQueryCtrl(AnnotationsQueryCtrl);\n","import { useEffect, useRef } from 'react';\nexport default function usePrevious(state) {\n var ref = useRef();\n useEffect(function () {\n ref.current = state;\n });\n return ref.current;\n}\n"],"names":["init","createAction","timeRangeChanged","queriesChanged","queryChanged","segmentValueChanged","addNewTag","actions","tagChanged","unpause","addFunction","removeFunction","moveFunction","updateFunctionParam","updateQuery","runQuery","toggleEditorMode","unicodeLetterTable","identifierStartTable","i","identifierPartTable","Lexer","constructor","expression","this","input","char","from","peek","charAt","skip","slice","tokenize","list","token","next","push","test","match","scanStringLiteral","scanPunctuator","scanNumericLiteral","scanIdentifier","scanTemplateSequence","value","length","type","pos","id","index","isUnicodeLetter","code","isHexDigit","str","readUnicodeEscapeSequence","bind","ch1","ch2","ch3","ch4","parseInt","getIdentifierStart","chr","charCodeAt","getIdentifierPart","bad","isDecimalDigit","isOctalDigit","isIdentifierStart","ch","isMalformed","base","isPunctuator","isFinite","quote","isUnclosed","jump","Parser","lexer","tokens","getAst","start","functionCall","metricExpression","e","message","curlyBraceSegment","curlySegment","consumeToken","errorMark","metricSegment","curly","parts","split","splice","node","segments","segment","name","params","functionParameters","boolExpression","param","numericLiteral","seriesRefExpression","stringLiteral","concat","parseFloat","text","currentToken","matchToken","undefined","token1","token2","GraphiteQuery","datasource","target","templateSrv","scopedVars","parseTarget","removeTagValue","functions","tags","seriesByTagUsed","error","textEditor","astNode","parseTargetRecursive","err","console","checkOtherSegmentsIndex","getSegmentPathUpTo","arr","reduce","result","func","innerFunc","createFuncInstance","withDefaultParams","each","updateText","def","hidden","splitSeriesByTagParams","getSeriesByTagFuncIndex","addFunctionParameter","join","map","updateSegmentValue","addSelectMetricSegment","newFunc","get","last","without","offset","indexOf","arrayMove","updateModelTarget","targets","wrapFunction","render","replace","metricPath","updateRenderedTarget","refId","forEach","added","targetsByRefId","keyBy","nestedSeriesRefRegex","targetWithNestedQueries","t","refCount","exec","count","countTargetRefs","updated","g1","targetFull","tagPattern","flatten","matches","tag","key","operator","findIndex","getSeriesByTagFunc","seriesByTagFuncIndex","addTag","newTagParam","renderTagString","removeTag","updateTag","tagIndex","renderTagExpressions","excludeIndex","compact","tagExpr","GRAPHITE_TAG_OPERATORS","TAG_PREFIX","async","state","queryModel","buildSegments","modifyLastSegment","clone","checkOtherSegments","fake","fromIndex","path","metricFindQuery","expandable","handleMetricsAutoCompleteError","emptySegments","handleTargetChanged","oldTarget","queries","filter","query","paused","refresh","metricAutoCompleteErrorShown","dispatch","notifyApp","createErrorNotification","handleTagsAutoCompleteError","tagsAutoCompleteErrorShown","reducer","action","deps","payload","waitForFuncDefsLoaded","getTemplateSrv","supportsTags","funcDefs","range","segmentOrString","segmentIndex","pause","tagParam","addSeriesByTagFunc","spliceSegments","newTag","smartlyHandleNewAliasByNode","updateParam","DispatchContext","createContext","GraphiteStateContext","useDispatch","useContext","GraphiteQueryEditorContext","onRunQuery","onChange","children","setState","useState","needsRefresh","setNeedsRefresh","useMemo","createStore","previousRange","usePrevious","useEffect","raw","Provider","mapStringsToSelectables","values","label","mapSegmentsToSelectables","createEditableParam","paramDef","additional","toString","optional","multiple","options","option","AddGraphiteFunction","setValue","styles","useStyles2","getStyles","categories","funcDef","category","sortBy","mapFuncDefsToSelectables","Segment","Component","Button","icon","variant","className","cx","button","inputMinWidth","theme","css","spacing","FunctionDescription","React","default","rst2html","props","dangerouslySetInnerHTML","__html","description","FunctionHelpButton","tooltip","Suspense","fallback","Tooltip","content","placement","Icon","onClick","window","open","FunctionEditorControls","onMoveLeft","onMoveRight","onRemove","style","display","width","justifyContent","fontWeight","typography","fontWeightMedium","fontSize","bodySmall","cursor","FunctionEditor","unknown","TooltipContent","interactive","size","updatePopperPosition","rel","href","FunctionParamEditor","editableParam","onExpandedChange","autofocus","inputPlaceholder","placeholder","allowCustomValue","allowEmptyValue","SegmentInput","height","paddingTop","marginTop","paddingLeft","minWidth","displayName","margin","padding","GraphiteFunctionEditor","mouseOver","setIsMouseOver","expanded","setIsExpanded","mapFuncInstanceToParams","p","container","onMouseOver","onMouseLeave","HorizontalGroup","InlineLabel","backgroundColor","colors","background","secondary","borderRadius","shape","marginRight","v1","formInputHeight","main","FunctionsSection","SegmentSection","fill","GraphiteTextEditor","rawQuery","useCallback","QueryField","onBlur","portalOrigin","MAX_SUGGESTIONS","getAltSegments","prefix","requestId","altSegments","eachRight","unshift","getVariables","variable","remove","s","removeTaggedEntry","tagSegments","getTagsAsSegments","addAltTagSegments","getTagsSelectables","tagPrefix","tagExpressions","getTagsAutoComplete","limit","altTags","getTags","tagsAsSegments","val","getTagValuesSelectables","valuePrefix","tagKey","getTagValuesAutoComplete","altValues","getTagValues","MetricSegment","metricIndex","loadOptions","getAltSegmentsSelectables","debouncedLoadOptions","debounce","leading","onSegmentChanged","selectableValue","onSegmentChangedDebounced","SegmentAsync","reloadOptionsOnChange","MetricsSection","PlayButton","TagEditor","getTagsOptions","inputValue","debouncedGetTagsOptions","getTagValueOptions","debouncedGetTagValueOptions","TagsSection","getTagsAsSegmentsOptions","getTagsAsSegmentsSelectables","debouncedGetTagsAsSegments","SeriesSection","sectionContent","GraphiteQueryEditorContent","visualEditor","toggleButton","toInteger","toBooleanOrTimestamp","getRollupNotice","metaList","meta","archiveIndex","parseSchemaRetentions","interval","severity","inspect","getRuntimeConsolidationNotice","runtimeNr","spec","vals","retention","chunkspan","numchunks","ready","MetricTankMetaInspector","PureComponent","renderMeta","buckets","rollupNotice","runtimeNotice","normFunc","totalSeconds","acc","bucket","rangeUtil","metaItem","metaItemHeader","metaItemBody","step","stepHeading","stepDescription","lengthPercent","isActive","bucketInterval","bucketRetention","bucketRetentionActive","flexGrow","data","seriesMetas","series","custom","seriesMetaList","JSON","stringify","Object","keys","stylesFactory","config","borderColor","isDark","palette","gray25","gray85","dark1","white","headerBg","gray15","md","xs","sm","textWeak","lg","border","radius","blue85","blue95","greenBase","greenShade","GraphiteType","GRAPHITE_VERSIONS","DEFAULT_GRAPHITE_VERSION","MappingsHelp","Alert","title","onDismiss","MappingsConfiguration","mappings","setMappings","showHelp","onRestoreHelp","mapping","InlineFieldRow","InlineField","Input","changeEvent","newMappings","_","fromString","matchers","metricNode","startsWith","endsWith","labelName","matcher","Select","Switch","LegacyForms","SHOW_MAPPINGS_HELP_KEY","graphiteVersions","version","graphiteTypes","entries","ConfigEditor","super","showMappingsHelp","store","componentDidMount","updateDatasourcePluginJsonDataOption","currentGraphiteVersion","onOptionsChange","currentVersion","find","item","access","DataSourceHttpSettings","defaultUrl","dataSourceConfig","InlineFormLabel","onUpdateDatasourceJsonDataOptionSelect","renderTypeHelp","jsonData","graphiteType","Metrictank","labelClass","checked","rollupIndicatorEnabled","onUpdateDatasourceJsonDataOptionChecked","importConfiguration","loki","graphiteVersion","versionPattern","SemVersion","major","minor","patch","Number","isGtOrEq","compared","comparable","isValid","isNumber","isVersionGtOrEq","a","b","addFuncDef","defaultParams","shortName","optionalSeriesRefArgs","isVersionRelatedFunction","obj","FuncInstance","metricExp","replaceVariables","parameters","paramType","includes","valueInterpolated","isString","pop","_hasMultipleParamsInString","strValue","partVal","idx","trim","getFuncDef","getFuncDefs","funcs","assign","parseFuncDefs","rawDefs","funcName","group","required","shift","rawParam","Infinity","suggestions","GRAPHITE_TAG_COMPARATORS","AbstractLabelOperator","GraphiteDatasource","DataSourceApi","instanceSettings","isArray","y","datapoints","frame","toDataFrame","requestMetaList","notices","stats","getRequestStats","basicAuth","url","metricMappings","isMetricTank","cacheTimeout","withCredentials","funcDefsPromise","_seriesRefLetters","getQueryOptionsInfo","maxDataPoints","links","getImportQueryConfiguration","exportToAbstractQuery","graphiteQuery","GraphiteQueryModel","labels","targetNodes","every","converted","labelMatchers","graphOptions","translateTime","timezone","until","to","format","buildGraphiteParams","of","httpOptions","method","headers","addTracingHeaders","panelId","doGraphiteRequest","pipe","convertResponseToDataFrames","dashboardId","unit","parseTags","tagString","interpolateVariablesInQueries","expandedQueries","getRef","annotationQuery","annotation","lastValueFrom","time","fields","events","then","results","when","what","Promise","reject","targetContainsTemplate","containsTemplate","date","roundUp","substring","dateMath","add","subtract","unix","optionalOptions","interpolatedQuery","getSearchFilterScopedVar","wildcardChar","allParams","expressions","useExpand","requestMetricExpand","requestMetricFind","_map","metric","expr","mapToTags","getVersion","catchError","gfunc","resolve","responseType","fixedData","parse","testDatasource","rangeRaw","status","Authorization","getBackendSrv","fetch","throwError","newMessage","reduceError","graphiteOptions","cleanOptions","targetValue","regex","intervalFormatFixRegex","hasTargets","fixIntervalFormat","nestedSeriesRegexReplacer","hide","encodeURIComponent","AnnotationsQueryCtrl","plugin","DataSourcePlugin","setQueryEditor","setConfigEditor","setMetadataInspector","setAnnotationQueryCtrl","ref","useRef","current"],"sourceRoot":""}
|