[{"data":1,"prerenderedAt":159},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fmain\u002Foperations":3},{"id":4,"title":5,"body":6,"description":146,"extension":147,"group":148,"meta":149,"navigation":150,"order":151,"path":152,"section":153,"seo":154,"source":155,"stem":156,"version":157,"__hash__":158},"docs\u002Fdocs\u002Fmain\u002Foperations.md","Operations and readiness",{"type":7,"value":8,"toc":135},"minimark",[9,14,24,28,47,51,73,77,96,100,107,111,114,118],[10,11,13],"h2",{"id":12},"structured-logs","Structured logs",[15,16,17,18,23],"p",{},"The application emits lifecycle and request logs by default. See ",[19,20,22],"a",{"href":21},"\u002Fdocs\u002Fmain\u002Flogging\u002F","Server output and logging"," for configuration, startup URLs and request IDs. Trace propagation and metrics below are independently opt-in.",[10,25,27],{"id":26},"health-and-readiness","Health and readiness",[15,29,30,34,35,38,39,42,43,46],{},[31,32,33],"code",{},"\u002Fhealthz"," reports that HTTP is serving. ",[31,36,37],{},"\u002Freadyz"," returns 200 only while the application is running and its managed readiness resources and named checks succeed; otherwise it returns a redacted 503. ",[31,40,41],{},"Registrar.Check(name, func(context.Context) error)"," registers an application-specific check. Checks share a one-second budget and must honor context. The GORM resource pings its pool; the gRPC server checks its transport lifecycle. Check downstream RPC availability explicitly with ",[31,44,45],{},"Clients.Ready",", rather than assuming a constructed client is connected.",[10,48,50],{"id":49},"propagate-trace-context","Propagate trace context",[15,52,53,56,57,60,61,64,65,68,69,72],{},[31,54,55],{},"observability.HTTP(metrics)"," is optional Gin middleware installed through ",[31,58,59],{},"config.Config.Middleware",". It accepts valid version-00 traceparent headers, preserves the trace ID and creates a new span ID. Invalid\u002Fduplicate headers start a fresh trace. ",[31,62,63],{},"observability.Traceparent(ctx)"," reads the current value. Optional ",[31,66,67],{},"observability\u002Fgrpc.Client"," and ",[31,70,71],{},"Server"," unary interceptors propagate it across services; credentials and arbitrary incoming metadata are not forwarded. Streaming trace propagation and an OTLP exporter are not implemented.",[10,74,76],{"id":75},"collect-metrics","Collect metrics",[15,78,79,82,83,86,87,90,91,95],{},[31,80,81],{},"observability.NewMetrics()"," is a managed resource. Counters track completed requests, errors, in-flight work and cumulative elapsed nanoseconds by fixed route\u002FRPC name. Unknown HTTP URLs share an unmatched label; raw URLs, user IDs and secrets are excluded. ",[31,84,85],{},"SnapshotContext"," copies measurements for a caller-owned exporter. Call ",[31,88,89],{},"SetReadiness(application.Ready)"," to include dependency readiness; without that callback, readiness represents the metrics resource's lifecycle only. Snapshots now include bounded cumulative duration histograms; opt-in Prometheus exporting and trace correlation are described in ",[19,92,94],{"href":93},"\u002Fdocs\u002Fmain\u002Fobservability\u002F","Metrics and tracing",". No external backend is required.",[10,97,99],{"id":98},"expose-example-metrics","Expose example metrics",[15,101,102,103,106],{},"The basic example enables tracing\u002Fcounters and exposes its JSON metrics route only with ",[31,104,105],{},"GONEX_EXPOSE_METRICS=1",". Protect that route at your deployment boundary if enabled. There is no exporter endpoint by default in framework applications.",[10,108,110],{"id":109},"drain-and-stop-services","Drain and stop services",[15,112,113],{},"Shutdown first stops accepting HTTP traffic and drains active requests within the shutdown budget, then closes managed resources in reverse order. gRPC uses graceful stop with a forced stop when its context expires. Signal handling belongs to the executable. HTTP deadline middleware cancels request contexts; handlers and dependency calls must honor them. A handler that ignores context cannot be forcibly interrupted safely.",[10,115,117],{"id":116},"verify-your-application","Verify your application",[15,119,120,121,124,125,68,127,129,130,134],{},"Run ",[31,122,123],{},"go tool gonex check"," from your generated project and test your public endpoints. Probe ",[31,126,33],{},[31,128,37],{}," separately, verify dependency-failure behavior, and allow shutdown time in your process manager. Framework regression tests belong in ",[19,131,133],{"href":132},"\u002Fdocs\u002Fmain\u002Fcontribute\u002Ftesting\u002F","Contribute: testing",".",{"title":136,"searchDepth":137,"depth":137,"links":138},"",2,[139,140,141,142,143,144,145],{"id":12,"depth":137,"text":13},{"id":26,"depth":137,"text":27},{"id":49,"depth":137,"text":50},{"id":75,"depth":137,"text":76},{"id":98,"depth":137,"text":99},{"id":109,"depth":137,"text":110},{"id":116,"depth":137,"text":117},"Configure readiness, graceful shutdown, request metrics, resource ownership and trace propagation.","md","SHIP YOUR APP",{},true,150,"\u002Fdocs\u002Fmain\u002Foperations","build",{"title":5,"description":146},"operations.md","docs\u002Fmain\u002Foperations","main","GK_eIurekF9Xvfo8acM_9YZ6iSh0CE8SXiZdGgz_QfI",1792521640618]