(t *testing.T)
| 991 | } |
| 992 | |
| 993 | func TestWriteToTextfile(t *testing.T) { |
| 994 | expectedOut := `# HELP test_counter test counter |
| 995 | # TYPE test_counter counter |
| 996 | test_counter{name="qux"} 1 |
| 997 | # HELP test_gauge test gauge |
| 998 | # TYPE test_gauge gauge |
| 999 | test_gauge{name="baz"} 1.1 |
| 1000 | # HELP test_hist test histogram |
| 1001 | # TYPE test_hist histogram |
| 1002 | test_hist_bucket{name="bar",le="0.005"} 0 |
| 1003 | test_hist_bucket{name="bar",le="0.01"} 0 |
| 1004 | test_hist_bucket{name="bar",le="0.025"} 0 |
| 1005 | test_hist_bucket{name="bar",le="0.05"} 0 |
| 1006 | test_hist_bucket{name="bar",le="0.1"} 0 |
| 1007 | test_hist_bucket{name="bar",le="0.25"} 0 |
| 1008 | test_hist_bucket{name="bar",le="0.5"} 0 |
| 1009 | test_hist_bucket{name="bar",le="1"} 1 |
| 1010 | test_hist_bucket{name="bar",le="2.5"} 1 |
| 1011 | test_hist_bucket{name="bar",le="5"} 2 |
| 1012 | test_hist_bucket{name="bar",le="10"} 2 |
| 1013 | test_hist_bucket{name="bar",le="+Inf"} 2 |
| 1014 | test_hist_sum{name="bar"} 3.64 |
| 1015 | test_hist_count{name="bar"} 2 |
| 1016 | # HELP test_summary test summary |
| 1017 | # TYPE test_summary summary |
| 1018 | test_summary{name="foo",quantile="0.5"} 10 |
| 1019 | test_summary{name="foo",quantile="0.9"} 20 |
| 1020 | test_summary{name="foo",quantile="0.99"} 20 |
| 1021 | test_summary_sum{name="foo"} 30 |
| 1022 | test_summary_count{name="foo"} 2 |
| 1023 | ` |
| 1024 | |
| 1025 | registry := prometheus.NewRegistry() |
| 1026 | |
| 1027 | summary := prometheus.NewSummaryVec( |
| 1028 | prometheus.SummaryOpts{ |
| 1029 | Name: "test_summary", |
| 1030 | Help: "test summary", |
| 1031 | Objectives: map[float64]float64{ |
| 1032 | 0.5: 0.05, |
| 1033 | 0.9: 0.01, |
| 1034 | 0.99: 0.001, |
| 1035 | }, |
| 1036 | }, |
| 1037 | []string{"name"}, |
| 1038 | ) |
| 1039 | |
| 1040 | histogram := prometheus.NewHistogramVec( |
| 1041 | prometheus.HistogramOpts{ |
| 1042 | Name: "test_hist", |
| 1043 | Help: "test histogram", |
| 1044 | }, |
| 1045 | []string{"name"}, |
| 1046 | ) |
| 1047 | |
| 1048 | gauge := prometheus.NewGaugeVec( |
| 1049 | prometheus.GaugeOpts{ |
| 1050 | Name: "test_gauge", |
nothing calls this directly
no test coverage detected