Loki: Add hints for level-like labels (#52414)

* Loki: Add hint for level-like label

* Add test to addToQuery

* Add tests

* Update tests

* Update copy

* Get log position in metrics query and add test

* Update
This commit is contained in:
Ivana Huckova
2022-07-22 16:59:25 +02:00
committed by GitHub
parent 9f81b3dcc6
commit 772b6396f5
13 changed files with 318 additions and 22 deletions

View File

@@ -295,15 +295,13 @@ function getLineFormat(expr: string, node: SyntaxNode): QueryBuilderOperation {
function getLabelFormat(expr: string, node: SyntaxNode): QueryBuilderOperation {
const id = 'label_format';
const identifier = node.getChild('Identifier');
const op = identifier!.nextSibling;
const value = op!.nextSibling;
let valueString = handleQuotes(getString(expr, value));
const renameTo = node.getChild('Identifier');
const op = renameTo!.nextSibling;
const originalLabel = op!.nextSibling;
return {
id,
params: [getString(expr, identifier), valueString],
params: [getString(expr, originalLabel), handleQuotes(getString(expr, renameTo))],
};
}