@perses-dev/plugin-system 0.53.1 → 0.54.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/cjs/components/CalculationSelector/CalculationSelector.js +3 -3
  2. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +2 -3
  3. package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +4 -5
  4. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +2 -2
  5. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +2 -3
  6. package/dist/cjs/context/ValidationProvider.js +5 -4
  7. package/dist/cjs/model/calculations.js +178 -0
  8. package/dist/cjs/model/index.js +3 -0
  9. package/dist/cjs/model/legend.js +6 -5
  10. package/dist/cjs/model/log-volume-utils.js +124 -0
  11. package/dist/cjs/model/time-series-queries.js +10 -0
  12. package/dist/cjs/remote/PluginRuntime.js +11 -10
  13. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +6 -6
  14. package/dist/cjs/runtime/TimeRangeProvider/query-params.js +7 -7
  15. package/dist/cjs/runtime/TimeRangeProvider/refresh-interval.js +2 -2
  16. package/dist/cjs/test/utils.js +2 -2
  17. package/dist/cjs/utils/index.js +0 -1
  18. package/dist/components/CalculationSelector/CalculationSelector.d.ts +1 -1
  19. package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -1
  20. package/dist/components/CalculationSelector/CalculationSelector.js +1 -1
  21. package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
  22. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +2 -1
  23. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
  24. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +1 -2
  25. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
  26. package/dist/components/DatasourceSelect/DatasourceSelect.d.ts +1 -1
  27. package/dist/components/DatasourceSelect/DatasourceSelect.js.map +1 -1
  28. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
  29. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  30. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +1 -2
  31. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  32. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +1 -1
  33. package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
  34. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts +1 -1
  35. package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
  36. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +1 -1
  37. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  38. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  39. package/dist/components/PluginEditor/plugin-editor-api.d.ts +1 -1
  40. package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
  41. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  42. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +1 -1
  43. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  44. package/dist/components/TimeRangeControls/TimeRangeControls.js +1 -1
  45. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  46. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +2 -1
  47. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  48. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +1 -2
  49. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  50. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +1 -1
  51. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  52. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +1 -1
  53. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  54. package/dist/components/Variables/variable-model.d.ts +1 -1
  55. package/dist/components/Variables/variable-model.js.map +1 -1
  56. package/dist/context/ValidationProvider.d.ts +2 -1
  57. package/dist/context/ValidationProvider.d.ts.map +1 -1
  58. package/dist/context/ValidationProvider.js +3 -2
  59. package/dist/context/ValidationProvider.js.map +1 -1
  60. package/dist/model/calculations.d.ts +45 -0
  61. package/dist/model/calculations.d.ts.map +1 -0
  62. package/dist/model/calculations.js +165 -0
  63. package/dist/model/calculations.js.map +1 -0
  64. package/dist/model/datasource.d.ts +8 -1
  65. package/dist/model/datasource.d.ts.map +1 -1
  66. package/dist/model/datasource.js +1 -1
  67. package/dist/model/datasource.js.map +1 -1
  68. package/dist/model/explore.d.ts +1 -1
  69. package/dist/model/explore.js.map +1 -1
  70. package/dist/model/index.d.ts +3 -0
  71. package/dist/model/index.d.ts.map +1 -1
  72. package/dist/model/index.js +3 -0
  73. package/dist/model/index.js.map +1 -1
  74. package/dist/model/legend.d.ts +3 -2
  75. package/dist/model/legend.d.ts.map +1 -1
  76. package/dist/model/legend.js +2 -1
  77. package/dist/model/legend.js.map +1 -1
  78. package/dist/model/log-queries.d.ts +2 -1
  79. package/dist/model/log-queries.d.ts.map +1 -1
  80. package/dist/model/log-queries.js.map +1 -1
  81. package/dist/model/log-volume-utils.d.ts +6 -0
  82. package/dist/model/log-volume-utils.d.ts.map +1 -0
  83. package/dist/model/log-volume-utils.js +119 -0
  84. package/dist/model/log-volume-utils.js.map +1 -0
  85. package/dist/model/panels.d.ts +1 -1
  86. package/dist/model/panels.js.map +1 -1
  87. package/dist/model/plugin-base.d.ts +1 -1
  88. package/dist/model/plugin-base.js.map +1 -1
  89. package/dist/model/plugins.d.ts +1 -1
  90. package/dist/model/plugins.js.map +1 -1
  91. package/dist/model/profile-queries.d.ts +1 -1
  92. package/dist/model/profile-queries.js.map +1 -1
  93. package/dist/model/time-series-queries.d.ts +11 -1
  94. package/dist/model/time-series-queries.d.ts.map +1 -1
  95. package/dist/model/time-series-queries.js +4 -1
  96. package/dist/model/time-series-queries.js.map +1 -1
  97. package/dist/model/trace-queries.d.ts +1 -1
  98. package/dist/model/trace-queries.js.map +1 -1
  99. package/dist/model/variables.d.ts +1 -1
  100. package/dist/model/variables.js.map +1 -1
  101. package/dist/remote/PluginRuntime.d.ts.map +1 -1
  102. package/dist/remote/PluginRuntime.js +11 -10
  103. package/dist/remote/PluginRuntime.js.map +1 -1
  104. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +1 -1
  105. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  106. package/dist/runtime/DataQueriesProvider/model.d.ts +1 -1
  107. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  108. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +1 -1
  109. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +1 -1
  110. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  111. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.d.ts +1 -1
  112. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.js.map +1 -1
  113. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -1
  114. package/dist/runtime/TimeRangeProvider/query-params.d.ts +1 -1
  115. package/dist/runtime/TimeRangeProvider/query-params.js +1 -1
  116. package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
  117. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts +1 -1
  118. package/dist/runtime/TimeRangeProvider/refresh-interval.js +1 -1
  119. package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -1
  120. package/dist/runtime/UsageMetricsProvider.d.ts +1 -1
  121. package/dist/runtime/UsageMetricsProvider.d.ts.map +1 -1
  122. package/dist/runtime/UsageMetricsProvider.js +1 -1
  123. package/dist/runtime/UsageMetricsProvider.js.map +1 -1
  124. package/dist/runtime/builtin-variables.d.ts +1 -1
  125. package/dist/runtime/builtin-variables.js.map +1 -1
  126. package/dist/runtime/datasources.d.ts +1 -1
  127. package/dist/runtime/datasources.js.map +1 -1
  128. package/dist/runtime/item-actions.js +1 -1
  129. package/dist/runtime/item-actions.js.map +1 -1
  130. package/dist/runtime/log-queries.d.ts +1 -1
  131. package/dist/runtime/log-queries.js.map +1 -1
  132. package/dist/runtime/plugin-registry.d.ts +1 -1
  133. package/dist/runtime/plugin-registry.js.map +1 -1
  134. package/dist/runtime/profile-queries.d.ts +1 -1
  135. package/dist/runtime/profile-queries.js.map +1 -1
  136. package/dist/runtime/time-series-queries.d.ts +1 -1
  137. package/dist/runtime/time-series-queries.js.map +1 -1
  138. package/dist/runtime/trace-queries.d.ts +1 -1
  139. package/dist/runtime/trace-queries.js.map +1 -1
  140. package/dist/test/mock-data.d.ts +1 -1
  141. package/dist/test/mock-data.js.map +1 -1
  142. package/dist/test/utils.d.ts.map +1 -1
  143. package/dist/test/utils.js +1 -1
  144. package/dist/test/utils.js.map +1 -1
  145. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  146. package/dist/utils/index.d.ts +0 -1
  147. package/dist/utils/index.d.ts.map +1 -1
  148. package/dist/utils/index.js +0 -1
  149. package/dist/utils/index.js.map +1 -1
  150. package/package.json +8 -5
  151. package/dist/cjs/utils/action.js +0 -43
  152. package/dist/utils/action.d.ts +0 -4
  153. package/dist/utils/action.d.ts.map +0 -1
  154. package/dist/utils/action.js +0 -27
  155. package/dist/utils/action.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/model/calculations.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TimeSeriesValueTuple } from './time-series-queries';\n\nexport const DEFAULT_CALCULATION: CalculationType = 'last'; // aligned with cue\n\nexport const CalculationsMap = {\n first: first,\n last: last,\n 'first-number': firstNumber,\n 'last-number': lastNumber,\n mean: mean,\n sum: sum,\n min: min,\n max: max,\n};\n\nexport type CalculationType = keyof typeof CalculationsMap;\n\nexport type CalculationConfig = {\n label: string;\n description: string;\n};\n\nexport const CALCULATIONS_CONFIG: Readonly<Record<CalculationType, CalculationConfig>> = {\n first: {\n label: 'First',\n description: 'First value',\n },\n last: {\n label: 'Last',\n description: 'Last value',\n },\n 'first-number': {\n label: 'First *',\n description: 'First numeric value',\n },\n 'last-number': {\n label: 'Last *',\n description: 'Last numeric value',\n },\n mean: {\n label: 'Avg',\n description: 'Average value excluding nulls',\n },\n sum: {\n label: 'Sum',\n description: 'The sum of all values',\n },\n min: {\n label: 'Min',\n description: 'Minimum value',\n },\n max: {\n label: 'Max',\n description: 'Maximum value',\n },\n} as const;\n\ntype CalculationValue = number | null | undefined;\n\n/**\n * Calculate a multiple values for a set of time series data.\n *\n * @param values - Array of time series data.\n * @param includeCalculations - Array of calculations to include.\n */\nexport function getCalculations<IncludeCalcs extends CalculationType[]>(\n values: TimeSeriesValueTuple[],\n includeCalculations: IncludeCalcs\n): Record<\n // This extract combined with the generics above keeps the key of the returned\n // record to *just* the specified calculations.\n Extract<CalculationType, IncludeCalcs[number]>,\n CalculationValue\n> {\n const calculations = includeCalculations.reduce(\n (initResult, calculation) => {\n initResult[calculation] = undefined;\n return initResult;\n },\n {} as Record<string, CalculationValue>\n );\n\n // We save these values as separate values instead of directly setting them\n // in the calculations because they are needed by multiple calculations.\n let nonNullCount = 0;\n let sum = 0;\n\n // We use this large function capable of performing one or more calculations\n // in a single iteration of the data to minimize the performance impact of\n // generating multiple calculations for large timeseries values. This is\n // less optimized for certain single calculations when done in isolation (e.g.\n // `last`), but will be more performant in the more expensive cases where\n // multiple values are being used (e.g. table legend).\n values.forEach((tuple, i) => {\n const value = tuple[1];\n\n if (i === 0 && 'first' in calculations) {\n calculations.first = value;\n }\n if (i === values.length - 1 && 'last' in calculations) {\n calculations.last = value;\n }\n\n // Handling specific to non-null values.\n if (typeof value === 'number') {\n nonNullCount += 1;\n sum += value;\n\n if ('first-number' in calculations && calculations['first-number'] === undefined) {\n // Save the first number we see.\n calculations['first-number'] = value;\n }\n\n if ('last-number' in calculations) {\n // Keep setting the numbers we see, which will eventually be set to the\n // last number when finished iterating.\n calculations['last-number'] = value;\n }\n\n if ('min' in calculations) {\n if (typeof calculations.min !== 'number') {\n // Init the first time we see a number\n calculations.min = value;\n } else {\n // Use lowest value once initialized\n calculations.min = Math.min(calculations.min, value);\n }\n }\n\n if ('max' in calculations) {\n if (typeof calculations.max !== 'number') {\n // Init the first time we see a number\n calculations.max = value;\n } else {\n // Use highest value once initialized\n calculations.max = Math.max(calculations.max, value);\n }\n }\n }\n });\n\n // Set calculations that require iterating over all values.\n if (nonNullCount > 0 && 'sum' in calculations) {\n calculations.sum = sum;\n }\n\n if (nonNullCount > 0 && 'mean' in calculations) {\n calculations.mean = sum / nonNullCount;\n }\n\n return calculations;\n}\n\n/**\n * Calculate a single value for a set of time series data.\n *\n * Use `getCalculations` instead if you need multiple calculations.\n *\n * @param values - Array of time series data.\n * @param calculation - Name of the calculation to calculate.\n */\nexport function getCalculation(values: TimeSeriesValueTuple[], calculation: CalculationType): CalculationValue {\n return getCalculations(values, [calculation])[calculation];\n}\n\nfunction first(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'first');\n}\n\nfunction last(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'last');\n}\n\nfunction firstNumber(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'first-number');\n}\n\nfunction lastNumber(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'last-number');\n}\n\nfunction mean(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'mean');\n}\n\nfunction sum(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'sum');\n}\n\nfunction min(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'min');\n}\n\nfunction max(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'max');\n}\n"],"names":["DEFAULT_CALCULATION","CalculationsMap","first","last","firstNumber","lastNumber","mean","sum","min","max","CALCULATIONS_CONFIG","label","description","getCalculations","values","includeCalculations","calculations","reduce","initResult","calculation","undefined","nonNullCount","forEach","tuple","i","value","length","Math","getCalculation"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,sBAAuC,OAAO,CAAC,mBAAmB;AAE/E,OAAO,MAAMC,kBAAkB;IAC7BC,OAAOA;IACPC,MAAMA;IACN,gBAAgBC;IAChB,eAAeC;IACfC,MAAMA;IACNC,KAAKA;IACLC,KAAKA;IACLC,KAAKA;AACP,EAAE;AASF,OAAO,MAAMC,sBAA4E;IACvFR,OAAO;QACLS,OAAO;QACPC,aAAa;IACf;IACAT,MAAM;QACJQ,OAAO;QACPC,aAAa;IACf;IACA,gBAAgB;QACdD,OAAO;QACPC,aAAa;IACf;IACA,eAAe;QACbD,OAAO;QACPC,aAAa;IACf;IACAN,MAAM;QACJK,OAAO;QACPC,aAAa;IACf;IACAL,KAAK;QACHI,OAAO;QACPC,aAAa;IACf;IACAJ,KAAK;QACHG,OAAO;QACPC,aAAa;IACf;IACAH,KAAK;QACHE,OAAO;QACPC,aAAa;IACf;AACF,EAAW;AAIX;;;;;CAKC,GACD,OAAO,SAASC,gBACdC,MAA8B,EAC9BC,mBAAiC;IAOjC,MAAMC,eAAeD,oBAAoBE,MAAM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;YACF;QACF;IACF;IAEA,2DAA2D;IAC3D,IAAIJ,eAAe,KAAK,SAASL,cAAc;QAC7CA,aAAaT,GAAG,GAAGA;IACrB;IAEA,IAAIc,eAAe,KAAK,UAAUL,cAAc;QAC9CA,aAAaV,IAAI,GAAGC,MAAMc;IAC5B;IAEA,OAAOL;AACT;AAEA;;;;;;;CAOC,GACD,OAAO,SAASY,eAAed,MAA8B,EAAEK,WAA4B;IACzF,OAAON,gBAAgBC,QAAQ;QAACK;KAAY,CAAC,CAACA,YAAY;AAC5D;AAEA,SAASjB,MAAMY,MAA8B;IAC3C,OAAOc,eAAed,QAAQ;AAChC;AAEA,SAASX,KAAKW,MAA8B;IAC1C,OAAOc,eAAed,QAAQ;AAChC;AAEA,SAASV,YAAYU,MAA8B;IACjD,OAAOc,eAAed,QAAQ;AAChC;AAEA,SAAST,WAAWS,MAA8B;IAChD,OAAOc,eAAed,QAAQ;AAChC;AAEA,SAASR,KAAKQ,MAA8B;IAC1C,OAAOc,eAAed,QAAQ;AAChC;AAEA,SAASP,IAAIO,MAA8B;IACzC,OAAOc,eAAed,QAAQ;AAChC;AAEA,SAASN,IAAIM,MAA8B;IACzC,OAAOc,eAAed,QAAQ;AAChC;AAEA,SAASL,IAAIK,MAA8B;IACzC,OAAOc,eAAed,QAAQ;AAChC"}
@@ -1,4 +1,4 @@
1
- import { BuiltinVariableDefinition, UnknownSpec } from '@perses-dev/core';
1
+ import { BuiltinVariableDefinition, DatasourceSpec, UnknownSpec } from '@perses-dev/spec';
2
2
  import { Plugin } from './plugin-base';
3
3
  /**
4
4
  * Plugin that defines options for an external system that Perses talks to for data.
@@ -17,4 +17,11 @@ export interface DatasourceClient {
17
17
  kind?: string;
18
18
  healthCheck?: () => Promise<boolean>;
19
19
  }
20
+ /**
21
+ * An intermediary type to regroup the name and the spec of a datasource.
22
+ */
23
+ export interface DatasourceDefinition {
24
+ name: string;
25
+ spec: DatasourceSpec;
26
+ }
20
27
  //# sourceMappingURL=datasource.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../src/model/datasource.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,GAAG,WAAW,EAAE,MAAM,GAAG,OAAO,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IAC1F,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,uBAAuB,KAAK,MAAM,CAAC;IAEvE,6BAA6B,CAAC,EAAE,MAAM,yBAAyB,EAAE,CAAC;CACnE;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAE/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACtC"}
1
+ {"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../src/model/datasource.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,GAAG,WAAW,EAAE,MAAM,GAAG,OAAO,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IAC1F,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,uBAAuB,KAAK,MAAM,CAAC;IAEvE,6BAA6B,CAAC,EAAE,MAAM,yBAAyB,EAAE,CAAC;CACnE;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAE/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,cAAc,CAAC;CACtB"}
@@ -11,7 +11,7 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  /**
14
- * Common properties for all clients
14
+ * An intermediary type to regroup the name and the spec of a datasource.
15
15
  */ export { };
16
16
 
17
17
  //# sourceMappingURL=datasource.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/datasource.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { BuiltinVariableDefinition, UnknownSpec } from '@perses-dev/core';\nimport { Plugin } from './plugin-base';\n\n/**\n * Plugin that defines options for an external system that Perses talks to for data.\n */\nexport interface DatasourcePlugin<Spec = UnknownSpec, Client = unknown> extends Plugin<Spec> {\n createClient: (spec: Spec, options: DatasourceClientOptions) => Client;\n // Provide builtin variable definitions available on the datasource. Optional\n getBuiltinVariableDefinitions?: () => BuiltinVariableDefinition[];\n}\n\nexport interface DatasourceClientOptions {\n proxyUrl?: string;\n}\n\n/**\n * Common properties for all clients\n */\nexport interface DatasourceClient {\n // TODO: set kind and define healthCheck function\n kind?: string;\n healthCheck?: () => Promise<boolean>;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAkBjC;;CAEC,GACD,WAIC"}
1
+ {"version":3,"sources":["../../src/model/datasource.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { BuiltinVariableDefinition, DatasourceSpec, UnknownSpec } from '@perses-dev/spec';\nimport { Plugin } from './plugin-base';\n\n/**\n * Plugin that defines options for an external system that Perses talks to for data.\n */\nexport interface DatasourcePlugin<Spec = UnknownSpec, Client = unknown> extends Plugin<Spec> {\n createClient: (spec: Spec, options: DatasourceClientOptions) => Client;\n // Provide builtin variable definitions available on the datasource. Optional\n getBuiltinVariableDefinitions?: () => BuiltinVariableDefinition[];\n}\n\nexport interface DatasourceClientOptions {\n proxyUrl?: string;\n}\n\n/**\n * Common properties for all clients\n */\nexport interface DatasourceClient {\n // TODO: set kind and define healthCheck function\n kind?: string;\n healthCheck?: () => Promise<boolean>;\n}\n\n/**\n * An intermediary type to regroup the name and the spec of a datasource.\n */\nexport interface DatasourceDefinition {\n name: string;\n spec: DatasourceSpec;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AA2BjC;;CAEC,GACD,WAGC"}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { UnknownSpec } from '@perses-dev/core';
2
+ import { UnknownSpec } from '@perses-dev/spec';
3
3
  import { Plugin } from './plugin-base';
4
4
  export interface ExploreComponentProps<Spec> {
5
5
  spec: Spec;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/explore.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnknownSpec } from '@perses-dev/core';\nimport { Plugin } from './plugin-base';\n\nexport interface ExploreComponentProps<Spec> {\n spec: Spec;\n}\n\n/**\n * Plugin that defines options for an external system that Perses talks to for data.\n */\nexport interface ExplorePlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n ExploreComponent: React.ComponentType<ExploreComponentProps<Spec>>;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AASjC;;CAEC,GACD,WAEC"}
1
+ {"version":3,"sources":["../../src/model/explore.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnknownSpec } from '@perses-dev/spec';\nimport { Plugin } from './plugin-base';\n\nexport interface ExploreComponentProps<Spec> {\n spec: Spec;\n}\n\n/**\n * Plugin that defines options for an external system that Perses talks to for data.\n */\nexport interface ExplorePlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n ExploreComponent: React.ComponentType<ExploreComponentProps<Spec>>;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AASjC;;CAEC,GACD,WAEC"}
@@ -1,5 +1,7 @@
1
1
  export * from './datasource';
2
2
  export * from './legend';
3
+ export * from './log-queries';
4
+ export * from './log-volume-utils';
3
5
  export * from './panels';
4
6
  export * from './plugins';
5
7
  export * from './plugin-base';
@@ -8,4 +10,5 @@ export * from './time-series-queries';
8
10
  export * from './trace-queries';
9
11
  export * from './profile-queries';
10
12
  export * from './variables';
13
+ export * from './calculations';
11
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC"}
@@ -12,6 +12,8 @@
12
12
  // limitations under the License.
13
13
  export * from './datasource';
14
14
  export * from './legend';
15
+ export * from './log-queries';
16
+ export * from './log-volume-utils';
15
17
  export * from './panels';
16
18
  export * from './plugins';
17
19
  export * from './plugin-base';
@@ -20,5 +22,6 @@ export * from './time-series-queries';
20
22
  export * from './trace-queries';
21
23
  export * from './profile-queries';
22
24
  export * from './variables';
25
+ export * from './calculations';
23
26
 
24
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './datasource';\nexport * from './legend';\nexport * from './panels';\nexport * from './plugins';\nexport * from './plugin-base';\nexport * from './plugin-loading';\nexport * from './time-series-queries';\nexport * from './trace-queries';\nexport * from './profile-queries';\nexport * from './variables';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe;AAC7B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,gBAAgB;AAC9B,cAAc,mBAAmB;AACjC,cAAc,wBAAwB;AACtC,cAAc,kBAAkB;AAChC,cAAc,oBAAoB;AAClC,cAAc,cAAc"}
1
+ {"version":3,"sources":["../../src/model/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './datasource';\nexport * from './legend';\nexport * from './log-queries';\nexport * from './log-volume-utils';\nexport * from './panels';\nexport * from './plugins';\nexport * from './plugin-base';\nexport * from './plugin-loading';\nexport * from './time-series-queries';\nexport * from './trace-queries';\nexport * from './profile-queries';\nexport * from './variables';\nexport * from './calculations';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe;AAC7B,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B,cAAc,qBAAqB;AACnC,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,gBAAgB;AAC9B,cAAc,mBAAmB;AACjC,cAAc,wBAAwB;AACtC,cAAc,kBAAkB;AAChC,cAAc,oBAAoB;AAClC,cAAc,cAAc;AAC5B,cAAc,iBAAiB"}
@@ -1,4 +1,5 @@
1
- import { CalculationType, LegendMode, LegendOptionsBase, LegendPositions, LegendSize } from '@perses-dev/core';
1
+ import { LegendMode, LegendOptionsBase, LegendPositions, LegendSize } from '@perses-dev/components';
2
+ import { CalculationType } from './calculations';
2
3
  export declare const legendValues: CalculationType[];
3
4
  export type LegendValue = (typeof legendValues)[number];
4
5
  export type ComparisonValues = 'abs' | 'relative';
@@ -13,6 +14,6 @@ export type LegendSingleSelectConfig = {
13
14
  export declare const LEGEND_POSITIONS_CONFIG: Readonly<Record<LegendPositions, LegendSingleSelectConfig>>;
14
15
  export declare const LEGEND_MODE_CONFIG: Readonly<Record<LegendMode, LegendSingleSelectConfig>>;
15
16
  export declare const LEGEND_SIZE_CONFIG: Readonly<Record<LegendSize, LegendSingleSelectConfig>>;
16
- export declare const LEGEND_VALUE_CONFIG: Partial<Record<"first" | "last" | "first-number" | "last-number" | "mean" | "sum" | "min" | "max", LegendSingleSelectConfig>>;
17
+ export declare const LEGEND_VALUE_CONFIG: Partial<Record<"max" | "min" | "first" | "last" | "first-number" | "last-number" | "mean" | "sum", LegendSingleSelectConfig>>;
17
18
  export declare function validateLegendSpec(legend?: LegendOptionsBase): boolean;
18
19
  //# sourceMappingURL=legend.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../src/model/legend.ts"],"names":[],"mappings":"AAaA,OAAO,EAEL,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,eAAe,EAGf,UAAU,EAEX,MAAM,kBAAkB,CAAC;AAU1B,eAAO,MAAM,YAAY,EAAE,eAAe,EASzC,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,UAAU,CAAC;AAElD,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,gBAAgB,EAAE,wBAAwB,CAGhF,CAAC;AAKF,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,MAAM,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,gBAAgB,CAAC,CAAC;CAChD;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM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,wBAAwB,CAAC,CAG/F,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAGrF,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAGrF,CAAC;AAEF,eAAO,MAAM,mBAAmB,+HAO/B,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAgBtE"}
@@ -10,7 +10,8 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { CALCULATIONS_CONFIG, isValidLegendMode, isValidLegendPosition, isValidLegendSize } from '@perses-dev/core';
13
+ import { isValidLegendMode, isValidLegendPosition, isValidLegendSize } from '@perses-dev/components';
14
+ import { CALCULATIONS_CONFIG } from './calculations';
14
15
  // This file contains legend-related model code specific to panel plugin specs.
15
16
  // See the `core` package for common/shared legend model code and the
16
17
  // `components` package for legend model code specific to the Legend component.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/legend.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n CALCULATIONS_CONFIG,\n CalculationType,\n LegendMode,\n LegendOptionsBase,\n LegendPositions,\n isValidLegendMode,\n isValidLegendPosition,\n LegendSize,\n isValidLegendSize,\n} from '@perses-dev/core';\n\n// This file contains legend-related model code specific to panel plugin specs.\n// See the `core` package for common/shared legend model code and the\n// `components` package for legend model code specific to the Legend component.\n\n// Explicity listing the calculations we intend to use for legend values because\n// we want them ordered in a specific way, and it may be possible in the future\n// that we only use a subset of calculations for the legend because the calculations\n// are also used by other features.\nexport const legendValues: CalculationType[] = [\n 'mean',\n 'first',\n 'first-number',\n 'last',\n 'last-number',\n 'min',\n 'max',\n 'sum',\n];\nexport type LegendValue = (typeof legendValues)[number];\n\nexport type ComparisonValues = 'abs' | 'relative';\n\nexport const comparisonLegends: Record<ComparisonValues, LegendSingleSelectConfig> = {\n abs: { label: 'Absolute', description: 'Absolute value' },\n relative: { label: 'Relative', description: 'Relative value' },\n};\n\n// Note: explicitly defining different options for the legend spec and\n// legend component that extend from some common options, so we can allow the\n// component and the spec to diverge in some upcoming work.\nexport interface LegendSpecOptions extends LegendOptionsBase {\n values?: Array<LegendValue | ComparisonValues>;\n}\n\nexport type LegendSingleSelectConfig = {\n label: string;\n description?: string;\n};\n\nexport const LEGEND_POSITIONS_CONFIG: Readonly<Record<LegendPositions, LegendSingleSelectConfig>> = {\n bottom: { label: 'Bottom' },\n right: { label: 'Right' },\n};\n\nexport const LEGEND_MODE_CONFIG: Readonly<Record<LegendMode, LegendSingleSelectConfig>> = {\n list: { label: 'List' },\n table: { label: 'Table' },\n};\n\nexport const LEGEND_SIZE_CONFIG: Readonly<Record<LegendSize, LegendSingleSelectConfig>> = {\n small: { label: 'Small' },\n medium: { label: 'Medium' },\n};\n\nexport const LEGEND_VALUE_CONFIG = legendValues.reduce(\n (config, value) => {\n config[value] = CALCULATIONS_CONFIG[value];\n\n return config;\n },\n {} as Partial<Record<LegendValue, LegendSingleSelectConfig>>\n);\n\nexport function validateLegendSpec(legend?: LegendOptionsBase): boolean {\n if (legend === undefined) {\n // undefined is valid since this is how legend is hidden by default\n return true;\n }\n if (!isValidLegendPosition(legend.position)) {\n return false;\n }\n if (legend.mode && !isValidLegendMode(legend.mode)) {\n return false;\n }\n if (legend.size && !isValidLegendSize(legend.size)) {\n return false;\n }\n\n return true;\n}\n"],"names":["CALCULATIONS_CONFIG","isValidLegendMode","isValidLegendPosition","isValidLegendSize","legendValues","comparisonLegends","abs","label","description","relative","LEGEND_POSITIONS_CONFIG","bottom","right","LEGEND_MODE_CONFIG","list","table","LEGEND_SIZE_CONFIG","small","medium","LEGEND_VALUE_CONFIG","reduce","config","value","validateLegendSpec","legend","undefined","position","mode","size"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SACEA,mBAAmB,EAKnBC,iBAAiB,EACjBC,qBAAqB,EAErBC,iBAAiB,QACZ,mBAAmB;AAE1B,+EAA+E;AAC/E,qEAAqE;AACrE,+EAA+E;AAE/E,gFAAgF;AAChF,+EAA+E;AAC/E,oFAAoF;AACpF,mCAAmC;AACnC,OAAO,MAAMC,eAAkC;IAC7C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAC;AAKF,OAAO,MAAMC,oBAAwE;IACnFC,KAAK;QAAEC,OAAO;QAAYC,aAAa;IAAiB;IACxDC,UAAU;QAAEF,OAAO;QAAYC,aAAa;IAAiB;AAC/D,EAAE;AAcF,OAAO,MAAME,0BAAuF;IAClGC,QAAQ;QAAEJ,OAAO;IAAS;IAC1BK,OAAO;QAAEL,OAAO;IAAQ;AAC1B,EAAE;AAEF,OAAO,MAAMM,qBAA6E;IACxFC,MAAM;QAAEP,OAAO;IAAO;IACtBQ,OAAO;QAAER,OAAO;IAAQ;AAC1B,EAAE;AAEF,OAAO,MAAMS,qBAA6E;IACxFC,OAAO;QAAEV,OAAO;IAAQ;IACxBW,QAAQ;QAAEX,OAAO;IAAS;AAC5B,EAAE;AAEF,OAAO,MAAMY,sBAAsBf,aAAagB,MAAM,CACpD,CAACC,QAAQC;IACPD,MAAM,CAACC,MAAM,GAAGtB,mBAAmB,CAACsB,MAAM;IAE1C,OAAOD;AACT,GACA,CAAC,GACD;AAEF,OAAO,SAASE,mBAAmBC,MAA0B;IAC3D,IAAIA,WAAWC,WAAW;QACxB,mEAAmE;QACnE,OAAO;IACT;IACA,IAAI,CAACvB,sBAAsBsB,OAAOE,QAAQ,GAAG;QAC3C,OAAO;IACT;IACA,IAAIF,OAAOG,IAAI,IAAI,CAAC1B,kBAAkBuB,OAAOG,IAAI,GAAG;QAClD,OAAO;IACT;IACA,IAAIH,OAAOI,IAAI,IAAI,CAACzB,kBAAkBqB,OAAOI,IAAI,GAAG;QAClD,OAAO;IACT;IAEA,OAAO;AACT"}
1
+ {"version":3,"sources":["../../src/model/legend.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n isValidLegendMode,\n isValidLegendPosition,\n isValidLegendSize,\n LegendMode,\n LegendOptionsBase,\n LegendPositions,\n LegendSize,\n} from '@perses-dev/components';\nimport { CALCULATIONS_CONFIG, CalculationType } from './calculations';\n\n// This file contains legend-related model code specific to panel plugin specs.\n// See the `core` package for common/shared legend model code and the\n// `components` package for legend model code specific to the Legend component.\n\n// Explicity listing the calculations we intend to use for legend values because\n// we want them ordered in a specific way, and it may be possible in the future\n// that we only use a subset of calculations for the legend because the calculations\n// are also used by other features.\nexport const legendValues: CalculationType[] = [\n 'mean',\n 'first',\n 'first-number',\n 'last',\n 'last-number',\n 'min',\n 'max',\n 'sum',\n];\nexport type LegendValue = (typeof legendValues)[number];\n\nexport type ComparisonValues = 'abs' | 'relative';\n\nexport const comparisonLegends: Record<ComparisonValues, LegendSingleSelectConfig> = {\n abs: { label: 'Absolute', description: 'Absolute value' },\n relative: { label: 'Relative', description: 'Relative value' },\n};\n\n// Note: explicitly defining different options for the legend spec and\n// legend component that extend from some common options, so we can allow the\n// component and the spec to diverge in some upcoming work.\nexport interface LegendSpecOptions extends LegendOptionsBase {\n values?: Array<LegendValue | ComparisonValues>;\n}\n\nexport type LegendSingleSelectConfig = {\n label: string;\n description?: string;\n};\n\nexport const LEGEND_POSITIONS_CONFIG: Readonly<Record<LegendPositions, LegendSingleSelectConfig>> = {\n bottom: { label: 'Bottom' },\n right: { label: 'Right' },\n};\n\nexport const LEGEND_MODE_CONFIG: Readonly<Record<LegendMode, LegendSingleSelectConfig>> = {\n list: { label: 'List' },\n table: { label: 'Table' },\n};\n\nexport const LEGEND_SIZE_CONFIG: Readonly<Record<LegendSize, LegendSingleSelectConfig>> = {\n small: { label: 'Small' },\n medium: { label: 'Medium' },\n};\n\nexport const LEGEND_VALUE_CONFIG = legendValues.reduce(\n (config, value) => {\n config[value] = CALCULATIONS_CONFIG[value];\n\n return config;\n },\n {} as Partial<Record<LegendValue, LegendSingleSelectConfig>>\n);\n\nexport function validateLegendSpec(legend?: LegendOptionsBase): boolean {\n if (legend === undefined) {\n // undefined is valid since this is how legend is hidden by default\n return true;\n }\n if (!isValidLegendPosition(legend.position)) {\n return false;\n }\n if (legend.mode && !isValidLegendMode(legend.mode)) {\n return false;\n }\n if (legend.size && !isValidLegendSize(legend.size)) {\n return false;\n }\n\n return true;\n}\n"],"names":["isValidLegendMode","isValidLegendPosition","isValidLegendSize","CALCULATIONS_CONFIG","legendValues","comparisonLegends","abs","label","description","relative","LEGEND_POSITIONS_CONFIG","bottom","right","LEGEND_MODE_CONFIG","list","table","LEGEND_SIZE_CONFIG","small","medium","LEGEND_VALUE_CONFIG","reduce","config","value","validateLegendSpec","legend","undefined","position","mode","size"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAA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AClD,OAAO;IACT;IACA,IAAIH,OAAOI,IAAI,IAAI,CAAC1B,kBAAkBsB,OAAOI,IAAI,GAAG;QAClD,OAAO;IACT;IAEA,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- import { AbsoluteTimeRange, UnknownSpec, LogData } from '@perses-dev/core';
1
+ import { AbsoluteTimeRange, UnknownSpec, LogData, QueryDefinition } from '@perses-dev/spec';
2
2
  import { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';
3
3
  export interface LogQueryResult {
4
4
  logs: LogData;
@@ -19,6 +19,7 @@ type LogQueryPluginDependencies = {
19
19
  export interface LogQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {
20
20
  getLogData: (spec: Spec, ctx: LogQueryContext, abortSignal?: AbortSignal) => Promise<LogQueryResult>;
21
21
  dependsOn?: (spec: Spec, ctx: LogQueryContext) => LogQueryPluginDependencies;
22
+ createVolumeQuery?: (spec: Spec, ctx: LogQueryContext) => QueryDefinition | null;
22
23
  }
23
24
  export {};
24
25
  //# sourceMappingURL=log-queries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"log-queries.d.ts","sourceRoot":"","sources":["../../src/model/log-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAEtF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,CAAC,EAAE;QACT,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,aAAa,EAAE,gBAAgB,CAAC;IAChC,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB;A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O,CAAC,cAAc,CAAC,CAAC;IACrG,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,KAAK,0BAA0B,CAAC;IAC7E,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,KAAK,eAAe,GAAG,IAAI,CAAC;CAClF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/log-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { AbsoluteTimeRange, UnknownSpec, LogData } from '@perses-dev/core';\nimport { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';\n\nexport interface LogQueryResult {\n logs: LogData;\n timeRange: AbsoluteTimeRange;\n metadata?: {\n executedQueryString: string;\n };\n}\n\nexport interface LogQueryContext {\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n refreshKey: string;\n}\n\ntype LogQueryPluginDependencies = {\n variables?: string[];\n};\n\nexport interface LogQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getLogData: (spec: Spec, ctx: LogQueryContext, abortSignal?: AbortSignal) => Promise<LogQueryResult>;\n dependsOn?: (spec: Spec, ctx: LogQueryContext) => LogQueryPluginDependencies;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAwBjC,WAGC"}
1
+ {"version":3,"sources":["../../src/model/log-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { AbsoluteTimeRange, UnknownSpec, LogData, QueryDefinition } from '@perses-dev/spec';\nimport { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';\n\nexport interface LogQueryResult {\n logs: LogData;\n timeRange: AbsoluteTimeRange;\n metadata?: {\n executedQueryString: string;\n };\n}\n\nexport interface LogQueryContext {\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n refreshKey: string;\n}\n\ntype LogQueryPluginDependencies = {\n variables?: string[];\n};\n\nexport interface LogQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getLogData: (spec: Spec, ctx: LogQueryContext, abortSignal?: AbortSignal) => Promise<LogQueryResult>;\n dependsOn?: (spec: Spec, ctx: LogQueryContext) => LogQueryPluginDependencies;\n createVolumeQuery?: (spec: Spec, ctx: LogQueryContext) => QueryDefinition | null;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAwBjC,WAIC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Calculates an appropriate interval for log volume histograms based on time range.
3
+ * Uses standard round intervals for better alignment with time-series data.
4
+ */
5
+ export declare function calculateVolumeInterval(timeRangeMs: number): string;
6
+ //# sourceMappingURL=log-volume-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-volume-utils.d.ts","sourceRoot":"","sources":["../../src/model/log-volume-utils.ts"],"names":[],"mappings":"AAuCA;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAsBnE"}
@@ -0,0 +1,119 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ // Target number of bars for log volume histogram
14
+ const TARGET_HISTOGRAM_BARS = 40;
15
+ // Standard intervals for histogram calculations (in milliseconds)
16
+ const STANDARD_INTERVALS = [
17
+ {
18
+ ms: 1000,
19
+ label: '1s'
20
+ },
21
+ {
22
+ ms: 2000,
23
+ label: '2s'
24
+ },
25
+ {
26
+ ms: 5000,
27
+ label: '5s'
28
+ },
29
+ {
30
+ ms: 10000,
31
+ label: '10s'
32
+ },
33
+ {
34
+ ms: 15000,
35
+ label: '15s'
36
+ },
37
+ {
38
+ ms: 30000,
39
+ label: '30s'
40
+ },
41
+ {
42
+ ms: 60000,
43
+ label: '1m'
44
+ },
45
+ {
46
+ ms: 120000,
47
+ label: '2m'
48
+ },
49
+ {
50
+ ms: 300000,
51
+ label: '5m'
52
+ },
53
+ {
54
+ ms: 600000,
55
+ label: '10m'
56
+ },
57
+ {
58
+ ms: 900000,
59
+ label: '15m'
60
+ },
61
+ {
62
+ ms: 1800000,
63
+ label: '30m'
64
+ },
65
+ {
66
+ ms: 3600000,
67
+ label: '1h'
68
+ },
69
+ {
70
+ ms: 7200000,
71
+ label: '2h'
72
+ },
73
+ {
74
+ ms: 21600000,
75
+ label: '6h'
76
+ },
77
+ {
78
+ ms: 43200000,
79
+ label: '12h'
80
+ },
81
+ {
82
+ ms: 86400000,
83
+ label: '1d'
84
+ },
85
+ {
86
+ ms: 604800000,
87
+ label: '7d'
88
+ },
89
+ {
90
+ ms: 2592000000,
91
+ label: '30d'
92
+ }
93
+ ];
94
+ /**
95
+ * Calculates an appropriate interval for log volume histograms based on time range.
96
+ * Uses standard round intervals for better alignment with time-series data.
97
+ */ export function calculateVolumeInterval(timeRangeMs) {
98
+ // Prefer smallest interval that produces 20-100 bars (optimal range)
99
+ for (const interval of STANDARD_INTERVALS){
100
+ const barCount = timeRangeMs / interval.ms;
101
+ if (barCount >= 20 && barCount <= 100) {
102
+ return interval.label;
103
+ }
104
+ }
105
+ // Fallback: find closest to target if no interval fits optimal range
106
+ let bestInterval = STANDARD_INTERVALS[STANDARD_INTERVALS.length - 1];
107
+ let bestDistance = Infinity;
108
+ for (const interval of STANDARD_INTERVALS){
109
+ const barCount = timeRangeMs / interval.ms;
110
+ const distance = Math.abs(barCount - TARGET_HISTOGRAM_BARS);
111
+ if (distance < bestDistance) {
112
+ bestDistance = distance;
113
+ bestInterval = interval;
114
+ }
115
+ }
116
+ return bestInterval.label;
117
+ }
118
+
119
+ //# sourceMappingURL=log-volume-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/model/log-volume-utils.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Target number of bars for log volume histogram\nconst TARGET_HISTOGRAM_BARS = 40;\n\n// Standard intervals for histogram calculations (in milliseconds)\nconst STANDARD_INTERVALS = [\n { ms: 1000, label: '1s' },\n { ms: 2000, label: '2s' },\n { ms: 5000, label: '5s' },\n { ms: 10000, label: '10s' },\n { ms: 15000, label: '15s' },\n { ms: 30000, label: '30s' },\n { ms: 60000, label: '1m' },\n { ms: 120000, label: '2m' },\n { ms: 300000, label: '5m' },\n { ms: 600000, label: '10m' },\n { ms: 900000, label: '15m' },\n { ms: 1800000, label: '30m' },\n { ms: 3600000, label: '1h' },\n { ms: 7200000, label: '2h' },\n { ms: 21600000, label: '6h' },\n { ms: 43200000, label: '12h' },\n { ms: 86400000, label: '1d' },\n { ms: 604800000, label: '7d' },\n { ms: 2592000000, label: '30d' },\n] as const;\n\n/**\n * Calculates an appropriate interval for log volume histograms based on time range.\n * Uses standard round intervals for better alignment with time-series data.\n */\nexport function calculateVolumeInterval(timeRangeMs: number): string {\n // Prefer smallest interval that produces 20-100 bars (optimal range)\n for (const interval of STANDARD_INTERVALS) {\n const barCount = timeRangeMs / interval.ms;\n if (barCount >= 20 && barCount <= 100) {\n return interval.label;\n }\n }\n\n // Fallback: find closest to target if no interval fits optimal range\n let bestInterval = STANDARD_INTERVALS[STANDARD_INTERVALS.length - 1]!;\n let bestDistance = Infinity;\n for (const interval of STANDARD_INTERVALS) {\n const barCount = timeRangeMs / interval.ms;\n const distance = Math.abs(barCount - TARGET_HISTOGRAM_BARS);\n if (distance < bestDistance) {\n bestDistance = distance;\n bestInterval = interval;\n }\n }\n\n return bestInterval.label;\n}\n"],"names":["TARGET_HISTOGRAM_BARS","STANDARD_INTERVALS","ms","label","calculateVolumeInterval","timeRangeMs","interval","barCount","bestInterval","length","bestDistance","Infinity","distance","Math","abs"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AAC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AAG,CAACP,WAAWP;QACrC,IAAIY,WAAWF,cAAc;YAC3BA,eAAeE;YACfJ,eAAeF;QACjB;IACF;IAEA,OAAOE,aAAaL,KAAK;AAC3B"}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { UnknownSpec, PanelDefinition, QueryPluginType, QueryDataType, QueryDefinition } from '@perses-dev/core';
2
+ import { UnknownSpec, PanelDefinition, QueryPluginType, QueryDataType, QueryDefinition } from '@perses-dev/spec';
3
3
  import { OptionsEditorTab } from '../components';
4
4
  import { QueryOptions } from '../runtime';
5
5
  import { OptionsEditorProps, Plugin } from './plugin-base';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/panels.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React from 'react';\nimport { UnknownSpec, PanelDefinition, QueryPluginType, QueryDataType, QueryDefinition } from '@perses-dev/core';\nimport { OptionsEditorTab } from '../components';\nimport { QueryOptions } from '../runtime';\nimport { OptionsEditorProps, Plugin } from './plugin-base';\n\nexport type PanelOptionsEditorComponent<T> = Pick<OptionsEditorTab, 'label'> & {\n content: React.ComponentType<OptionsEditorProps<T>>;\n};\n\nexport type PanelAction<TPanelProps> = {\n component: React.ComponentType<TPanelProps>;\n location?: string; // 'header' or other available locations\n};\n\n/**\n * Plugin the provides custom visualizations inside a Panel.\n */\nexport interface PanelPlugin<Spec = UnknownSpec, TPanelProps = PanelProps<Spec>> extends Plugin<Spec> {\n PanelComponent: React.ComponentType<TPanelProps>;\n /**\n * React components for custom tabs\n */\n panelOptionsEditorComponents?: Array<PanelOptionsEditorComponent<Spec>>;\n /**\n * Show a custom React component when the query is loading.\n * Default: <LoadingOverlay />\n */\n LoadingComponent?: React.ComponentType<TPanelProps>;\n /**\n * List of query types supported by this panel.\n * @default [] (no query types supported) only relevant if hideQueryEditor is true\n */\n supportedQueryTypes?: QueryPluginType[];\n /**\n * Static options for the queries that will be executed.\n * Each {@link QueryPluginType} implementation can have its own options.\n * For example see {@link UseTimeSeriesQueryOptions} for time series queries.\n */\n queryOptions?: QueryOptions | ((spec: Spec) => QueryOptions);\n /**\n * If true, query editor will be hidden for panel plugin\n * @default false\n */\n hideQueryEditor?: boolean;\n /**\n * List of panel actions that will be rendered in the panel header\n */\n actions?: Array<PanelAction<TPanelProps>>;\n}\n\n/**\n * The props provided by Perses to a panel plugin's PanelComponent.\n */\nexport interface PanelProps<Spec, SupportedQueryTypes = QueryDataType> {\n spec: Spec;\n contentDimensions?: {\n width: number;\n height: number;\n };\n definition?: PanelDefinition;\n queryResults: Array<PanelData<SupportedQueryTypes>>;\n}\n\nexport interface PanelData<SupportedQueryTypes = QueryDataType> {\n definition: QueryDefinition;\n data: SupportedQueryTypes;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAkEjC,WAGC"}
1
+ {"version":3,"sources":["../../src/model/panels.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React from 'react';\nimport { UnknownSpec, PanelDefinition, QueryPluginType, QueryDataType, QueryDefinition } from '@perses-dev/spec';\nimport { OptionsEditorTab } from '../components';\nimport { QueryOptions } from '../runtime';\nimport { OptionsEditorProps, Plugin } from './plugin-base';\n\nexport type PanelOptionsEditorComponent<T> = Pick<OptionsEditorTab, 'label'> & {\n content: React.ComponentType<OptionsEditorProps<T>>;\n};\n\nexport type PanelAction<TPanelProps> = {\n component: React.ComponentType<TPanelProps>;\n location?: string; // 'header' or other available locations\n};\n\n/**\n * Plugin the provides custom visualizations inside a Panel.\n */\nexport interface PanelPlugin<Spec = UnknownSpec, TPanelProps = PanelProps<Spec>> extends Plugin<Spec> {\n PanelComponent: React.ComponentType<TPanelProps>;\n /**\n * React components for custom tabs\n */\n panelOptionsEditorComponents?: Array<PanelOptionsEditorComponent<Spec>>;\n /**\n * Show a custom React component when the query is loading.\n * Default: <LoadingOverlay />\n */\n LoadingComponent?: React.ComponentType<TPanelProps>;\n /**\n * List of query types supported by this panel.\n * @default [] (no query types supported) only relevant if hideQueryEditor is true\n */\n supportedQueryTypes?: QueryPluginType[];\n /**\n * Static options for the queries that will be executed.\n * Each {@link QueryPluginType} implementation can have its own options.\n * For example see {@link UseTimeSeriesQueryOptions} for time series queries.\n */\n queryOptions?: QueryOptions | ((spec: Spec) => QueryOptions);\n /**\n * If true, query editor will be hidden for panel plugin\n * @default false\n */\n hideQueryEditor?: boolean;\n /**\n * List of panel actions that will be rendered in the panel header\n */\n actions?: Array<PanelAction<TPanelProps>>;\n}\n\n/**\n * The props provided by Perses to a panel plugin's PanelComponent.\n */\nexport interface PanelProps<Spec, SupportedQueryTypes = QueryDataType> {\n spec: Spec;\n contentDimensions?: {\n width: number;\n height: number;\n };\n definition?: PanelDefinition;\n queryResults: Array<PanelData<SupportedQueryTypes>>;\n}\n\nexport interface PanelData<SupportedQueryTypes = QueryDataType> {\n definition: QueryDefinition;\n data: SupportedQueryTypes;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAkEjC,WAGC"}
@@ -1,4 +1,4 @@
1
- import { QueryDefinition } from '@perses-dev/core';
1
+ import { QueryDefinition } from '@perses-dev/spec';
2
2
  import React from 'react';
3
3
  /**
4
4
  * Base type of all plugin implementations.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/plugin-base.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { QueryDefinition } from '@perses-dev/core';\nimport React from 'react';\n\n/**\n * Base type of all plugin implementations.\n */\nexport interface Plugin<Spec> {\n /**\n * React component for editing the plugin's options in the UI.\n */\n OptionsEditorComponent?: React.ComponentType<OptionsEditorProps<Spec>>;\n\n /**\n * Callback for creating the initial options for the plugin.\n */\n createInitialOptions: () => Spec;\n}\n\n/**\n * Common props passed to options editor components.\n */\nexport interface OptionsEditorProps<Spec> {\n // TODO: These are temporary and may not actually make sense, so replace\n // with whatever makes sense as visual editing evolves\n value: Spec;\n onChange: (next: Spec) => void;\n isReadonly?: boolean;\n}\n\n/**\n * Common props passed to query editor component\n */\nexport interface QueryEditorProps<Spec> extends OptionsEditorProps<Spec> {\n queries: QueryDefinition[];\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AA+BjC;;CAEC,GACD,WAEC"}
1
+ {"version":3,"sources":["../../src/model/plugin-base.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { QueryDefinition } from '@perses-dev/spec';\nimport React from 'react';\n\n/**\n * Base type of all plugin implementations.\n */\nexport interface Plugin<Spec> {\n /**\n * React component for editing the plugin's options in the UI.\n */\n OptionsEditorComponent?: React.ComponentType<OptionsEditorProps<Spec>>;\n\n /**\n * Callback for creating the initial options for the plugin.\n */\n createInitialOptions: () => Spec;\n}\n\n/**\n * Common props passed to options editor components.\n */\nexport interface OptionsEditorProps<Spec> {\n // TODO: These are temporary and may not actually make sense, so replace\n // with whatever makes sense as visual editing evolves\n value: Spec;\n onChange: (next: Spec) => void;\n isReadonly?: boolean;\n}\n\n/**\n * Common props passed to query editor component\n */\nexport interface QueryEditorProps<Spec> extends OptionsEditorProps<Spec> {\n queries: QueryDefinition[];\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AA+BjC;;CAEC,GACD,WAEC"}
@@ -1,4 +1,4 @@
1
- import { UnknownSpec } from '@perses-dev/core';
1
+ import { UnknownSpec } from '@perses-dev/spec';
2
2
  import { DatasourcePlugin } from './datasource';
3
3
  import { PanelPlugin } from './panels';
4
4
  import { Plugin } from './plugin-base';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/plugins.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnknownSpec } from '@perses-dev/core';\nimport { DatasourcePlugin } from './datasource';\nimport { PanelPlugin } from './panels';\nimport { Plugin } from './plugin-base';\nimport { TimeSeriesQueryPlugin } from './time-series-queries';\nimport { TraceQueryPlugin } from './trace-queries';\nimport { ProfileQueryPlugin } from './profile-queries';\nimport { VariablePlugin } from './variables';\nimport { ExplorePlugin } from './explore';\nimport { LogQueryPlugin } from './log-queries';\n\nexport interface PluginModuleSpec {\n plugins: PluginMetadata[];\n}\n\nexport interface PluginMetadataWithModule extends PluginMetadata {\n module: PluginModuleMetadata;\n}\n\n/**\n * Metadata about an individual plugin that's part of a PluginModule.\n */\nexport interface PluginMetadata {\n kind: PluginType;\n spec: {\n name: string;\n display: {\n name: string;\n description?: string;\n };\n };\n}\n\n/**\n * Metadata about a module/package that contains plugins.\n */\nexport interface PluginModuleMetadata {\n name: string;\n version: string;\n}\n\n/**\n * Information about a module/package that contains plugins.\n */\nexport interface PluginModuleResource {\n kind: 'PluginModule';\n metadata: PluginModuleMetadata;\n spec: PluginModuleSpec;\n}\n\n/**\n * All supported plugin types. A plugin's implementation must extend from `Plugin<UnknownSpec>` to be considered a valid\n * `PluginType`.\n */\nexport type PluginType = {\n // Filter out implementations on SupportedPlugins that don't extend `Plugin<UnknownSpec>`\n [K in keyof SupportedPlugins]: SupportedPlugins[K] extends Plugin<UnknownSpec> ? K : never;\n}[keyof SupportedPlugins];\n\n/**\n * Map of plugin type key/string -> implementation type. Use Typescript module augmentation to extend the plugin system\n * with new plugin types.\n */\nexport interface SupportedPlugins {\n Variable: VariablePlugin;\n Panel: PanelPlugin;\n TimeSeriesQuery: TimeSeriesQueryPlugin;\n TraceQuery: TraceQueryPlugin;\n ProfileQuery: ProfileQueryPlugin;\n LogQuery: LogQueryPlugin;\n Datasource: DatasourcePlugin;\n Explore: ExplorePlugin;\n}\n\n/**\n * The implementation for a given plugin type.\n */\nexport type PluginImplementation<Type extends PluginType> = SupportedPlugins[Type];\n\n/**\n * Default plugin kinds by plugin type.\n */\ntype PluginKinds = Partial<Record<PluginType, string>>;\nexport type DefaultPluginKinds = Required<Pick<PluginKinds, 'TimeSeriesQuery'>> & Omit<PluginKinds, 'TimeSeriesQuery'>;\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAqFjC,WAAuH"}
1
+ {"version":3,"sources":["../../src/model/plugins.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnknownSpec } from '@perses-dev/spec';\nimport { DatasourcePlugin } from './datasource';\nimport { PanelPlugin } from './panels';\nimport { Plugin } from './plugin-base';\nimport { TimeSeriesQueryPlugin } from './time-series-queries';\nimport { TraceQueryPlugin } from './trace-queries';\nimport { ProfileQueryPlugin } from './profile-queries';\nimport { VariablePlugin } from './variables';\nimport { ExplorePlugin } from './explore';\nimport { LogQueryPlugin } from './log-queries';\n\nexport interface PluginModuleSpec {\n plugins: PluginMetadata[];\n}\n\nexport interface PluginMetadataWithModule extends PluginMetadata {\n module: PluginModuleMetadata;\n}\n\n/**\n * Metadata about an individual plugin that's part of a PluginModule.\n */\nexport interface PluginMetadata {\n kind: PluginType;\n spec: {\n name: string;\n display: {\n name: string;\n description?: string;\n };\n };\n}\n\n/**\n * Metadata about a module/package that contains plugins.\n */\nexport interface PluginModuleMetadata {\n name: string;\n version: string;\n}\n\n/**\n * Information about a module/package that contains plugins.\n */\nexport interface PluginModuleResource {\n kind: 'PluginModule';\n metadata: PluginModuleMetadata;\n spec: PluginModuleSpec;\n}\n\n/**\n * All supported plugin types. A plugin's implementation must extend from `Plugin<UnknownSpec>` to be considered a valid\n * `PluginType`.\n */\nexport type PluginType = {\n // Filter out implementations on SupportedPlugins that don't extend `Plugin<UnknownSpec>`\n [K in keyof SupportedPlugins]: SupportedPlugins[K] extends Plugin<UnknownSpec> ? K : never;\n}[keyof SupportedPlugins];\n\n/**\n * Map of plugin type key/string -> implementation type. Use Typescript module augmentation to extend the plugin system\n * with new plugin types.\n */\nexport interface SupportedPlugins {\n Variable: VariablePlugin;\n Panel: PanelPlugin;\n TimeSeriesQuery: TimeSeriesQueryPlugin;\n TraceQuery: TraceQueryPlugin;\n ProfileQuery: ProfileQueryPlugin;\n LogQuery: LogQueryPlugin;\n Datasource: DatasourcePlugin;\n Explore: ExplorePlugin;\n}\n\n/**\n * The implementation for a given plugin type.\n */\nexport type PluginImplementation<Type extends PluginType> = SupportedPlugins[Type];\n\n/**\n * Default plugin kinds by plugin type.\n */\ntype PluginKinds = Partial<Record<PluginType, string>>;\nexport type DefaultPluginKinds = Required<Pick<PluginKinds, 'TimeSeriesQuery'>> & Omit<PluginKinds, 'TimeSeriesQuery'>;\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAqFjC,WAAuH"}
@@ -1,5 +1,5 @@
1
1
  import { Query, QueryKey } from '@tanstack/react-query';
2
- import { UnknownSpec, ProfileData, AbsoluteTimeRange } from '@perses-dev/core';
2
+ import { UnknownSpec, ProfileData, AbsoluteTimeRange } from '@perses-dev/spec';
3
3
  import { DatasourceStore } from '../runtime';
4
4
  import { Plugin } from './plugin-base';
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/profile-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Query, QueryKey } from '@tanstack/react-query';\nimport { UnknownSpec, ProfileData, AbsoluteTimeRange } from '@perses-dev/core';\nimport { DatasourceStore } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n/**\n * A plugin for running profile queries.\n */\nexport interface ProfileQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getProfileData: (spec: Spec, ctx: ProfileQueryContext, abortSignal?: AbortSignal) => Promise<ProfileData>;\n}\n\n/**\n * Context available to ProfileQuery plugins at runtime.\n */\nexport interface ProfileQueryContext {\n datasourceStore: DatasourceStore;\n absoluteTimeRange?: AbsoluteTimeRange;\n}\n\nexport type ProfileDataQuery = Query<ProfileData, unknown, ProfileData, QueryKey>;\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAsBjC,WAAkF"}
1
+ {"version":3,"sources":["../../src/model/profile-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Query, QueryKey } from '@tanstack/react-query';\nimport { UnknownSpec, ProfileData, AbsoluteTimeRange } from '@perses-dev/spec';\nimport { DatasourceStore } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n/**\n * A plugin for running profile queries.\n */\nexport interface ProfileQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getProfileData: (spec: Spec, ctx: ProfileQueryContext, abortSignal?: AbortSignal) => Promise<ProfileData>;\n}\n\n/**\n * Context available to ProfileQuery plugins at runtime.\n */\nexport interface ProfileQueryContext {\n datasourceStore: DatasourceStore;\n absoluteTimeRange?: AbsoluteTimeRange;\n}\n\nexport type ProfileDataQuery = Query<ProfileData, unknown, ProfileData, QueryKey>;\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAsBjC,WAAkF"}
@@ -1,5 +1,5 @@
1
1
  import { Query, QueryKey } from '@tanstack/react-query';
2
- import { AbsoluteTimeRange, UnknownSpec, TimeSeriesData } from '@perses-dev/core';
2
+ import { AbsoluteTimeRange, UnknownSpec, TimeSeriesData, UnixTimeMs } from '@perses-dev/spec';
3
3
  import { DatasourceStore, VariableStateMap } from '../runtime';
4
4
  import { Plugin } from './plugin-base';
5
5
  /**
@@ -30,5 +30,15 @@ export interface TimeSeriesQueryContext {
30
30
  datasourceStore: DatasourceStore;
31
31
  }
32
32
  export type TimeSeriesDataQuery = Query<TimeSeriesData, unknown, TimeSeriesData, QueryKey>;
33
+ export type TimeSeriesValueTuple = [timestamp: UnixTimeMs, value: number | null];
34
+ export type BucketTuple = [number, string, string, string];
35
+ export type HistogramValue = {
36
+ count: number;
37
+ sum: string;
38
+ buckets?: BucketTuple[];
39
+ };
40
+ export type TimeSeriesHistogramTuple = [unixTimeSeconds: UnixTimeMs, value: HistogramValue];
41
+ export declare function isTimeSeriesValueTuple(data: TimeSeriesValueTuple): data is TimeSeriesValueTuple;
42
+ export type Labels = Record<string, string>;
33
43
  export {};
34
44
  //# sourceMappingURL=time-series-queries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"time-series-queries.d.ts","sourceRoot":"","sources":["../../src/model/time-series-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;GAEG;AACH,KAAK,iCAAiC,GAAG;IACvC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,qBAAqB,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IAC7E,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,sBAAsB,EAAE,WAAW,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAEnH,SAAS,CAAC,EAA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iC,CAAC;CAC5F;AAED,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,OAAO,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,aAAa,EAAE,gBAAgB,CAAC;IAChC,eAAe,EAAE,eAAe,CAAC;CAClC;AAED,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC;AAE3F,MAAM,MAAM,oBAAoB,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;AAEjF,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3D,MAAM,MAAM,cAAc,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,WAAW,EAAE,CAAA;CAAE,CAAC;AAErF,MAAM,MAAM,wBAAwB,GAAG,CAAC,eAAe,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;AAE5F,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI,IAAI,oBAAoB,CAG/F;AAED,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC"}
@@ -10,6 +10,9 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export { };
13
+ export function isTimeSeriesValueTuple(data) {
14
+ if (data.length !== 2) return false;
15
+ return true;
16
+ }
14
17
 
15
18
  //# sourceMappingURL=time-series-queries.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/time-series-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Query, QueryKey } from '@tanstack/react-query';\nimport { AbsoluteTimeRange, UnknownSpec, TimeSeriesData } from '@perses-dev/core';\nimport { DatasourceStore, VariableStateMap } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n/**\n * An object containing all the dependencies of a TimeSeriesQuery.\n */\ntype TimeSeriesQueryPluginDependencies = {\n /**\n * Returns a list of variables name this time series query depends on.\n */\n variables?: string[];\n};\n\n/**\n * A plugin for running time series queries.\n */\nexport interface TimeSeriesQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getTimeSeriesData: (spec: Spec, ctx: TimeSeriesQueryContext, abortSignal?: AbortSignal) => Promise<TimeSeriesData>;\n\n dependsOn?: (spec: Spec, ctx: TimeSeriesQueryContext) => TimeSeriesQueryPluginDependencies;\n}\n\nexport type TimeSeriesQueryMode = 'instant' | 'range';\n\n/**\n * Context available to TimeSeriesQuery plugins at runtime.\n */\nexport interface TimeSeriesQueryContext {\n suggestedStepMs?: number;\n mode?: TimeSeriesQueryMode;\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n}\n\nexport type TimeSeriesDataQuery = Query<TimeSeriesData, unknown, TimeSeriesData, QueryKey>;\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAuCjC,WAA2F"}
1
+ {"version":3,"sources":["../../src/model/time-series-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Query, QueryKey } from '@tanstack/react-query';\nimport { AbsoluteTimeRange, UnknownSpec, TimeSeriesData, UnixTimeMs } from '@perses-dev/spec';\nimport { DatasourceStore, VariableStateMap } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n/**\n * An object containing all the dependencies of a TimeSeriesQuery.\n */\ntype TimeSeriesQueryPluginDependencies = {\n /**\n * Returns a list of variables name this time series query depends on.\n */\n variables?: string[];\n};\n\n/**\n * A plugin for running time series queries.\n */\nexport interface TimeSeriesQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getTimeSeriesData: (spec: Spec, ctx: TimeSeriesQueryContext, abortSignal?: AbortSignal) => Promise<TimeSeriesData>;\n\n dependsOn?: (spec: Spec, ctx: TimeSeriesQueryContext) => TimeSeriesQueryPluginDependencies;\n}\n\nexport type TimeSeriesQueryMode = 'instant' | 'range';\n\n/**\n * Context available to TimeSeriesQuery plugins at runtime.\n */\nexport interface TimeSeriesQueryContext {\n suggestedStepMs?: number;\n mode?: TimeSeriesQueryMode;\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n}\n\nexport type TimeSeriesDataQuery = Query<TimeSeriesData, unknown, TimeSeriesData, QueryKey>;\n\nexport type TimeSeriesValueTuple = [timestamp: UnixTimeMs, value: number | null];\n\nexport type BucketTuple = [number, string, string, string]; // [bucket, upperBound, lowerBound, count]\n\nexport type HistogramValue = { count: number; sum: string; buckets?: BucketTuple[] };\n\nexport type TimeSeriesHistogramTuple = [unixTimeSeconds: UnixTimeMs, value: HistogramValue];\n\nexport function isTimeSeriesValueTuple(data: TimeSeriesValueTuple): data is TimeSeriesValueTuple {\n if (data.length !== 2) return false;\n return true;\n}\n\nexport type Labels = Record<string, string>;\n"],"names":["isTimeSeriesValueTuple","data","length"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAiDjC,OAAO,SAASA,uBAAuBC,IAA0B;IAC/D,IAAIA,KAAKC,MAAM,KAAK,GAAG,OAAO;IAC9B,OAAO;AACT"}
@@ -1,5 +1,5 @@
1
1
  import { Query, QueryKey } from '@tanstack/react-query';
2
- import { UnknownSpec, TraceData, AbsoluteTimeRange } from '@perses-dev/core';
2
+ import { UnknownSpec, TraceData, AbsoluteTimeRange } from '@perses-dev/spec';
3
3
  import { DatasourceStore, VariableStateMap } from '../runtime';
4
4
  import { Plugin } from './plugin-base';
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/trace-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Query, QueryKey } from '@tanstack/react-query';\nimport { UnknownSpec, TraceData, AbsoluteTimeRange } from '@perses-dev/core';\nimport { DatasourceStore, VariableStateMap } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n/**\n * An object containing all the dependencies of a TraceQuery.\n */\ntype TraceQueryQueryPluginDependencies = {\n /**\n * Returns a list of variables name this trace query depends on.\n */\n variables?: string[];\n};\n\n/**\n * A plugin for running trace queries.\n */\nexport interface TraceQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getTraceData: (spec: Spec, ctx: TraceQueryContext, abortSignal?: AbortSignal) => Promise<TraceData>;\n dependsOn?: (spec: Spec, ctx: TraceQueryContext) => TraceQueryQueryPluginDependencies;\n}\n\n/**\n * Context available to TraceQuery plugins at runtime.\n */\nexport interface TraceQueryContext {\n datasourceStore: DatasourceStore;\n absoluteTimeRange?: AbsoluteTimeRange;\n variableState: VariableStateMap;\n}\n\nexport type TraceDataQuery = Query<TraceData, unknown, TraceData, QueryKey>;\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAkCjC,WAA4E"}
1
+ {"version":3,"sources":["../../src/model/trace-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Query, QueryKey } from '@tanstack/react-query';\nimport { UnknownSpec, TraceData, AbsoluteTimeRange } from '@perses-dev/spec';\nimport { DatasourceStore, VariableStateMap } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n/**\n * An object containing all the dependencies of a TraceQuery.\n */\ntype TraceQueryQueryPluginDependencies = {\n /**\n * Returns a list of variables name this trace query depends on.\n */\n variables?: string[];\n};\n\n/**\n * A plugin for running trace queries.\n */\nexport interface TraceQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getTraceData: (spec: Spec, ctx: TraceQueryContext, abortSignal?: AbortSignal) => Promise<TraceData>;\n dependsOn?: (spec: Spec, ctx: TraceQueryContext) => TraceQueryQueryPluginDependencies;\n}\n\n/**\n * Context available to TraceQuery plugins at runtime.\n */\nexport interface TraceQueryContext {\n datasourceStore: DatasourceStore;\n absoluteTimeRange?: AbsoluteTimeRange;\n variableState: VariableStateMap;\n}\n\nexport type TraceDataQuery = Query<TraceData, unknown, TraceData, QueryKey>;\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAkCjC,WAA4E"}
@@ -1,5 +1,5 @@
1
1
  import type { VariableOption } from '@perses-dev/components';
2
- import { AbsoluteTimeRange, UnknownSpec } from '@perses-dev/core';
2
+ import { AbsoluteTimeRange, UnknownSpec } from '@perses-dev/spec';
3
3
  import { DatasourceStore, VariableStateMap } from '../runtime';
4
4
  import { Plugin } from './plugin-base';
5
5
  export type { VariableOption } from '@perses-dev/components';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/variables.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { VariableOption } from '@perses-dev/components';\nimport { AbsoluteTimeRange, UnknownSpec } from '@perses-dev/core';\nimport { DatasourceStore, VariableStateMap } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n// Re-export VariableOption from @perses-dev/components for backwards compatibility\nexport type { VariableOption } from '@perses-dev/components';\n\nexport interface GetVariableOptionsContext {\n variables: VariableStateMap;\n datasourceStore: DatasourceStore;\n timeRange: AbsoluteTimeRange;\n}\n\n/**\n * An object containing all the dependencies of a VariablePlugin.\n */\ntype VariablePluginDependencies = {\n /**\n * Returns a list of variables name this time series query depends on.\n */\n variables?: string[];\n};\n\n/**\n * Plugin for handling custom VariableDefinitions.\n */\nexport interface VariablePlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getVariableOptions: (\n definition: Spec,\n ctx: GetVariableOptionsContext,\n abortSignal?: AbortSignal\n ) => Promise<{ data: VariableOption[] }>;\n\n /**\n * Returns a list of variables name this variable depends on. Used to optimize fetching\n */\n dependsOn?: (definition: Spec, ctx: GetVariableOptionsContext) => VariablePluginDependencies;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AA0BjC;;CAEC,GACD,WAWC"}
1
+ {"version":3,"sources":["../../src/model/variables.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { VariableOption } from '@perses-dev/components';\nimport { AbsoluteTimeRange, UnknownSpec } from '@perses-dev/spec';\nimport { DatasourceStore, VariableStateMap } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n// Re-export VariableOption from @perses-dev/components for backwards compatibility\nexport type { VariableOption } from '@perses-dev/components';\n\nexport interface GetVariableOptionsContext {\n variables: VariableStateMap;\n datasourceStore: DatasourceStore;\n timeRange: AbsoluteTimeRange;\n}\n\n/**\n * An object containing all the dependencies of a VariablePlugin.\n */\ntype VariablePluginDependencies = {\n /**\n * Returns a list of variables name this time series query depends on.\n */\n variables?: string[];\n};\n\n/**\n * Plugin for handling custom VariableDefinitions.\n */\nexport interface VariablePlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getVariableOptions: (\n definition: Spec,\n ctx: GetVariableOptionsContext,\n abortSignal?: AbortSignal\n ) => Promise<{ data: VariableOption[] }>;\n\n /**\n * Returns a list of variables name this variable depends on. Used to optimize fetching\n */\n dependsOn?: (definition: Spec, ctx: GetVariableOptionsContext) => VariablePluginDependencies;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AA0BjC;;CAEC,GACD,WAWC"}
@@ -1 +1 @@
1
- {"version":3,"file":"PluginRuntime.d.ts","sourceRoot":"","sources":["../../src/remote/PluginRuntime.tsx"],"names":[],"mappings":"AA2BA,OAAO,EAAkB,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAOvF,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAoMxE,eAAO,MAAM,UAAU,eACT,MAAM,cACN,MAAM,YACR,MAAM,KACf,QAAQ,kBAAkB,GAAG,IAAI,CAMnC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,GAAG;IACtE,aAAa,EAAE,gBAAgB,CAAC;IAChC,UAAU,EAAE,MAAM,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;CACtD,CAKA"}
1
+ {"version":3,"file":"PluginRuntime.d.ts","sourceRoot":"","sources":["../../src/remote/PluginRuntime.tsx"],"names":[],"mappings":"AA2BA,OAAO,EAAkB,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAOvF,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAqMxE,eAAO,MAAM,UAAU,eACT,MAAM,cACN,MAAM,YACR,MAAM,KACf,QAAQ,kBAAkB,GAAG,IAAI,CAMnC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,GAAG;IACtE,aAAa,EAAE,gBAAgB,CAAC;IAChC,UAAU,EAAE,MAAM,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;CACtD,CAKA"}