Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch up to all latest PromQL features, enable experimental functions #148

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
215 changes: 121 additions & 94 deletions app/package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@codemirror/autocomplete": "^6.3.0",
"@codemirror/commands": "^6.2.4",
"@codemirror/language": "^6.2.1",
"@codemirror/lint": "^6.0.0",
"@codemirror/search": "^6.2.1",
"@codemirror/state": "^6.1.4",
"@codemirror/view": "^6.3.1",
"@codemirror/autocomplete": "^6.18.0",
"@codemirror/commands": "^6.6.1",
"@codemirror/language": "^6.10.2",
"@codemirror/lint": "^6.8.1",
"@codemirror/search": "^6.5.6",
"@codemirror/state": "^6.4.1",
"@codemirror/view": "^6.33.0",
"@fortawesome/fontawesome-svg-core": "^1.2.34",
"@fortawesome/free-solid-svg-icons": "^5.15.2",
"@lezer/highlight": "^1.1.4",
"@prometheus-io/codemirror-promql": "^0.42.0",
"@prometheus-io/codemirror-promql": "^0.54.1",
"bootstrap": "^4.5.3",
"flot": "^4.2.1",
"fuzzy": "^0.1.3",
Expand Down
5 changes: 5 additions & 0 deletions app/src/PromLens/NodeVisualizer/ExplainViews/Aggregation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ const describeAggregationType = (aggrType: aggregationType, param: ASTNode | nul
}th percentile) over the sample values of the input series`;
}
return 'calculates a quantile over the sample values of the input series';

case 'limitk':
return 'limits the output to K series';
case 'limit_ratio':
return 'limits the output to a ratio of the input series';
default:
throw new Error(`invalid aggregation type ${aggrType}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ const AggregationEditor: FC<AggregationEditorProps> = ({ node, onUpdate }) => {

const changeOp = (newOp: aggregationType) => {
let param: ASTNode | null = null;
// Keeping the param argument only makes sense when switching between bottomk/topk.
if (['topk', 'bottomk'].includes(node.op) && ['topk', 'bottomk'].includes(newOp)) {

// Keeping the param argument only makes sense when switching between bottomk/topk/limitk.
const kOps = ['topk', 'bottomk', 'limitk'];
if (kOps.includes(node.op) && kOps.includes(newOp)) {
param = node.param;
}

if (!aggregatorsWithParam.includes(node.op) && aggregatorsWithParam.includes(newOp)) {
param = { type: nodeType.placeholder, children: [] };
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/promql/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export enum aggregationType {
bottomk = 'bottomk',
topk = 'topk',
quantile = 'quantile',
limitK = 'limitk',
limitRatio = 'limit_ratio',
}

export enum binaryOperatorType {
Expand Down
1 change: 1 addition & 0 deletions app/src/promql/cmd/gen_functions_docs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func main() {
"stdvar_over_time",
"last_over_time",
"present_over_time",
"mad_over_time",
} {
funcDocs[fn] = currentDocs
}
Expand Down
Loading
Loading