(t *testing.T)
| 1389 | } |
| 1390 | |
| 1391 | func TestPromTextParser_parseToSeries(t *testing.T) { |
| 1392 | tests := map[string]struct { |
| 1393 | input []byte |
| 1394 | want Series |
| 1395 | }{ |
| 1396 | "All types": { |
| 1397 | input: []byte(` |
| 1398 | # HELP test_gauge_metric_1 Test Gauge Metric 1 |
| 1399 | # TYPE test_gauge_metric_1 gauge |
| 1400 | test_gauge_metric_1{label1="value1"} 11 |
| 1401 | test_gauge_no_meta_metric_1{label1="value1"} 11 |
| 1402 | # HELP test_counter_metric_1_total Test Counter Metric 1 |
| 1403 | # TYPE test_counter_metric_1_total counter |
| 1404 | test_counter_metric_1_total{label1="value1"} 11 |
| 1405 | test_counter_no_meta_metric_1_total{label1="value1"} 11 |
| 1406 | # HELP test_summary_1_duration_microseconds Test Summary Metric 1 |
| 1407 | # TYPE test_summary_1_duration_microseconds summary |
| 1408 | test_summary_1_duration_microseconds{label1="value1",quantile="0.5"} 4931.921 |
| 1409 | test_summary_1_duration_microseconds{label1="value1",quantile="0.9"} 4932.921 |
| 1410 | test_summary_1_duration_microseconds{label1="value1",quantile="0.99"} 4933.921 |
| 1411 | test_summary_1_duration_microseconds_sum{label1="value1"} 283201.29 |
| 1412 | test_summary_1_duration_microseconds_count{label1="value1"} 31 |
| 1413 | test_summary_no_meta_1_duration_microseconds{label1="value1",quantile="0.5"} 4931.921 |
| 1414 | test_summary_no_meta_1_duration_microseconds{label1="value1",quantile="0.9"} 4932.921 |
| 1415 | test_summary_no_meta_1_duration_microseconds{label1="value1",quantile="0.99"} 4933.921 |
| 1416 | test_summary_no_meta_1_duration_microseconds_sum{label1="value1"} 283201.29 |
| 1417 | test_summary_no_meta_1_duration_microseconds_count{label1="value1"} 31 |
| 1418 | # HELP test_histogram_1_duration_seconds Test Histogram Metric 1 |
| 1419 | # TYPE test_histogram_1_duration_seconds histogram |
| 1420 | test_histogram_1_duration_seconds_bucket{label1="value1",le="0.1"} 4 |
| 1421 | test_histogram_1_duration_seconds_bucket{label1="value1",le="0.5"} 5 |
| 1422 | test_histogram_1_duration_seconds_bucket{label1="value1",le="+Inf"} 6 |
| 1423 | test_histogram_1_duration_seconds_sum{label1="value1"} 0.00147889 |
| 1424 | test_histogram_1_duration_seconds_count{label1="value1"} 6 |
| 1425 | test_histogram_no_meta_1_duration_seconds_bucket{label1="value1",le="0.1"} 4 |
| 1426 | test_histogram_no_meta_1_duration_seconds_bucket{label1="value1",le="0.5"} 5 |
| 1427 | test_histogram_no_meta_1_duration_seconds_bucket{label1="value1",le="+Inf"} 6 |
| 1428 | test_histogram_no_meta_1_duration_seconds_sum{label1="value1"} 0.00147889 |
| 1429 | test_histogram_no_meta_1_duration_seconds_count{label1="value1"} 6 |
| 1430 | `), |
| 1431 | want: Series{ |
| 1432 | // Gauge |
| 1433 | { |
| 1434 | Labels: labels.Labels{ |
| 1435 | {Name: "__name__", Value: "test_gauge_metric_1"}, |
| 1436 | {Name: "label1", Value: "value1"}, |
| 1437 | }, |
| 1438 | Value: 11, |
| 1439 | }, |
| 1440 | { |
| 1441 | Labels: labels.Labels{ |
| 1442 | {Name: "__name__", Value: "test_gauge_no_meta_metric_1"}, |
| 1443 | {Name: "label1", Value: "value1"}, |
| 1444 | }, |
| 1445 | Value: 11, |
| 1446 | }, |
| 1447 | // Counter |
| 1448 | { |
nothing calls this directly
no test coverage detected
searching dependent graphs…