Authorization Tracing
Trace authorization decisions, permission resolver cache behavior, and admin role/permission mutations.
Authorization Tracing
Authorization tracing is opt-in. It only emits spans when the tracing module is installed and the relevant authorization tracing switches are enabled.
Enable authorization spans
use Vortos\Authorization\DependencyInjection\VortosAuthorizationConfig;
return static function (VortosAuthorizationConfig $config): void {
$config
->traceDecisions(true)
->traceResolver(true)
->traceAdminMutations(true);
};Decision spans
When traceDecisions(true) is enabled, PolicyEngine creates:
authorization.decisionAttributes include:
| Attribute | Meaning |
|---|---|
authorization.permission | Permission being checked |
authorization.user_id_hash | SHA-256 hash of the user ID |
authorization.scoped | Whether scoped permission checking is involved |
authorization.critical | Whether break-glass bypass is disabled for this decision |
authorization.allowed | Final boolean result |
authorization.reason | Decision reason |
User IDs are hashed before they are placed on spans.
Resolver spans
When traceResolver(true) is enabled, resolver work can emit:
authorization.resolver.database
authorization.resolver.cache_hit
authorization.resolver.cache_missDatabase resolver spans include counts for roles, expanded roles, permissions, and temporal grants.
Cache spans help answer:
- Did this request use the Redis permission cache?
- Did the cache entry become stale because role generations changed?
- Is the database resolver being hit more often than expected?
Admin mutation spans
When traceAdminMutations(true) is enabled, role and permission changes emit spans such as:
authorization.admin.user_role.assign
authorization.admin.user_role.remove
authorization.admin.role_permission.grant
authorization.admin.role_permission.revokeAttributes include hashed actor/target user IDs, role, and permission.
Disable noisy authorization spans
Authorization spans use the tracing module tag:
TracingModule::AuthorizationYou can disable the whole module:
use Vortos\Tracing\Config\TracingModule;
$config->disable(TracingModule::Authorization);This keeps other tracing modules active while suppressing authorization spans.
Reset Lifecycle
FrankenPHP-safe tracing, ResetInterface discovery, ServicesResetter, OpenTelemetry scope cleanup, and worker-mode rules.
Metrics
Counters, gauges, and histograms across HTTP, CQRS, messaging, cache, persistence, policy limits, and security — NoOp by default, Prometheus pull, StatsD push, or OpenTelemetry OTLP push when you need real numbers.