Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ describe('addLabelToQuery()', () => {
'count(my_metric{bar="baz",job!="foo"} < (5*1024*1024*1024) or vector(0)) - 1'
);
});
it('should not add ad-hoc filter to the offset keyword', () => {
expect(addLabelToQuery('metric offset 5m', 'foo', 'bar')).toBe('metric{foo="bar"} offset 5m');
expect(
addLabelToQuery('unless ratelimit_service_rate_limit_over_limit offset 5m', 'container', 'istio-ratelimit')
).toBe('unless ratelimit_service_rate_limit_over_limit{container="istio-ratelimit"} offset 5m');
});
});

describe('addLabelToSelector()', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';

const keywords = 'by|without|on|ignoring|group_left|group_right|bool';
const keywords = 'by|without|on|ignoring|group_left|group_right|bool|offset';
const logicalOperators = 'or|and|unless';

// Duplicate from mode-prometheus.js, which can't be used in tests due to global ace not being loaded.
Expand Down
Loading