feat(observability): add product metrics for API, outbox and delivery
This commit is contained in:
1 parent
560724e2aa
commit
94488e2b57
51 files changed
+3655
-68
No files matched your search
@@ -0,0 +1,22 @@
|
||||
package observe
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type testKey struct{}
|
||||
|
||||
func TestEnsureSharesOneRequestAndRecordsTheProblem(t *testing.T) {
|
||||
RecordProblem(context.Background(), "internal") // no Request: no effect, no panic
|
||||
|
||||
ctx, first := Ensure(context.Background())
|
||||
nested, second := Ensure(context.WithValue(ctx, testKey{}, "other value"))
|
||||
if first != second {
|
||||
t.Fatal("Ensure() created a second Request for the same request")
|
||||
}
|
||||
RecordProblem(nested, "not_found")
|
||||
if got := first.ProblemCode(); got != "not_found" {
|
||||
t.Fatalf("ProblemCode() = %q, want not_found", got)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user