Init registers all metrics with the default prometheus registry. It is safe to call multiple times; registration happens only once.
()
| 250 | // Init registers all metrics with the default prometheus registry. |
| 251 | // It is safe to call multiple times; registration happens only once. |
| 252 | func Init() { |
| 253 | initOnce.Do(func() { |
| 254 | prometheus.MustRegister(HTTPRequestsTotal) |
| 255 | prometheus.MustRegister(HTTPRequestDuration) |
| 256 | prometheus.MustRegister(AuthEventsTotal) |
| 257 | prometheus.MustRegister(APIOperationsTotal) |
| 258 | prometheus.MustRegister(ActiveSessions) |
| 259 | prometheus.MustRegister(SecurityEventsTotal) |
| 260 | prometheus.MustRegister(GraphQLErrorsTotal) |
| 261 | prometheus.MustRegister(GraphQLLimitRejectionsTotal) |
| 262 | prometheus.MustRegister(GraphQLRequestDuration) |
| 263 | prometheus.MustRegister(DBHealthCheckTotal) |
| 264 | prometheus.MustRegister(ClientIDHeaderMissingTotal) |
| 265 | prometheus.MustRegister(FgaChecksTotal) |
| 266 | prometheus.MustRegister(FgaCheckDuration) |
| 267 | prometheus.MustRegister(FgaOperationsTotal) |
| 268 | }) |
| 269 | } |
| 270 | |
| 271 | // GraphQLOperationPrometheusLabel maps an operation name to a bounded-cardinality value |
| 272 | // suitable for Prometheus labels (never use raw client-supplied names as labels). |