Explore: Fix click to filter for recording rule expressions

- recording rule names contain ':'
- include this in the pattern for metric names
This commit is contained in:
David Kaltschmidt 2018-09-19 11:45:55 +02:00
parent fe9d86c070
commit 6aac8610eb
2 changed files with 2 additions and 1 deletions

View File

@ -15,7 +15,7 @@ const builtInWords = [
.join('|')
.split('|');
const metricNameRegexp = /([A-Za-z]\w*)\b(?![\(\]{=!",])/g;
const metricNameRegexp = /([A-Za-z:][\w:]*)\b(?![\(\]{=!",])/g;
const selectorRegexp = /{([^{]*)}/g;
// addLabelToQuery('foo', 'bar', 'baz') => 'foo{bar="baz"}'

View File

@ -28,6 +28,7 @@ describe('addLabelToQuery()', () => {
expect(addLabelToQuery('foo{instance="my-host.com:9100"}', 'bar', 'baz')).toBe(
'foo{bar="baz",instance="my-host.com:9100"}'
);
expect(addLabelToQuery('foo:metric:rate1m', 'bar', 'baz')).toBe('foo:metric:rate1m{bar="baz"}');
expect(addLabelToQuery('foo{list="a,b,c"}', 'bar', 'baz')).toBe('foo{bar="baz",list="a,b,c"}');
});