Merge pull request #13339 from grafana/davkal/13337-fix-rules-filter

Explore: Fix click to filter for recording rule expressions
This commit is contained in:
Torkel Ödegaard
2018-09-19 13:53:42 +02:00
committed by GitHub
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"}');
});