Skip to content
Merged
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 @@ -456,7 +456,7 @@ describe('ML - custom URL utils', () => {
);
});

test('return expected url for Security app', () => {
test('return expected URL for Security app', () => {
const urlConfig = {
url_name: 'Hosts Details by process name',
url_value:
Expand Down Expand Up @@ -508,6 +508,45 @@ describe('ML - custom URL utils', () => {
);
});

test('return expected URL for Metrics app', () => {
const urlConfig = {
url_name: 'Hosts Details by process name',
url_value:
'metrics/detail/host/$host.name$?metricTime=(autoReload:!f,refreshInterval:5000,time:(from:%27$earliest$%27,interval:%3E%3D1m,to:%27$latest$%27))',
};

const testRecord = {
job_id: 'hosts_memory_usage',
result_type: 'record',
probability: 0.0001288876418224276,
multi_bucket_impact: -5,
record_score: 88.26287,
initial_record_score: 61.553927615180186,
bucket_span: 900,
detector_index: 0,
is_interim: false,
timestamp: 1599571800000,
function: 'max',
function_description: 'max',
typical: [0.23685835059986396],
actual: [0.258],
field_name: 'system.memory.actual.used.pct',
influencers: [
{
influencer_field_name: 'host.name',
influencer_field_values: ['gke-dev-next-oblt-dev-next-oblt-pool-404d7f0c-2bfl'],
},
],
'host.name': ['gke-dev-next-oblt-dev-next-oblt-pool-404d7f0c-2bfl'],
earliest: '2019-09-08T12:00:00.000Z',
latest: '2019-09-08T14:59:59.999Z',
};

expect(getUrlForRecord(urlConfig, testRecord)).toBe(
"metrics/detail/host/gke-dev-next-oblt-dev-next-oblt-pool-404d7f0c-2bfl?metricTime=(autoReload:!f,refreshInterval:5000,time:(from:'2019-09-08T12:00:00.000Z',interval:>=1m,to:'2019-09-08T14:59:59.999Z'))"
);
});

test('removes an empty path component with a trailing slash', () => {
const urlConfig = {
url_name: 'APM',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ function isKibanaUrl(urlConfig: UrlConfig) {
urlValue.startsWith('dashboards#/') ||
urlValue.startsWith('apm#/') ||
// BrowserRouter based plugins
urlValue.startsWith('metrics/') ||
urlValue.startsWith('security/') ||
// Legacy links
urlValue.startsWith('siem#/')
Expand Down