mirror of
https://github.com/hanzoai/o11y.git
synced 2026-10-30 14:56:15 +00:00
o11y carried a second identity system: email/password sign-in, Google,
OIDC and SAML callbacks, self-registration, invites, reset-password
tokens, roles-on-users, SSO auth domains, and a pair of tokenizers that
minted and stored its own sessions. Hanzo IAM answers all of it, once,
at the edge. Two credential stores is one too many, and the one nobody
signs into is the one that rots.
What is left is Identity: WHO a request is, resolved from what the edge
asserted or from a service-account key, never issued here. The routes are
not merely unrouted — the handlers, stores, tables and templates behind
them are gone, and anonymous_test.go names each dead address so that
re-exempting one fails even though no route can come back.
The census moves with it: 366 addresses to 329, 353 typed ops to 319, ten
escape hatches to seven. zipdoc_gen.go loses the 34 descriptions whose
addresses left, because zip keys its doc registry by method and path, so
a description outliving its declaration attaches this module's prose to
whatever a host serves at that address. zipdoc_test.go pins that.
Cherry-picked from delete/o11y-identity 89854a68ae.
66 lines
3.1 KiB
Go
66 lines
3.1 KiB
Go
package app
|
|
|
|
import (
|
|
"github.com/hanzoai/o11y/pkg/http/middleware"
|
|
"github.com/hanzoai/o11y/pkg/http/routing"
|
|
)
|
|
|
|
// Single-route resources that do not justify a file of their own. 14 routes.
|
|
// Each mount below is called from the entry point that owns its router, so the
|
|
// registration order of the original single-file version is preserved.
|
|
//
|
|
// If any of these grows a second route, give it its own routes_<resource>.go.
|
|
//
|
|
// TWO DISPATCHES, ONE IMPLEMENTATION. These registrations stay: the standalone
|
|
// server has no native router to register an op on. The composed binary reaches
|
|
// the SAME handlers through the typed ops in the repo root's platform.go, which
|
|
// relay here — so the gates named below (OpenAccess, ViewAccess) stay the one
|
|
// place access is decided, and deleting either half drops one of the two
|
|
// deployments.
|
|
|
|
// mountMisc registers the root-router singletons. 11 routes:
|
|
// query, variables, event, usage, dependency_graph, version, health, disks,
|
|
// register, span_percentile, query_filter.
|
|
func (aH *APIHandler) mountMisc(router routing.Router, am *middleware.AuthZ) {
|
|
router.Get("/v1/o11y/query", am.ViewAccess(aH.queryMetrics))
|
|
|
|
// dashboards + dashboards/{id} + dashboards/{id}/lock are served by
|
|
// o11yapiserver/dashboard.go (formerly /api/v2/dashboards). Highest version wins.
|
|
router.Post("/v1/o11y/variables/query", am.ViewAccess(aH.queryDashboardVarsV2))
|
|
|
|
router.Post("/v1/o11y/event", am.ViewAccess(aH.registerEvent))
|
|
|
|
router.Get("/v1/o11y/usage", am.ViewAccess(aH.getUsage))
|
|
router.Post("/v1/o11y/dependency_graph", am.ViewAccess(aH.dependencyGraph))
|
|
|
|
router.Get("/v1/o11y/version", am.OpenAccess(aH.getVersion))
|
|
// features is served by o11yapiserver/flagger.go (formerly /api/v2/features).
|
|
router.Get("/v1/o11y/health", am.OpenAccess(aH.getHealth))
|
|
|
|
router.Get("/v1/o11y/disks", am.ViewAccess(aH.getDisks))
|
|
|
|
router.Post("/v1/o11y/span_percentile", am.ViewAccess(aH.O11y.Handlers.SpanPercentile.GetSpanPercentileDetails))
|
|
|
|
// Query Filter Analyzer api used to extract metric names and grouping columns from a query
|
|
router.Post("/v1/o11y/query_filter/analyze", am.ViewAccess(aH.QueryParserAPI.AnalyzeQueryFilter))
|
|
}
|
|
|
|
// mountFilterSuggestions registers query-builder filter suggestions on the
|
|
// shared /v1/o11y subrouter owned by RegisterQueryRangeV3Routes. 1 route.
|
|
func (aH *APIHandler) mountFilterSuggestions(subRouter routing.Router, am *middleware.AuthZ) {
|
|
subRouter.Get("/filter_suggestions", am.ViewAccess(aH.getQueryBuilderSuggestions))
|
|
}
|
|
|
|
// mountInfraOnboarding registers the k8s onboarding status probe. 1 route.
|
|
// Owns its own /v1/o11y/infra_onboarding subrouter, as before.
|
|
func (aH *APIHandler) mountInfraOnboarding(router routing.Router, am *middleware.AuthZ) {
|
|
infraOnboardingSubRouter := router.Group("/v1/o11y/infra_onboarding")
|
|
infraOnboardingSubRouter.Get("/k8s/status", am.ViewAccess(aH.getK8sInfraOnboardingStatus))
|
|
}
|
|
|
|
// mountMetric registers metric metadata on the /v1/o11y subrouter owned by
|
|
// RegisterQueryRangeV4Routes. 1 route.
|
|
func (aH *APIHandler) mountMetric(subRouter routing.Router, am *middleware.AuthZ) {
|
|
subRouter.Get("/metric/metric_metadata", am.ViewAccess(aH.getMetricMetadata))
|
|
}
|