@@ -21,12 +21,12 @@ import * as sinon from 'sinon';
2121import * as http from 'http' ;
2222import { PrometheusExporter } from '../src' ;
2323import {
24- mockedHrTimeMs ,
2524 mockHrTime ,
2625 sdkLanguage ,
2726 sdkName ,
2827 sdkVersion ,
2928 serviceName ,
29+ mockedHrTimeMs ,
3030} from './util' ;
3131import { SinonStubbedInstance } from 'sinon' ;
3232
@@ -290,7 +290,7 @@ describe('PrometheusExporter', () => {
290290 ...serializedDefaultResourceLines ,
291291 '# HELP counter_total a test description' ,
292292 '# TYPE counter_total counter' ,
293- ` counter_total{key1="attributeValue1"} 10 ${ mockedHrTimeMs } ` ,
293+ ' counter_total{key1="attributeValue1"} 10' ,
294294 '' ,
295295 ] ) ;
296296 } ) ;
@@ -320,7 +320,7 @@ describe('PrometheusExporter', () => {
320320 ...serializedDefaultResourceLines ,
321321 '# HELP metric_observable_gauge a test description' ,
322322 '# TYPE metric_observable_gauge gauge' ,
323- ` metric_observable_gauge{pid="123",core="1"} 0.999 ${ mockedHrTimeMs } ` ,
323+ ' metric_observable_gauge{pid="123",core="1"} 0.999' ,
324324 '' ,
325325 ] ) ;
326326 } ) ;
@@ -340,8 +340,8 @@ describe('PrometheusExporter', () => {
340340 ...serializedDefaultResourceLines ,
341341 '# HELP counter_total a test description' ,
342342 '# TYPE counter_total counter' ,
343- ` counter_total{counterKey1="attributeValue1"} 10 ${ mockedHrTimeMs } ` ,
344- ` counter_total{counterKey1="attributeValue2"} 20 ${ mockedHrTimeMs } ` ,
343+ ' counter_total{counterKey1="attributeValue1"} 10' ,
344+ ' counter_total{counterKey1="attributeValue2"} 20' ,
345345 '' ,
346346 ] ) ;
347347 } ) ;
@@ -389,7 +389,7 @@ describe('PrometheusExporter', () => {
389389 ...serializedDefaultResourceLines ,
390390 '# HELP counter_total description missing' ,
391391 '# TYPE counter_total counter' ,
392- ` counter_total{key1="attributeValue1"} 10 ${ mockedHrTimeMs } ` ,
392+ ' counter_total{key1="attributeValue1"} 10' ,
393393 '' ,
394394 ] ) ;
395395 } ) ;
@@ -406,7 +406,7 @@ describe('PrometheusExporter', () => {
406406 ...serializedDefaultResourceLines ,
407407 '# HELP counter_bad_name_total description missing' ,
408408 '# TYPE counter_bad_name_total counter' ,
409- ` counter_bad_name_total{key1="attributeValue1"} 10 ${ mockedHrTimeMs } ` ,
409+ ' counter_bad_name_total{key1="attributeValue1"} 10' ,
410410 '' ,
411411 ] ) ;
412412 } ) ;
@@ -424,7 +424,7 @@ describe('PrometheusExporter', () => {
424424 ...serializedDefaultResourceLines ,
425425 '# HELP counter a test description' ,
426426 '# TYPE counter gauge' ,
427- ` counter{key1="attributeValue1"} 20 ${ mockedHrTimeMs } ` ,
427+ ' counter{key1="attributeValue1"} 20' ,
428428 '' ,
429429 ] ) ;
430430 } ) ;
@@ -453,7 +453,7 @@ describe('PrometheusExporter', () => {
453453 ...serializedDefaultResourceLines ,
454454 '# HELP metric_observable_counter a test description' ,
455455 '# TYPE metric_observable_counter counter' ,
456- ` metric_observable_counter{key1="attributeValue1"} 20 ${ mockedHrTimeMs } ` ,
456+ ' metric_observable_counter{key1="attributeValue1"} 20' ,
457457 '' ,
458458 ] ) ;
459459 } ) ;
@@ -484,7 +484,7 @@ describe('PrometheusExporter', () => {
484484 ...serializedDefaultResourceLines ,
485485 '# HELP metric_observable_up_down_counter a test description' ,
486486 '# TYPE metric_observable_up_down_counter gauge' ,
487- ` metric_observable_up_down_counter{key1="attributeValue1"} 20 ${ mockedHrTimeMs } ` ,
487+ ' metric_observable_up_down_counter{key1="attributeValue1"} 20' ,
488488 '' ,
489489 ] ) ;
490490 } ) ;
@@ -503,24 +503,24 @@ describe('PrometheusExporter', () => {
503503 ...serializedDefaultResourceLines ,
504504 '# HELP test_histogram a test description' ,
505505 '# TYPE test_histogram histogram' ,
506- ` test_histogram_count{key1="attributeValue1"} 1 ${ mockedHrTimeMs } ` ,
507- ` test_histogram_sum{key1="attributeValue1"} 20 ${ mockedHrTimeMs } ` ,
508- ` test_histogram_bucket{key1="attributeValue1",le="0"} 0 ${ mockedHrTimeMs } ` ,
509- ` test_histogram_bucket{key1="attributeValue1",le="5"} 0 ${ mockedHrTimeMs } ` ,
510- ` test_histogram_bucket{key1="attributeValue1",le="10"} 0 ${ mockedHrTimeMs } ` ,
511- ` test_histogram_bucket{key1="attributeValue1",le="25"} 1 ${ mockedHrTimeMs } ` ,
512- ` test_histogram_bucket{key1="attributeValue1",le="50"} 1 ${ mockedHrTimeMs } ` ,
513- ` test_histogram_bucket{key1="attributeValue1",le="75"} 1 ${ mockedHrTimeMs } ` ,
514- ` test_histogram_bucket{key1="attributeValue1",le="100"} 1 ${ mockedHrTimeMs } ` ,
515- ` test_histogram_bucket{key1="attributeValue1",le="250"} 1 ${ mockedHrTimeMs } ` ,
516- ` test_histogram_bucket{key1="attributeValue1",le="500"} 1 ${ mockedHrTimeMs } ` ,
517- ` test_histogram_bucket{key1="attributeValue1",le="750"} 1 ${ mockedHrTimeMs } ` ,
518- ` test_histogram_bucket{key1="attributeValue1",le="1000"} 1 ${ mockedHrTimeMs } ` ,
519- ` test_histogram_bucket{key1="attributeValue1",le="2500"} 1 ${ mockedHrTimeMs } ` ,
520- ` test_histogram_bucket{key1="attributeValue1",le="5000"} 1 ${ mockedHrTimeMs } ` ,
521- ` test_histogram_bucket{key1="attributeValue1",le="7500"} 1 ${ mockedHrTimeMs } ` ,
522- ` test_histogram_bucket{key1="attributeValue1",le="10000"} 1 ${ mockedHrTimeMs } ` ,
523- ` test_histogram_bucket{key1="attributeValue1",le="+Inf"} 1 ${ mockedHrTimeMs } ` ,
506+ ' test_histogram_count{key1="attributeValue1"} 1' ,
507+ ' test_histogram_sum{key1="attributeValue1"} 20' ,
508+ ' test_histogram_bucket{key1="attributeValue1",le="0"} 0' ,
509+ ' test_histogram_bucket{key1="attributeValue1",le="5"} 0' ,
510+ ' test_histogram_bucket{key1="attributeValue1",le="10"} 0' ,
511+ ' test_histogram_bucket{key1="attributeValue1",le="25"} 1' ,
512+ ' test_histogram_bucket{key1="attributeValue1",le="50"} 1' ,
513+ ' test_histogram_bucket{key1="attributeValue1",le="75"} 1' ,
514+ ' test_histogram_bucket{key1="attributeValue1",le="100"} 1' ,
515+ ' test_histogram_bucket{key1="attributeValue1",le="250"} 1' ,
516+ ' test_histogram_bucket{key1="attributeValue1",le="500"} 1' ,
517+ ' test_histogram_bucket{key1="attributeValue1",le="750"} 1' ,
518+ ' test_histogram_bucket{key1="attributeValue1",le="1000"} 1' ,
519+ ' test_histogram_bucket{key1="attributeValue1",le="2500"} 1' ,
520+ ' test_histogram_bucket{key1="attributeValue1",le="5000"} 1' ,
521+ ' test_histogram_bucket{key1="attributeValue1",le="7500"} 1' ,
522+ ' test_histogram_bucket{key1="attributeValue1",le="10000"} 1' ,
523+ ' test_histogram_bucket{key1="attributeValue1",le="+Inf"} 1' ,
524524 '' ,
525525 ] ) ;
526526 } ) ;
@@ -562,7 +562,7 @@ describe('PrometheusExporter', () => {
562562 ...serializedDefaultResourceLines ,
563563 '# HELP test_prefix_counter_total description missing' ,
564564 '# TYPE test_prefix_counter_total counter' ,
565- ` test_prefix_counter_total{key1="attributeValue1"} 10 ${ mockedHrTimeMs } ` ,
565+ ' test_prefix_counter_total{key1="attributeValue1"} 10' ,
566566 '' ,
567567 ] ) ;
568568
@@ -591,7 +591,7 @@ describe('PrometheusExporter', () => {
591591 ...serializedDefaultResourceLines ,
592592 '# HELP counter_total description missing' ,
593593 '# TYPE counter_total counter' ,
594- ` counter_total{key1="attributeValue1"} 10 ${ mockedHrTimeMs } ` ,
594+ ' counter_total{key1="attributeValue1"} 10' ,
595595 '' ,
596596 ] ) ;
597597
@@ -620,7 +620,7 @@ describe('PrometheusExporter', () => {
620620 ...serializedDefaultResourceLines ,
621621 '# HELP counter_total description missing' ,
622622 '# TYPE counter_total counter' ,
623- ` counter_total{key1="attributeValue1"} 10 ${ mockedHrTimeMs } ` ,
623+ ' counter_total{key1="attributeValue1"} 10' ,
624624 '' ,
625625 ] ) ;
626626
@@ -632,10 +632,10 @@ describe('PrometheusExporter', () => {
632632 ) ;
633633 } ) ;
634634
635- it ( 'should export a metric without timestamp' , done => {
635+ it ( 'should export a metric with timestamp' , done => {
636636 exporter = new PrometheusExporter (
637637 {
638- appendTimestamp : false ,
638+ appendTimestamp : true ,
639639 } ,
640640 async ( ) => {
641641 setup ( exporter ) ;
@@ -649,7 +649,7 @@ describe('PrometheusExporter', () => {
649649 ...serializedDefaultResourceLines ,
650650 '# HELP counter_total description missing' ,
651651 '# TYPE counter_total counter' ,
652- ' counter_total{key1="attributeValue1"} 10' ,
652+ ` counter_total{key1="attributeValue1"} 10 ${ mockedHrTimeMs } ` ,
653653 '' ,
654654 ] ) ;
655655
0 commit comments