feat(oohelperd): add prometheus metrics (#897)

Closes https://github.com/ooni/probe/issues/2183

While there, avoid exposing nil values for optional fields of the
THResponse struct (i.e., "ip_info" and "tls_handshake").

While there, fix `measurexlite`'s `OperationLogger` test
and make it deterministic rather than racy.
This commit is contained in:
Simone Basso
2022-08-28 23:54:22 +02:00
committed by GitHub
parent 4241ee4bc1
commit dcdd8fb712
7 changed files with 98 additions and 5 deletions
+2 -2
View File
@@ -72,7 +72,7 @@ func TestNewOperationLogger(t *testing.T) {
}
const maxwait = 100 * time.Microsecond
ol := newOperationLogger(maxwait, logger, "antani%d", 0)
time.Sleep(4 * ol.maxwait)
ol.wg.Wait() // wait for the message to be emitted
ol.Stop(nil)
if len(lines) != 2 {
t.Fatal("unexpected number of lines")
@@ -100,7 +100,7 @@ func TestNewOperationLogger(t *testing.T) {
}
const maxwait = 100 * time.Microsecond
ol := newOperationLogger(maxwait, logger, "antani%d", 0)
time.Sleep(4 * ol.maxwait)
ol.wg.Wait() // wait for the message to be emitted
ol.Stop(io.EOF)
if len(lines) != 2 {
t.Fatal("unexpected number of lines")