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

@@ -12,6 +12,7 @@ import (
kitmiddleware "github.com/wahrwelt-kit/go-httpkit/httputil/middleware"
"lincodex/backend/internal/adapter/primary/http/api"
"lincodex/backend/internal/adapter/primary/http/observe"
)
// MediaType is the RFC 9457 media type of every public error response.
@@ -132,12 +133,15 @@ var definitions = map[api.ProblemCode]definition{
// New returns the problem response for code with its fixed status, title,
// and detail, and the request ID of ctx as trace_id. An unknown code yields
// the internal problem, so a caller cannot produce an undocumented status.
// The code is also recorded for the request log and metrics; it comes from
// the closed catalogue above, so the log field and metric label stay bounded.
func New(ctx context.Context, code api.ProblemCode) *api.ProblemStatusCode {
known, ok := definitions[code]
if !ok {
code = api.ProblemCodeInternal
known = definitions[code]
}
observe.RecordProblem(ctx, string(code))
response := api.Problem{
Type: typePrefix + string(code),
Title: known.title,