feat(observability): add product metrics for API, outbox and delivery

This commit is contained in:
shira committed 2026-10-06 19:48:15 +03:00
1 parent 560724e2aa
commit 94488e2b57
51 files changed
+3655 -68

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
package testutil
import "regexp"
var (
// emailLike matches an address anywhere in a text, for example inside a
// metric label value or a log line.
emailLike = regexp.MustCompile(`[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}`)
// uuidLike matches the canonical text form of a UUID, the form of user,
// delivery, attempt, and document IDs.
uuidLike = regexp.MustCompile(`[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}`)
)
// FindPersonalIdentifiers returns every email-like and UUID-like substring of
// text. Tests use it on a metrics exposition or a log to prove that no
// address or entity ID leaked into labels or messages.
func FindPersonalIdentifiers(text string) []string {
return append(emailLike.FindAllString(text, -1), uuidLike.FindAllString(text, -1)...)
}