Operations

Observability

What ulex exposes for monitoring: health, status, rate-limit headers, request and correlation ids, the audit log, webhook deliveries, directory sync runs, auth attempts, metrics names, and the alerts worth having.

#The three signals

SignalWhereAnswers
HealthGET /health, GET /environments/prod/healthis it up, and which dependency is slow
AuditGET /audit-events, GET /audit-events/exportwhat happened, who did it, is the log intact
Outcomeauth_attempt, directory_sync, webhook_delivery, deploymentdid the thing the caller asked for actually work

Health tells you the service is up. Audit tells you what was done. Outcome tells you whether it worked. You need all three; they fail independently and often only together do they explain an outage.

#Health and status

bash
curl -sS https://ulexid.com/api/v1/health | jq
json
{
  "healthy": true,
  "environment": "prod",
  "version": "2025.9.1",
  "region": "us-east-2",
  "uptime_seconds": 841233,
  "checks": [
    { "name": "api", "status": "pass", "latency_ms": 11 },
    { "name": "dynamodb", "status": "pass", "latency_ms": 3 },
    { "name": "kms", "status": "pass", "latency_ms": 7 },
    { "name": "queue", "status": "pass", "latency_ms": 2 },
    { "name": "directory_sync", "status": "pass", "latency_ms": 41 }
  ]
}
bash
curl -sS https://ulexid.com/api/v1/status | jq
json
{
  "status": "healthy",
  "environment": "prod",
  "version": "2025.9.1",
  "region": "us-east-2",
  "degradations": []
}
json
{
  "status": "degraded",
  "environment": "prod",
  "version": "2025.9.1",
  "region": "us-east-1",
  "degradations": [
    { "component": "directory_sync", "since": "2026-09-29T13:02:00.000Z", "impact": "scheduled polls are running up to 40 minutes late; manual syncs and inbound SCIM are unaffected" },
    { "component": "webhook_delivery", "since": "2026-09-29T12:18:00.000Z", "impact": "delivery attempts are queued but not dispatched; no events lost" }
  ]
}
statusMeaningLiveness probeReadiness probe
healthyall checks pass200200
degradeda non-critical check is failing200200
unavailablenot serving503503

Both endpoints are unauthenticated and unrate-limited. A probe must not need a credential, and a probe must never be the thing that gets rate-limited.

#Request tracing

Every response carries:

http
x-ulex-request-id: req_01M3PSW9R0175NAW62NYR403R8
x-ulex-correlation-id: onboard-acme-2026-09-29
x-ratelimit-limit: 1000
x-ratelimit-remaining: 847
x-ratelimit-reset: 1790693172
HeaderDirectionUse
X-Ulex-Request-Idrequestone value per call. Stored on the audit event, the auth_attempt, the webhook_delivery, and the log line
X-Ulex-Correlation-Idrequestone value per logical job, shared across retries, services, and agents
Idempotency-Keyrequestdedupe a write for 24 h. Not a tracing id
bash
# One logical job, many calls, one correlation id.
JOB="onboard-acme-$(date +%Y-%m-%d)"
for call in org domain connection user member; do
  curl -sS -X POST "$BASE/…" -H "$AUTH" -H "$JSON" \
    -H "X-Ulex-Correlation-Id: $JOB" \
    -H "X-Ulex-Request-Id: req_$(uuidgen)" \
    --data-binary @"payloads/$call.json"
done
bash
# Everything that job touched, in order.
curl -sS -G "$BASE/audit-events" -H "$AUTH" \
  --data-urlencode "correlation_id=$JOB" --data-urlencode 'order=asc' \
  | jq -r '.data[] | "\(.timestamp) \(.action) \(.outcome) \(.target.id) \(.request_id)"'
text
1790693112 organization.created  success  org_01M3PSV8HGTKQFCAYF9GDWGN3C  req_9f3c1a7b-…
1790693113 domain.verified      success  dom_01M3PSVCEGK9H35GZJK25HN08D  req_2d4e6f8a-…
1790693114 connection.activated  success  con_01M3PSVAG0QFJG99R0M5DXSR5A  req_0b2c4d6e-…
1790693115 user.created         success  usr_01M3PSV9GRT8GQGEG686AR1W9S  req_8f0a2c4e-…
1790693115 organization_membership.created  success  mem_01M3PSVDDRC5YN00BRZ8E7CNMT  req_6e8a0c2e-…

#Auth attempts

Every login, successful or not.

bash
curl -sS -G "$BASE/connections/$CON_ID/auth-attempts?limit=20" -H "$AUTH" | jq '.data[] | {outcome, stage, error_code, duration_ms, started_at}'
json
{
  "id": "job_01M3PSVQ68YGZREJKDVZSMQ64T",
  "object": "auth_attempt",
  "connection_id": "con_01M3PSVAG0QFJG99R0M5DXSR5A",
  "organization_id": "org_01M3PSV8HGTKQFCAYF9GDWGN3C",
  "strategy": "mock_sso",
  "outcome": "success",
  "stage": "complete",
  "user_id": "usr_01M3PSV9GRT8GQGEG686AR1W9S",
  "error_code": null,
  "duration_ms": 214,
  "ip_hash": "sha256:9c2e4a6b8d0f…",
  "correlation_id": "onboard-acme-2026-09-29",
  "started_at": "2026-09-29T14:45:12.000Z",
  "finished_at": "2026-09-29T14:45:12.000Z"
}
stageWhere it died
initiatedthe request was rejected before any redirect
redirectedthe IdP would not accept the AuthnRequest, or the callback never arrived
callbackthe assertion or code arrived and was rejected
validatedthe assertion verified; now mapping to a user
provisionedJIT creation or linking failed
mfawaiting on a second factor
completedone

A failure at redirected is an IdP-side configuration problem. A failure at callback is a signature, Destination, or clock problem. A failure at provisioned is a allow_create or join-policy problem. The stage tells you which team owns it.

ip_hash is a salted SHA-256, never the raw address.

#Directory sync runs

bash
curl -sS -G "$BASE/directories/$DIR_ID/syncs?limit=10" -H "$AUTH" | jq '.data[] | {state, trigger, stats, error, finished_at}'
json
{
  "id": "job_01M3PSWQ68YGZREJKDVZSMQ64T",
  "object": "directory_sync",
  "directory_id": "dir_01M3PSVBF8038RK2MW2N263Q2B",
  "state": "succeeded",
  "trigger": "scheduled",
  "stats": { "users_created": 0, "users_updated": 3, "users_deactivated": 1, "users_failed": 0, "groups_synced": 4 },
  "error": null,
  "started_at": "2026-09-29T14:45:00.000Z",
  "finished_at": "2026-09-29T14:45:04.000Z"
}

Alert on state: "partial" even though it is not failed. users_failed > 0 means people are missing.

#Webhook deliveries

bash
curl -sS -G "$BASE/webhooks/$WHK_ID/deliveries?status=failed&limit=20" -H "$AUTH" | jq '.data[] | {event, attempt, response_status, error, next_attempt_at}'

Alert on failure_count climbing on a single endpoint, not on individual failures — a retry is supposed to fail sometimes.

#Audit log

bash
curl -sS -G "$BASE/audit-events" -H "$AUTH" \
  --data-urlencode 'action_prefix=authentication.' \
  --data-urlencode 'outcome=failure' \
  --data-urlencode 'since=2026-09-29T00:00:00.000Z' \
  --data-urlencode 'limit=200' | jq '.data | group_by(.error_code) | map({code: .[0].error_code, n: length})'
json
[
  { "code": "access_denied", "n": 41 },
  { "code": "mfa_required", "n": 12 },
  { "code": "saml_signature_invalid", "n": 3 }
]

That single query tells you whether you have a permissions problem, an MFA rollout, or a certificate to rotate.

#Metrics

ulex publishes these as Prometheus metrics on GET /metrics on the internal port (not through the public API), namespaced ulex_.

MetricTypeLabelsWatch for
ulex_requests_totalcounterenv, method, route, statusa status class changing shape
ulex_request_duration_secondshistogramenv, routep99 creeping up
ulex_rate_limited_totalcounterenv, bucketsustained, not spiky
ulex_mcp_tool_invocations_totalcounterenv, tool, outcomeone tool dominating
ulex_mcp_tool_duration_secondshistogramenv, toola slow tool
ulex_auth_attempts_totalcounterenv, strategy, outcome, stageoutcome="failure" by stage
ulex_auth_duration_secondshistogramenv, strategyupstream IdP latency
ulex_sessions_activegaugeenvan unexplained drop
ulex_tokens_issued_totalcounterenv, grant_typerefresh_token spikes = a loop bug
ulex_directory_sync_runs_totalcounterenv, provider, statestate="partial"
ulex_directory_sync_duration_secondshistogramenv, providerpoll time creeping up
ulex_webhook_deliveries_totalcounterenv, event, statusstatus="dead_lettered"
ulex_webhook_failure_countgaugeenv, webhook_idapproaching 8
ulex_audit_events_totalcounterenv, category, outcomeoutcome="denied"
ulex_deployments_totalcounterenv, statestate="failed"
ulex_deployment_duration_secondshistogramenv
ulex_kms_operations_totalcounterenv, operationa KMS latency alarm
ulex_lambda_concurrent_executionsgaugeenvthrottling

#Alerts

AlertConditionSeverityWhy
Availabilitystatus == "unavailable" for 2 minpagenothing works
Auth failure spikerate(ulex_auth_attempts_total{outcome="failure"}[5m]) > 50 and > 5× the 7-day baselinepageeither an outage or a credential compromise
SAML signature failuresany saml_signature_invalidpagea certificate expired upstream
SCIM failuresany directory.sync_failed for 30 minticketdirectory is stale
Webhook endpoint near disableulex_webhook_failure_count >= 6ticketabout to go dark
JWKS cache missesulex_jwks_cache_miss_total > 100/minticketa consumer is not caching
Token endpoint saturationulex_rate_limited_total{bucket="token"} > 0 for 5 minticketa refresh loop
Deploy failuresulex_deployments_total{state="failed"} > 0ticket
KMS latencyp99 > 250 msticketenvelope encryption is on the hot path
outcome="denied" in the audit logany sustained riseticketa permissions regression
Note

Alert on the ratio, not the count. A tenant with 50,000 users will have more authentication.failed than one with 50, and both can be normal. Ratio against a baseline of the same tenant over the same hour of the week.

#What ulex deliberately does not emit

  • Prometheus metrics on the public API. /metrics is on the internal port. A public metrics endpoint hands an attacker your route names, your latency percentiles, and your traffic shape.
  • Traces per request. X-Ulex-Request-Id and the audit log give you correlation without the cost. OpenTelemetry sampling is available on the enterprise plan.
  • Raw PII in any telemetry. ip_hash and actor_hash are salted SHA-256. user_agent is truncated to 512 characters. Nothing emits an email address.

#Dashboards

Four panels answer every question you will be asked.

Availability — sum by (env) (rate(ulex_requests_total{status=~"5.."}[5m])) and ulex_request_duration_seconds{quantile="0.99"}.

Login health — sum by (strategy, outcome) (rate(ulex_auth_attempts_total[5m])) and the same by stage for failures.

Provisioning — ulex_directory_sync_runs_total by state, and ulex_webhook_deliveries_total by status.

Agent footprint — sum by (tool) (rate(ulex_mcp_tool_invocations_total[15m])) and ulex_mcp_tool_invocations_total{outcome="error"}. This one is how you find out that a fleet of agents is polling something in a loop.

#Reference