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 authored and GitHub committed 2018-09-19 13:53:42 +02:00
commit 6eb15df953
2 files changed
+2 -1

No files matched your search

@@ -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"}'
@@ -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"}');
});