@@ -456,7 +456,7 @@ describe('ML - custom URL utils', () => {
456456 ) ;
457457 } ) ;
458458
459- test ( 'return expected url for Security app' , ( ) => {
459+ test ( 'return expected URL for Security app' , ( ) => {
460460 const urlConfig = {
461461 url_name : 'Hosts Details by process name' ,
462462 url_value :
@@ -508,6 +508,45 @@ describe('ML - custom URL utils', () => {
508508 ) ;
509509 } ) ;
510510
511+ test ( 'return expected URL for Metrics app' , ( ) => {
512+ const urlConfig = {
513+ url_name : 'Hosts Details by process name' ,
514+ url_value :
515+ 'metrics/detail/host/$host.name$?metricTime=(autoReload:!f,refreshInterval:5000,time:(from:%27$earliest$%27,interval:%3E%3D1m,to:%27$latest$%27))' ,
516+ } ;
517+
518+ const testRecord = {
519+ job_id : 'hosts_memory_usage' ,
520+ result_type : 'record' ,
521+ probability : 0.0001288876418224276 ,
522+ multi_bucket_impact : - 5 ,
523+ record_score : 88.26287 ,
524+ initial_record_score : 61.553927615180186 ,
525+ bucket_span : 900 ,
526+ detector_index : 0 ,
527+ is_interim : false ,
528+ timestamp : 1599571800000 ,
529+ function : 'max' ,
530+ function_description : 'max' ,
531+ typical : [ 0.23685835059986396 ] ,
532+ actual : [ 0.258 ] ,
533+ field_name : 'system.memory.actual.used.pct' ,
534+ influencers : [
535+ {
536+ influencer_field_name : 'host.name' ,
537+ influencer_field_values : [ 'gke-dev-next-oblt-dev-next-oblt-pool-404d7f0c-2bfl' ] ,
538+ } ,
539+ ] ,
540+ 'host.name' : [ 'gke-dev-next-oblt-dev-next-oblt-pool-404d7f0c-2bfl' ] ,
541+ earliest : '2019-09-08T12:00:00.000Z' ,
542+ latest : '2019-09-08T14:59:59.999Z' ,
543+ } ;
544+
545+ expect ( getUrlForRecord ( urlConfig , testRecord ) ) . toBe (
546+ "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'))"
547+ ) ;
548+ } ) ;
549+
511550 test ( 'removes an empty path component with a trailing slash' , ( ) => {
512551 const urlConfig = {
513552 url_name : 'APM' ,
0 commit comments