diff --git a/prometheus/counter_test.go b/prometheus/counter_test.go index b2023f0..e11b97e 100644 --- a/prometheus/counter_test.go +++ b/prometheus/counter_test.go @@ -28,7 +28,7 @@ func testCounter(t tester) { steps: []func(g Counter){}, }, out: output{ - value: "{\"type\":\"counter\",\"value\":[]}", + value: `{"type":"counter","value":[]}`, }, }, { @@ -40,7 +40,7 @@ func testCounter(t tester) { }, }, out: output{ - value: "{\"type\":\"counter\",\"value\":[{\"labels\":{},\"value\":1}]}", + value: `{"type":"counter","value":[{"labels":{},"value":1}]}`, }, }, { @@ -52,7 +52,7 @@ func testCounter(t tester) { }, }, out: output{ - value: "{\"type\":\"counter\",\"value\":[{\"labels\":{},\"value\":2}]}", + value: `{"type":"counter","value":[{"labels":{},"value":2}]}`, }, }, { @@ -67,7 +67,7 @@ func testCounter(t tester) { }, }, out: output{ - value: "{\"type\":\"counter\",\"value\":[{\"labels\":{},\"value\":5}]}", + value: `{"type":"counter","value":[{"labels":{},"value":5}]}`, }, }, { @@ -85,7 +85,7 @@ func testCounter(t tester) { }, }, out: output{ - value: "{\"type\":\"counter\",\"value\":[]}", + value: `{"type":"counter","value":[]}`, }, }, { @@ -97,7 +97,7 @@ func testCounter(t tester) { }, }, out: output{ - value: "{\"type\":\"counter\",\"value\":[{\"labels\":{\"handler\":\"/foo\"},\"value\":19}]}", + value: `{"type":"counter","value":[{"labels":{"handler":"/foo"},"value":19}]}`, }, }, { @@ -112,7 +112,7 @@ func testCounter(t tester) { }, }, out: output{ - value: "{\"type\":\"counter\",\"value\":[{\"labels\":{\"handler\":\"/foo\"},\"value\":24}]}", + value: `{"type":"counter","value":[{"labels":{"handler":"/foo"},"value":24}]}`, }, }, { @@ -124,7 +124,7 @@ func testCounter(t tester) { }, }, out: output{ - value: "{\"type\":\"counter\",\"value\":[{\"labels\":{\"handler\":\"/foo\"},\"value\":1}]}", + value: `{"type":"counter","value":[{"labels":{"handler":"/foo"},"value":1}]}`, }, }, { @@ -136,7 +136,7 @@ func testCounter(t tester) { }, }, out: output{ - value: "{\"type\":\"counter\",\"value\":[{\"labels\":{\"handler\":\"/foo\"},\"value\":-1}]}", + value: `{"type":"counter","value":[{"labels":{"handler":"/foo"},"value":-1}]}`, }, }, { @@ -151,7 +151,7 @@ func testCounter(t tester) { }, }, out: output{ - value: "{\"type\":\"counter\",\"value\":[{\"labels\":{\"handler\":\"/foo\"},\"value\":28}]}", + value: `{"type":"counter","value":[{"labels":{"handler":"/foo"},"value":28}]}`, }, }, { @@ -166,7 +166,7 @@ func testCounter(t tester) { }, }, out: output{ - value: "{\"type\":\"counter\",\"value\":[{\"labels\":{\"handler\":\"/foo\"},\"value\":36}]}", + value: `{"type":"counter","value":[{"labels":{"handler":"/foo"},"value":36}]}`, }, }, { @@ -181,7 +181,7 @@ func testCounter(t tester) { }, }, out: output{ - value: "{\"type\":\"counter\",\"value\":[{\"labels\":{\"handler\":\"/foo\"},\"value\":27}]}", + value: `{"type":"counter","value":[{"labels":{"handler":"/foo"},"value":27}]}`, }, }, } diff --git a/prometheus/gauge_test.go b/prometheus/gauge_test.go index 8e7e5f1..ee3d425 100644 --- a/prometheus/gauge_test.go +++ b/prometheus/gauge_test.go @@ -28,7 +28,7 @@ func testGauge(t tester) { steps: []func(g Gauge){}, }, out: output{ - value: "{\"type\":\"gauge\",\"value\":[]}", + value: `{"type":"gauge","value":[]}`, }, }, { @@ -40,7 +40,7 @@ func testGauge(t tester) { }, }, out: output{ - value: "{\"type\":\"gauge\",\"value\":[{\"labels\":{},\"value\":1}]}", + value: `{"type":"gauge","value":[{"labels":{},"value":1}]}`, }, }, { @@ -52,7 +52,7 @@ func testGauge(t tester) { }, }, out: output{ - value: "{\"type\":\"gauge\",\"value\":[{\"labels\":{},\"value\":2}]}", + value: `{"type":"gauge","value":[{"labels":{},"value":2}]}`, }, }, { @@ -67,7 +67,7 @@ func testGauge(t tester) { }, }, out: output{ - value: "{\"type\":\"gauge\",\"value\":[{\"labels\":{},\"value\":5}]}", + value: `{"type":"gauge","value":[{"labels":{},"value":5}]}`, }, }, { @@ -85,7 +85,7 @@ func testGauge(t tester) { }, }, out: output{ - value: "{\"type\":\"gauge\",\"value\":[]}", + value: `{"type":"gauge","value":[]}`, }, }, { @@ -97,7 +97,7 @@ func testGauge(t tester) { }, }, out: output{ - value: "{\"type\":\"gauge\",\"value\":[{\"labels\":{\"handler\":\"/foo\"},\"value\":19}]}", + value: `{"type":"gauge","value":[{"labels":{"handler":"/foo"},"value":19}]}`, }, }, } diff --git a/prometheus/registry_test.go b/prometheus/registry_test.go index df0f1c2..b1d8379 100644 --- a/prometheus/registry_test.go +++ b/prometheus/registry_test.go @@ -282,7 +282,7 @@ func testDumpToWriter(t tester) { "foo": NewCounter(), }, }, - out: []byte("[{\"baseLabels\":{\"label_foo\":\"foo\",\"name\":\"foo\"},\"docstring\":\"metric foo\",\"metric\":{\"type\":\"counter\",\"value\":[]}}]"), + out: []byte(`[{"baseLabels":{"label_foo":"foo","name":"foo"},"docstring":"metric foo","metric":{"type":"counter","value":[]}}]`), }, { in: input{ @@ -291,7 +291,7 @@ func testDumpToWriter(t tester) { "bar": NewCounter(), }, }, - out: []byte("[{\"baseLabels\":{\"label_bar\":\"bar\",\"name\":\"bar\"},\"docstring\":\"metric bar\",\"metric\":{\"type\":\"counter\",\"value\":[]}},{\"baseLabels\":{\"label_foo\":\"foo\",\"name\":\"foo\"},\"docstring\":\"metric foo\",\"metric\":{\"type\":\"counter\",\"value\":[]}}]"), + out: []byte(`[{"baseLabels":{"label_bar":"bar","name":"bar"},"docstring":"metric bar","metric":{"type":"counter","value":[]}},{"baseLabels":{"label_foo":"foo","name":"foo"},"docstring":"metric foo","metric":{"type":"counter","value":[]}}]`), }, }