anchor.diff:    prometheus_histogram:observe(http_request_duration_milliseconds, [get], 350),
     prometheus_histogram:observe(http_request_duration_milliseconds, [get], 550),
     prometheus_histogram:observe(http_request_duration_milliseconds, [get], 950),
  -  prometheus_histogram:observe(http_request_duration_milliseconds, [post], 500),
  -  prometheus_histogram:observe(http_request_duration_milliseconds, [post], 150),
  -  prometheus_histogram:observe(http_request_duration_milliseconds, [post], 450),
  -  prometheus_histogram:observe(http_request_duration_milliseconds, [post], 850),
  -  prometheus_histogram:observe(http_request_duration_milliseconds, [post], 750),
  -  prometheus_histogram:observe(http_request_duration_milliseconds, [post], 1650),
  -  prometheus_counter:dinc(dtest, 1.5),
  -  prometheus_counter:dinc(dtest, 3.5),
  -  prometheus_counter:dinc(dtest, 1.5),
  -  ?_assertEqual("# TYPE pool_size gauge
  -# HELP pool_size MongoDB Connections pool size
  -pool_size 365
  -# TYPE http_requests_total counter
  -# HELP http_requests_total Http request count
  -http_requests_total 1
  -# TYPE dtest counter
  -# HELP dtest qwe
  -dtest 6.5
  -# TYPE orders_summary summary
  -# HELP orders_summary Track orders count/total sum
  -orders_summary_count 2
  -orders_summary_sum 25
  -# TYPE dsummary summary
  -# HELP dsummary qwe
  -dsummary_count 2
  -dsummary_sum 4.2
  -# TYPE http_request_duration_milliseconds histogram
  +  ?_assertEqual(<<"# TYPE http_request_duration_milliseconds histogram
   # HELP http_request_duration_milliseconds Http Request execution time
  -http_request_duration_milliseconds_bucket{method=\"post\",le=\"100\"} 0
  -http_request_duration_milliseconds_bucket{method=\"post\",le=\"300\"} 1
  -http_request_duration_milliseconds_bucket{method=\"post\",le=\"500\"} 3
  -http_request_duration_milliseconds_bucket{method=\"post\",le=\"750\"} 4
  -http_request_duration_milliseconds_bucket{method=\"post\",le=\"1000\"} 5
  -http_request_duration_milliseconds_bucket{method=\"post\",le=\"+Inf\"} 6
  -http_request_duration_milliseconds_count{method=\"post\"} 6
  -http_request_duration_milliseconds_sum{method=\"post\"} 4350
   http_request_duration_milliseconds_bucket{method=\"get\",le=\"100\"} 3
   http_request_duration_milliseconds_bucket{method=\"get\",le=\"300\"} 6
   http_request_duration_milliseconds_bucket{method=\"get\",le=\"500\"} 7
  
positive.code:   ?assertEqual("qwe\\\\qwe\\nqwe\\\"qwe", prometheus_text_format:escape_label_value("qwe\\qwe\nqwe\"qwe")).
  
  prometheus_format_test_() ->
    {setup,
     fun start/0,
     fun stop/1,
     fun(_) ->
         {inorder, [test_format()]}
     end}.
  
  start() ->
    prometheus:start(),
  
negative.code:   [prometheus_registry:register_collector(default, Collector) || Collector <- DefaultCollectors],
    ok.
  
  test_gauge(_) ->
    prometheus_gauge:new([{name, pool_size}, {help, "MongoDB Connections pool size"}]),
    prometheus_gauge:set(pool_size, 365),
    ?_assertEqual(<<"# TYPE pool_size gauge
  # HELP pool_size MongoDB Connections pool size
  pool_size 365
  
  ">>, prometheus_text_format:format()).
  
  test_counter(_) ->
    prometheus_counter:new([{name, http_requests_total}, {help, "Http request count"}]),
    prometheus_counter:inc(http_requests_total),
    ?_assertEqual(<<"# TYPE http_requests_total counter
  # HELP http_requests_total Http request count
  http_requests_total 1
  
  ">>, prometheus_text_format:format()).
  
  test_dcounter(_) ->
    prometheus_counter:new([{name, dtest}, {help, "qw\"\\e"}]),
    prometheus_counter:dinc(dtest, 1.5),
    prometheus_counter:dinc(dtest, 3.5),
    prometheus_counter:dinc(dtest, 1.5),
    ?_assertEqual(<<"# TYPE dtest counter
  # HELP dtest qw\"\\\\e
  dtest 6.5
  
  ">>, prometheus_text_format:format()).
  
  test_summary(_) ->
    prometheus_summary:new([{name, orders_summary}, {help, "Track orders count/total sum"}]),
    prometheus_summary:observe(orders_summary,  10),
    prometheus_summary:observe(orders_summary,  15),
    ?_assertEqual(<<"# TYPE orders_summary summary
  # HELP orders_summary Track orders count/total sum
  orders_summary_count 2
  orders_summary_sum 25
  
  ">>, prometheus_text_format:format()).
  
  test_dsummary(_) ->
    prometheus_summary:new([{name, dsummary}, {help, "qwe"}]),
    prometheus_summary:dobserve(dsummary, 1.5),
    prometheus_summary:dobserve(dsummary, 2.7),
    ?_assertEqual(<<"# TYPE dsummary summary
  # HELP dsummary qwe
  dsummary_count 2
  dsummary_sum 4.2
  
  ">>, prometheus_text_format:format()).
  
  test_histogram(_) ->
    prometheus_histogram:new([{name, http_request_duration_milliseconds},
                              {labels, [method]},
                              {bounds, [100, 300, 500, 750, 1000]},
                              {help, "Http Request execution time"}]),
    prometheus_histogram:observe(http_request_duration_milliseconds, [get], 95),
    prometheus_histogram:observe(http_request_duration_milliseconds, [get], 100),
    prometheus_histogram:observe(http_request_duration_milliseconds, [get], 102),
  