authzai 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. agentic_auth/__init__.py +8 -0
  2. agentic_auth/_extras.py +24 -0
  3. agentic_auth/api/__init__.py +0 -0
  4. agentic_auth/api/deps.py +112 -0
  5. agentic_auth/api/errors.py +51 -0
  6. agentic_auth/api/responses.py +38 -0
  7. agentic_auth/api/service_deps.py +113 -0
  8. agentic_auth/api/v1/__init__.py +0 -0
  9. agentic_auth/api/v1/agents.py +88 -0
  10. agentic_auth/api/v1/audit.py +67 -0
  11. agentic_auth/api/v1/authorize.py +439 -0
  12. agentic_auth/api/v1/consent.py +21 -0
  13. agentic_auth/api/v1/decisions.py +43 -0
  14. agentic_auth/api/v1/enrollment.py +48 -0
  15. agentic_auth/api/v1/identity.py +97 -0
  16. agentic_auth/api/v1/jwks.py +21 -0
  17. agentic_auth/api/v1/manifests.py +68 -0
  18. agentic_auth/api/v1/scopes.py +22 -0
  19. agentic_auth/api/v1/token.py +203 -0
  20. agentic_auth/api/v1/transaction.py +94 -0
  21. agentic_auth/boundary/__init__.py +26 -0
  22. agentic_auth/boundary/guarantee.py +96 -0
  23. agentic_auth/cli/__init__.py +27 -0
  24. agentic_auth/cli/audit.py +130 -0
  25. agentic_auth/cli/drift.py +164 -0
  26. agentic_auth/cli/drift_render.py +148 -0
  27. agentic_auth/cli/identity.py +63 -0
  28. agentic_auth/cli/manifest.py +275 -0
  29. agentic_auth/config.py +182 -0
  30. agentic_auth/db.py +49 -0
  31. agentic_auth/embedded/__init__.py +427 -0
  32. agentic_auth/embedded/_schema.py +8 -0
  33. agentic_auth/embedded/_transport.py +39 -0
  34. agentic_auth/embedded/capabilities.py +34 -0
  35. agentic_auth/embedded/export.py +86 -0
  36. agentic_auth/embedded/idp.py +78 -0
  37. agentic_auth/embedded/store.py +240 -0
  38. agentic_auth/errors.py +145 -0
  39. agentic_auth/main.py +141 -0
  40. agentic_auth/models/__init__.py +70 -0
  41. agentic_auth/models/agent.py +58 -0
  42. agentic_auth/models/audit_decision.py +199 -0
  43. agentic_auth/models/compiled_policy.py +28 -0
  44. agentic_auth/models/manifest.py +96 -0
  45. agentic_auth/models/reconciliation_report.py +27 -0
  46. agentic_auth/models/sandbox_run.py +93 -0
  47. agentic_auth/models/session.py +63 -0
  48. agentic_auth/models/step_up_grant.py +106 -0
  49. agentic_auth/models/transaction_token.py +73 -0
  50. agentic_auth/models/trust_anchor.py +59 -0
  51. agentic_auth/models/types.py +95 -0
  52. agentic_auth/observability/__init__.py +370 -0
  53. agentic_auth/observability/config.py +137 -0
  54. agentic_auth/observability/context.py +128 -0
  55. agentic_auth/observability/ids.py +122 -0
  56. agentic_auth/observability/logs.py +191 -0
  57. agentic_auth/observability/pep.py +169 -0
  58. agentic_auth/observability/spans.py +225 -0
  59. agentic_auth/observability/surface.py +286 -0
  60. agentic_auth/observability/tracing.py +167 -0
  61. agentic_auth/redis.py +27 -0
  62. agentic_auth/repositories/__init__.py +0 -0
  63. agentic_auth/repositories/agents.py +96 -0
  64. agentic_auth/repositories/audit_decisions.py +152 -0
  65. agentic_auth/repositories/compiled_policies.py +72 -0
  66. agentic_auth/repositories/manifests.py +149 -0
  67. agentic_auth/repositories/reconciliation_reports.py +40 -0
  68. agentic_auth/repositories/sessions.py +41 -0
  69. agentic_auth/repositories/transaction_tokens.py +60 -0
  70. agentic_auth/repositories/trust_anchors.py +150 -0
  71. agentic_auth/runtime.py +81 -0
  72. agentic_auth/schemas/__init__.py +0 -0
  73. agentic_auth/schemas/agent.py +58 -0
  74. agentic_auth/schemas/audit.py +207 -0
  75. agentic_auth/schemas/authorize.py +205 -0
  76. agentic_auth/schemas/common.py +40 -0
  77. agentic_auth/schemas/consent.py +74 -0
  78. agentic_auth/schemas/dag.py +39 -0
  79. agentic_auth/schemas/edge_trace.py +166 -0
  80. agentic_auth/schemas/identity.py +152 -0
  81. agentic_auth/schemas/manifest.py +117 -0
  82. agentic_auth/schemas/manifest_api.py +38 -0
  83. agentic_auth/schemas/reconciliation.py +49 -0
  84. agentic_auth/schemas/token.py +122 -0
  85. agentic_auth/schemas/transaction.py +28 -0
  86. agentic_auth/sdk/__init__.py +114 -0
  87. agentic_auth/sdk/client.py +677 -0
  88. agentic_auth/sdk/context.py +95 -0
  89. agentic_auth/sdk/drift.py +118 -0
  90. agentic_auth/sdk/errors.py +147 -0
  91. agentic_auth/sdk/identity.py +162 -0
  92. agentic_auth/sdk/planes.py +362 -0
  93. agentic_auth/sdk/provenance.py +63 -0
  94. agentic_auth/services/__init__.py +0 -0
  95. agentic_auth/services/anchors.py +81 -0
  96. agentic_auth/services/audit.py +222 -0
  97. agentic_auth/services/audit_chain.py +144 -0
  98. agentic_auth/services/audit_cursor.py +55 -0
  99. agentic_auth/services/catalog_service.py +58 -0
  100. agentic_auth/services/chain_query.py +152 -0
  101. agentic_auth/services/dag_compiler.py +199 -0
  102. agentic_auth/services/decision_cache.py +123 -0
  103. agentic_auth/services/decision_history.py +71 -0
  104. agentic_auth/services/discovery.py +95 -0
  105. agentic_auth/services/drift.py +330 -0
  106. agentic_auth/services/edge_rules.py +62 -0
  107. agentic_auth/services/edge_trace.py +198 -0
  108. agentic_auth/services/enrollment.py +310 -0
  109. agentic_auth/services/enrollment_rules.py +80 -0
  110. agentic_auth/services/manifest_service.py +166 -0
  111. agentic_auth/services/metrics.py +419 -0
  112. agentic_auth/services/pdp.py +312 -0
  113. agentic_auth/services/policy_loader.py +255 -0
  114. agentic_auth/services/principal.py +143 -0
  115. agentic_auth/services/reconciler.py +119 -0
  116. agentic_auth/services/revocation.py +149 -0
  117. agentic_auth/services/sessions.py +231 -0
  118. agentic_auth/services/taint.py +204 -0
  119. agentic_auth/services/tokens/__init__.py +11 -0
  120. agentic_auth/services/tokens/act_chain.py +76 -0
  121. agentic_auth/services/tokens/exchange.py +319 -0
  122. agentic_auth/services/tokens/jwt_profile.py +362 -0
  123. agentic_auth/services/tokens/keys.py +117 -0
  124. agentic_auth/services/tokens/profile.py +167 -0
  125. agentic_auth/services/tokens/replay.py +53 -0
  126. agentic_auth/services/transactions.py +172 -0
  127. agentic_auth/sidecar/__init__.py +7 -0
  128. agentic_auth/sidecar/__main__.py +66 -0
  129. agentic_auth/sidecar/app.py +349 -0
  130. agentic_auth/sidecar/config.py +253 -0
  131. agentic_auth/sidecar/deny.py +108 -0
  132. agentic_auth/sidecar/enforce.py +640 -0
  133. agentic_auth/sidecar/identity.py +37 -0
  134. agentic_auth/verify/__init__.py +208 -0
  135. agentic_auth/verify/admit.py +131 -0
  136. agentic_auth/verify/anchors.py +250 -0
  137. agentic_auth/verify/canonical.py +228 -0
  138. agentic_auth/verify/grants.py +158 -0
  139. agentic_auth/verify/identity.py +111 -0
  140. agentic_auth/verify/replay.py +67 -0
  141. agentic_auth/verify/transaction.py +164 -0
  142. authzai-0.2.0.dist-info/METADATA +276 -0
  143. authzai-0.2.0.dist-info/RECORD +148 -0
  144. authzai-0.2.0.dist-info/WHEEL +5 -0
  145. authzai-0.2.0.dist-info/entry_points.txt +5 -0
  146. authzai-0.2.0.dist-info/licenses/LICENSE +202 -0
  147. authzai-0.2.0.dist-info/licenses/NOTICE +8 -0
  148. authzai-0.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,419 @@
1
+ """Prometheus metrics. The published catalogue is at
2
+ https://authzai.dev/reference/telemetry-surface.
3
+
4
+ **Labels never carry identities.** No agent name, user sub, session id, action id, or target
5
+ appears in a label value. That bounds cardinality, and it keeps audit identities behind the
6
+ audit-reader check: per-agent breakdowns come from ``GET /v1/audit/decisions``, not from
7
+ ``/metrics``.
8
+
9
+ Two metric sets exist. The control plane holds one process-wide set, swappable in tests via
10
+ ``_current``. ``drift check`` builds a fresh, isolated set per run and writes it to a textfile.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import os
16
+ from dataclasses import dataclass
17
+
18
+ from prometheus_client import CollectorRegistry, Counter, Gauge, Histogram, multiprocess
19
+
20
+ from agentic_auth import runtime
21
+
22
+ CHAIN_QUERY_BUCKETS = (0.001, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5)
23
+
24
+
25
+ @dataclass(frozen=True)
26
+ class ControlPlaneMetrics:
27
+ registry: CollectorRegistry
28
+ # outcome=allow|deny, enforced=true|false, target_kind=tool|agent
29
+ decisions: Counter
30
+ # reason=<DenyReason>
31
+ denials: Counter
32
+ # outcome=allow|deny
33
+ audit_write_failures: Counter
34
+ # result=complete|incomplete|not_found
35
+ chain_query_duration: Histogram
36
+ chain_queries: Counter
37
+ # complete=true|false, break=none|<ChainBreak>
38
+ chain_writes: Counter
39
+ # -- Phase 4: transaction tokens, taint, identity --
40
+ # source_class=tool|agent|reported|unknown
41
+ taint_blocks: Counter
42
+ # propagation=self|ancestor|sentinel
43
+ taint_marks: Counter
44
+ # result=minted|not_privileged|already_minted|tainted|invalid_token|too_large
45
+ transaction_mints: Counter
46
+ # outcome=enrolled|quarantined|rejected|key_revoked|idp_unavailable|reconciliation_rejected
47
+ enrollments: Counter
48
+ revocations: Counter
49
+ # where=authorize|exchange
50
+ revoked_hop_refusals: Counter
51
+ # cause=missing|invalid|wrong_agent|not_enrolled
52
+ exchange_pop_failures: Counter
53
+ # -- guarantee levels --------------------------------------------------------
54
+ # The operator view: how much traffic runs below full guarantee.
55
+ decisions_by_guarantee: Counter
56
+ # Non-zero deserves an alert: a degrade is never silent, and this is
57
+ # the signal that it happened.
58
+ guarantee_degrades: Counter
59
+ step_up_challenges: Counter
60
+ step_up_outcomes: Counter
61
+ step_up_resumptions: Counter
62
+ sandbox_runs: Counter
63
+ proposals_ratified: Counter
64
+ # -- Phase 6: the observability layer --
65
+ # The layer observing itself, so telemetry loss and telemetry posture are both visible.
66
+ # cause=malformed|absent|baggage_dropped
67
+ trace_context_rejected: Counter
68
+ # signal=span|log
69
+ telemetry_dropped: Counter
70
+ telemetry_identity_disclosure: Gauge
71
+
72
+
73
+ def build_control_plane_metrics(registry: CollectorRegistry | None = None) -> ControlPlaneMetrics:
74
+ registry = registry if registry is not None else CollectorRegistry()
75
+ return ControlPlaneMetrics(
76
+ registry=registry,
77
+ decisions=Counter(
78
+ "agentic_auth_decisions",
79
+ "Decisions rendered, counted once recorded",
80
+ ["outcome", "enforced", "target_kind"],
81
+ registry=registry,
82
+ ),
83
+ denials=Counter(
84
+ "agentic_auth_denials",
85
+ "Refusals returned to a caller, by reason",
86
+ ["reason"],
87
+ registry=registry,
88
+ ),
89
+ audit_write_failures=Counter(
90
+ "agentic_auth_audit_write_failures",
91
+ "Audit rows that could not be committed; allow means the call was blocked instead",
92
+ ["outcome"],
93
+ registry=registry,
94
+ ),
95
+ chain_query_duration=Histogram(
96
+ "agentic_auth_chain_query_duration_seconds",
97
+ "Delegation-chain query latency",
98
+ ["result"],
99
+ buckets=CHAIN_QUERY_BUCKETS,
100
+ registry=registry,
101
+ ),
102
+ chain_queries=Counter(
103
+ "agentic_auth_chain_queries",
104
+ "Delegation-chain query outcomes",
105
+ ["result"],
106
+ registry=registry,
107
+ ),
108
+ chain_writes=Counter(
109
+ "agentic_auth_chain_writes",
110
+ "Chain completeness decided at write time",
111
+ ["complete", "break"],
112
+ registry=registry,
113
+ ),
114
+ taint_blocks=Counter(
115
+ "agentic_auth_taint_blocks",
116
+ "TAINTED_INTO_PRIVILEGED refusals, by what introduced the taint",
117
+ ["source_class"],
118
+ registry=registry,
119
+ ),
120
+ taint_marks=Counter(
121
+ "agentic_auth_taint_marks",
122
+ "Contexts marked tainted, by how the mark propagated",
123
+ ["propagation"],
124
+ registry=registry,
125
+ ),
126
+ transaction_mints=Counter(
127
+ "agentic_auth_transaction_mints",
128
+ "POST /v1/token/transaction outcomes",
129
+ ["result"],
130
+ registry=registry,
131
+ ),
132
+ enrollments=Counter(
133
+ "agentic_auth_enrollments",
134
+ "Enrollment completions, by outcome",
135
+ ["outcome"],
136
+ registry=registry,
137
+ ),
138
+ revocations=Counter(
139
+ "agentic_auth_revocations",
140
+ "Revocations that changed state",
141
+ registry=registry,
142
+ ),
143
+ revoked_hop_refusals=Counter(
144
+ "agentic_auth_revoked_hop_refusals",
145
+ "Hops refused because an agent on the chain is revoked",
146
+ ["where"],
147
+ registry=registry,
148
+ ),
149
+ exchange_pop_failures=Counter(
150
+ "agentic_auth_exchange_pop_failures",
151
+ "actor_token failures at the exchange, by cause",
152
+ ["cause"],
153
+ registry=registry,
154
+ ),
155
+ decisions_by_guarantee=Counter(
156
+ "agentic_auth_decisions_by_guarantee",
157
+ "Every decision, by the guarantee level the enforcement point reported",
158
+ ["level", "outcome"],
159
+ registry=registry,
160
+ ),
161
+ guarantee_degrades=Counter(
162
+ "agentic_auth_guarantee_degrades",
163
+ "A session's reported guarantee level became weaker",
164
+ ["from_level", "to_level"],
165
+ registry=registry,
166
+ ),
167
+ step_up_challenges=Counter(
168
+ "agentic_auth_step_up_challenges",
169
+ "Step-up challenges raised, by the reason that raised them",
170
+ ["reason"],
171
+ registry=registry,
172
+ ),
173
+ step_up_outcomes=Counter(
174
+ "agentic_auth_step_up_outcomes",
175
+ "approved | declined | expired | replayed | out_of_ceiling",
176
+ ["outcome"],
177
+ registry=registry,
178
+ ),
179
+ step_up_resumptions=Counter(
180
+ "agentic_auth_step_up_resumptions",
181
+ "completed | partial | failed — the denial-UX signal the PRD asks for",
182
+ ["result"],
183
+ registry=registry,
184
+ ),
185
+ sandbox_runs=Counter(
186
+ "agentic_auth_sandbox_runs",
187
+ "Sandbox observation runs, by how they ended",
188
+ ["status"],
189
+ registry=registry,
190
+ ),
191
+ proposals_ratified=Counter(
192
+ "agentic_auth_proposals_ratified",
193
+ "Ratifications, labelled by whether the administrator edited the proposal "
194
+ "first. A high edited rate means the generator is missing things.",
195
+ ["edited"],
196
+ registry=registry,
197
+ ),
198
+ trace_context_rejected=Counter(
199
+ "agentic_auth_trace_context_rejected",
200
+ "Inbound trace context not used, by cause; absent is normal for an agent the "
201
+ "integrator does not control, malformed is a caller bug or an attempt",
202
+ ["cause"],
203
+ registry=registry,
204
+ ),
205
+ telemetry_dropped=Counter(
206
+ "agentic_auth_telemetry_dropped",
207
+ "Signals lost to queue overflow or a failing sink — telemetry loss reporting itself",
208
+ ["signal"],
209
+ registry=registry,
210
+ ),
211
+ telemetry_identity_disclosure=Gauge(
212
+ "agentic_auth_telemetry_identity_disclosure",
213
+ "1 when full identities are exported in traces and logs, 0 when pseudonymous",
214
+ registry=registry,
215
+ ),
216
+ )
217
+
218
+
219
+ _current: ControlPlaneMetrics | None = None
220
+
221
+
222
+ def get_metrics() -> ControlPlaneMetrics:
223
+ instance = runtime.override()
224
+ if instance is not None:
225
+ return instance.metrics
226
+ global _current
227
+ if _current is None:
228
+ _current = build_control_plane_metrics()
229
+ return _current
230
+
231
+
232
+ def exposition_registry() -> CollectorRegistry:
233
+ """What ``/metrics`` serves. With several worker processes, values live in
234
+ ``PROMETHEUS_MULTIPROC_DIR`` and must be collected from there."""
235
+ if os.environ.get("PROMETHEUS_MULTIPROC_DIR"):
236
+ registry = CollectorRegistry()
237
+ multiprocess.MultiProcessCollector(registry)
238
+ return registry
239
+ return get_metrics().registry
240
+
241
+
242
+ @dataclass(frozen=True)
243
+ class DriftMetrics:
244
+ registry: CollectorRegistry
245
+ # result=pass|drift|error
246
+ checks: Counter
247
+ # verdict=UNDECLARED_TOOL|UNDECLARED_DELEGATION|UNKNOWN_AGENT
248
+ undeclared_edges: Gauge
249
+ observed_edges: Gauge
250
+ unattributed_calls: Gauge
251
+
252
+
253
+ def build_drift_metrics() -> DriftMetrics:
254
+ """A fresh registry per ``drift check`` run, so a textfile holds exactly one run."""
255
+ registry = CollectorRegistry()
256
+ return DriftMetrics(
257
+ registry=registry,
258
+ checks=Counter(
259
+ "agentic_auth_drift_checks", "Drift check runs by result", ["result"], registry=registry
260
+ ),
261
+ undeclared_edges=Gauge(
262
+ "agentic_auth_drift_undeclared_edges",
263
+ "Undeclared edges found in this run",
264
+ ["verdict"],
265
+ registry=registry,
266
+ ),
267
+ observed_edges=Gauge(
268
+ "agentic_auth_drift_observed_edges",
269
+ "Distinct attributed edges in the trace",
270
+ registry=registry,
271
+ ),
272
+ unattributed_calls=Gauge(
273
+ "agentic_auth_drift_unattributed_calls",
274
+ "Calls that could not be attributed to an agent",
275
+ registry=registry,
276
+ ),
277
+ )
278
+
279
+
280
+ @dataclass(frozen=True)
281
+ class VerifierMetrics:
282
+ """Emitted by ``agentic_auth.verify.Verifier`` when the integrator supplies a registry.
283
+
284
+ Lives here so the metric names have one home, but ``agentic_auth.verify`` must not import this
285
+ module (it would pull in the control plane); the verifier defines the same names itself
286
+ and this class is the documented mirror the tests compare against.
287
+ """
288
+
289
+ registry: CollectorRegistry
290
+ # result=admitted|<refusal reason>
291
+ admissions: Counter
292
+ # cause=target_mismatch|params_mismatch|replay|expired|malformed|store_unavailable
293
+ transaction_rejections: Counter
294
+ identity_view_age: Gauge
295
+
296
+
297
+ def build_verifier_metrics(registry: CollectorRegistry | None = None) -> VerifierMetrics:
298
+ registry = registry if registry is not None else CollectorRegistry()
299
+ return VerifierMetrics(
300
+ registry=registry,
301
+ admissions=Counter(
302
+ "agentic_auth_admissions", "admit() outcomes", ["result"], registry=registry
303
+ ),
304
+ transaction_rejections=Counter(
305
+ "agentic_auth_transaction_rejections",
306
+ "Transaction-token rejections by cause",
307
+ ["cause"],
308
+ registry=registry,
309
+ ),
310
+ identity_view_age=Gauge(
311
+ "agentic_auth_identity_view_age_seconds",
312
+ "Seconds since the anchor view was last refreshed",
313
+ registry=registry,
314
+ ),
315
+ )
316
+
317
+
318
+ # ---------------------------------------------------------------------------------------
319
+ # Enforcement point
320
+ #
321
+ # Before this, nothing under agentic_auth/sidecar/ emitted anything: a sidecar that had been
322
+ # silently
323
+ # forwarding every call looked exactly like a healthy one. These are the series that tell the
324
+ # difference.
325
+ #
326
+ # The same labels-never-carry-identities rule applies. Every label below has a closed,
327
+ # enumerable value set (agentic_auth/observability/surface.py), which is what bounds cardinality
328
+ # regardless of how many agents, sessions or targets the deployment has.
329
+
330
+ PEP_STAGE_BUCKETS = CHAIN_QUERY_BUCKETS
331
+
332
+
333
+ @dataclass(frozen=True)
334
+ class PepMetrics:
335
+ registry: CollectorRegistry
336
+ # outcome=allowed|blocked|observed_would_block. `observed_would_block` is forwarded but
337
+ # refused on the merits — never folded into `allowed`, or observe mode would read as a
338
+ # working guardrail.
339
+ calls: Counter
340
+ # cause=policy|pdp_unreachable|exchange_unreachable|mint_unreachable|body_too_large|
341
+ # unresolvable_call
342
+ # The most operationally important series in the layer: `policy` means the guardrail
343
+ # worked, `pdp_unreachable` means it is fail-closing because it is broken. From the
344
+ # agent's side both are just a refused call.
345
+ blocks: Counter
346
+ # stage=decide|exchange|mint|upstream
347
+ stage_duration: Histogram
348
+ # Guardrail-added time = total - upstream. Recorded separately from the stages so the two
349
+ # cross-check: a divergence means unaccounted time inside the PEP.
350
+ overhead: Histogram
351
+ # Always 1 while serving. Liveness is absent() over this, not a value.
352
+ up: Gauge
353
+ # mode=enforcing|observing. Always 1. The unambiguous answer to "is this thing enforcing".
354
+ info: Gauge
355
+ trace_context_rejected: Counter
356
+ telemetry_dropped: Counter
357
+ telemetry_identity_disclosure: Gauge
358
+
359
+
360
+ def build_pep_metrics(registry: CollectorRegistry | None = None) -> PepMetrics:
361
+ """One registry per PEP process, served at ``GET /__agentic/metrics``."""
362
+ registry = registry if registry is not None else CollectorRegistry()
363
+ return PepMetrics(
364
+ registry=registry,
365
+ calls=Counter(
366
+ "agentic_auth_pep_calls",
367
+ "Proxied calls by what the enforcement point did",
368
+ ["outcome"],
369
+ registry=registry,
370
+ ),
371
+ blocks=Counter(
372
+ "agentic_auth_pep_blocks",
373
+ "Blocked calls by cause; separates a policy refusal from the guardrail being unable "
374
+ "to reach policy",
375
+ ["cause"],
376
+ registry=registry,
377
+ ),
378
+ stage_duration=Histogram(
379
+ "agentic_auth_pep_stage_duration_seconds",
380
+ "Per-hop time by stage",
381
+ ["stage"],
382
+ buckets=PEP_STAGE_BUCKETS,
383
+ registry=registry,
384
+ ),
385
+ overhead=Histogram(
386
+ "agentic_auth_pep_overhead_seconds",
387
+ "Time the guardrail added to a call: total minus the upstream call",
388
+ buckets=PEP_STAGE_BUCKETS,
389
+ registry=registry,
390
+ ),
391
+ up=Gauge(
392
+ "agentic_auth_pep_up",
393
+ "1 while this enforcement point is serving",
394
+ registry=registry,
395
+ ),
396
+ info=Gauge(
397
+ "agentic_auth_pep_info",
398
+ "1, labelled with the enforcement mode and version",
399
+ ["mode", "version"],
400
+ registry=registry,
401
+ ),
402
+ trace_context_rejected=Counter(
403
+ "agentic_auth_trace_context_rejected",
404
+ "Inbound trace context not used, by cause",
405
+ ["cause"],
406
+ registry=registry,
407
+ ),
408
+ telemetry_dropped=Counter(
409
+ "agentic_auth_telemetry_dropped",
410
+ "Signals lost to queue overflow or a failing sink",
411
+ ["signal"],
412
+ registry=registry,
413
+ ),
414
+ telemetry_identity_disclosure=Gauge(
415
+ "agentic_auth_telemetry_identity_disclosure",
416
+ "1 when full identities are exported in traces and logs, 0 when pseudonymous",
417
+ registry=registry,
418
+ ),
419
+ )