Skip to main content

Metrics reference

The Stacklok Enterprise platform components export metrics through OpenTelemetry. This page lists the metrics that the AI Gateway and its adapters, the Connector Gateway, and the Enterprise Manager emit, plus the build information metric they share. Platform metric names start with stacklok.<COMPONENT>., for example stacklok.ai_gateway. or stacklok.enterprise_manager.. A few metrics use standard OpenTelemetry semantic convention names, such as http.server.request.duration, or keep an older name.

For metrics from ToolHive components, such as the MCP server proxy, Virtual MCP Server (vMCP), and the Registry Server, see ToolHive observability.

Collect the metrics​

Each component exposes its metrics differently:

  • AI Gateway: serves Prometheus metrics on a dedicated port, 9464 by default (set with telemetry.metrics.port), pushes them over OpenTelemetry Protocol (OTLP), or both. Both are off by default. See Collect gateway telemetry. The scanning and guardrails adapters serve their own metrics; see Scanning adapter.
  • Connector Gateway: see Collect Connector Gateway telemetry.
  • Enterprise Manager: serves every metric in Prometheus format at /metrics on port 8080, and can also push them over OTLP when you set telemetry.otlp.enabled. The Enterprise Manager's gRPC NetworkPolicy (grpc.networkPolicy.enabled, required with directory.kek.enabled) doesn't admit port 8080. While it applies, add your own NetworkPolicy that lets Prometheus reach port 8080.

How names appear in Prometheus​

The tables list each metric's OpenTelemetry name. The Prometheus exporter renders that name for scraping with these rules:

  • Dots become underscores.
  • Counters gain _total. A name that already ends in _total keeps it once.
  • Unit s adds _seconds, and unit ms adds _milliseconds.
  • Gauges with unit 1 add _ratio.
  • Units in braces, such as {request}, describe what is counted and add no suffix.
  • Histograms appear as _bucket, _sum, and _count series.

For example, stacklok.ai_gateway.token.usage appears as stacklok_ai_gateway_token_usage_total, and stacklok.build_info appears as stacklok_build_info_ratio. Label names follow the same rule, so the label http.route appears as http_route.

Some series appear only after their first sample, and some come only from the Enterprise Manager replica that holds leadership. Aggregate these across pods with sum or max, and don't read a missing series as zero. Gauges that a periodic job updates keep reporting their last value, so a stalled job looks the same as a healthy one.

AI Gateway​

Every gateway metric carries the label implementation="v2", which separates it from the legacy AI Gateway when both report to the same metric store. Metrics from the scanning and guardrails adapters don't carry this label.

Requests and latency​

MetricTypeUnitLabelsDescription
http.server.request.durationHistogramshttp.request.method, http.route (the route template, or unknown_route), http.response.status_code, url.schemeDuration of every HTTP request on the gateway's ingress listener, including requests refused by authentication. Use it for request rate, latency, and error rate.
stacklok.ai_gateway.interaction.requestsCounter{request}outcome (success, rejected, error, client_disconnect)Counts each model interaction that reached governance, once, including requests refused before they reach a provider.
stacklok.ai_gateway.request.overheadHistogramsNoneTime the gateway itself adds to an interaction sent to a provider. A request refused before dispatch records nothing.
stacklok.ai_gateway.client.writeHistogramsNoneTime spent writing the response back to the client, for each interaction sent to a provider.
stacklok.ai_gateway.provider.durationHistogramsprovider, model, outcome (success, error)Time the provider took to answer, for interactions where it can be measured.
stacklok.ai_gateway.provider.time_to_first_byteHistogramsprovider, modelTime until the provider's first response frame arrived.
gen_ai.server.request.durationHistogramsgen_ai.system (the provider), gen_ai.request.modelEnd-to-end duration of each interaction sent to a provider, using the OpenTelemetry generative AI semantic conventions. Appears as gen_ai_server_request_duration_seconds.
gen_ai.server.time_to_first_tokenHistogramsgen_ai.system, gen_ai.request.modelTime until the first response frame, using the generative AI semantic conventions. Appears as gen_ai_server_time_to_first_token_seconds.
stacklok.ai_gateway.token.usageCounter{token}model, provider, token_type (input, output), cache_type (uncached, cache_read, cache_creation; input tokens only), plus any labels you map from headers or claimsTokens per finalized interaction when the provider reports usage. See Record token usage for header and claim labels.

Governance hooks and policy webhooks​

MetricTypeUnitLabelsDescription
stacklok.ai_gateway.hook.invocationsCounter{invocation}hook_name, hook_enforcement (required, observation), outcome (success, rejected, error, timeout)Counts each governance hook call that runs. After a required hook denies a request, later hooks record nothing.
stacklok.ai_gateway.hook.durationHistogramsSame as hook.invocationsDuration of each governance hook call.
stacklok.ai_gateway.governance.denialsCounter{denial}hook_name, hook_enforcement (required, observation), kind (denied, failed_closed, would_deny)Counts requests a required hook denied or failed closed on, and requests an observation hook would have denied.
stacklok.ai_gateway.webhook.invocationsCounter{invocation}webhook_name, webhook_phase (Request, Response), webhook_type (Validating, Observation), webhook_outcome (admit, deny, disabled, failure), webhook_reason (none, explicit_deny, timeout, connection_failure, malformed_response, receiver_error, disabled, internal_error, canceled)Counts each completed call to a webhook receiver, including transport errors. The built-in budgets and scanning hooks are receivers too, so this appears whenever either is on, as well as for policy webhooks you add.
stacklok.ai_gateway.webhook.durationHistogrammswebhook_name, webhook_phase, webhook_outcomeDuration of each completed webhook call. Appears as stacklok_ai_gateway_webhook_duration_milliseconds.
stacklok.ai_gateway.webhook.retriesCounter{retry}webhook_name, webhook_reasonCounts retries of a required webhook call. Observation calls are never retried.
stacklok.ai_gateway.webhook.invocations_droppedCounter{invocation}webhook_name, webhook_drop_reason (queue_full, droppable_reserve, droppable_worker_cap)Counts observation calls dropped before delivery. queue_full means no slot was free. Calls the gateway may drop are also shed once the queue is 75% full (droppable_reserve) or when their workers are at capacity (droppable_worker_cap).
stacklok.ai_gateway.webhook.probesCounter{probe}webhook_name, outcome (success, error), webhook_reasonCounts the reachability checks the gateway sends to each receiver at startup.
stacklok.ai_gateway.webhook.envelope_oversizeCounter{envelope}webhook_name, webhook_oversize_action (body_dropped, skipped, refused)Counts webhook payloads over the receiver's 16 MiB limit and what the gateway did with them.
stacklok.ai_gateway.webhook.observation_queue.depthGauge{fire}NoneNumber of observation calls waiting for delivery. Emitted only when at least one observation hook is configured.

For webhook configuration, see Enforce model request policy with webhooks.

Request inspection​

The gateway reads each request body to pass its content to governance hooks. These counters show requests it couldn't read completely.

MetricTypeUnitLabelsDescription
stacklok.ai_gateway.lens.unclassifiedCounter{request}provider, dialect (openai-chat, anthropic-messages, gemini-generate, openai-responses, gemini-stream), stage (initial, mutation, retarget), decision (proceeded, refused, skipped)Counts requests that contain content the gateway doesn't recognize, and whether the request proceeded.
stacklok.ai_gateway.lens.duplicate_membersCounter{request}provider, dialectCounts requests that repeat a field name in their body.
stacklok.ai_gateway.lens.unreadableCounter{request}provider, dialect, reason (projection_failed, depth_cut, budget_fold), stage (initial, mutation, retarget), decision (refused, hooks_ran, proceeded)Counts requests whose body the gateway couldn't read whole, and what it did next.

Workload trust​

These gauges exist only while the gateway is connected to the Enterprise Manager's directory. See Call the AI Gateway from Kubernetes workloads.

MetricTypeUnitLabelsDescription
stacklok.ai_gateway.workload_trust.installedGauge{trust}authority_id, revisionOne series with value 1 for each trusted issuer the gateway currently holds.
stacklok.ai_gateway.workload_trust.remaining_validityGaugesNoneSeconds until the gateway's copy of the trusted issuers expires; 0 once it has expired.

Scanning adapter​

The scanning adapter runs the PCI and PII controls. The scanning and guardrails adapters serve their metrics in Prometheus format on port 9090 by default; change it with scanning.adapter.metrics.port and guardrails.adapter.metrics.port. ai-gateway-v2.scanning.adapter.metrics.enabled and ai-gateway-v2.guardrails.adapter.metrics.enabled control this: leave them unset to follow the gateway's telemetry settings, set true to always serve metrics, or false to turn them off.

MetricTypeUnitLabelsDescription
stacklok.ai_gateway.pii.detectionsCounter{detection}entity_type, action (the action configured for that entity type, including shadow matches), source (the detection provider, such as presidio)Counts sensitive data matches in completed scans.
stacklok.ai_gateway.pii.requests_with_detectionsCounter{request}NoneCounts completed scans with at least one match.
stacklok.ai_gateway.pii.unscannedCounter{request}reason (guardrail_circuit_open, guardrail_provider_unavailable, guardrail_transport_error, guardrail_timeout, guardrail_input_too_large)Counts requests let through without a complete scan because the detection provider failed open. A rising rate means traffic is passing unscanned.
stacklok.ai_gateway.pii.extraction_failuresCounter{request}reason (no_content, cancelled), action (block)Counts requests with no readable content to scan, or whose scan was canceled.
aigw.presidio.analyze.durationHistogrammsdirection (request, response), outcome (success, canceled, error)Duration of each call to Presidio. Appears as aigw_presidio_analyze_duration_milliseconds.
stacklok.ai_gateway.presidio.analyze.inflightUpDownCounter{call}direction (request, response)Presidio calls in progress. Compare it with your Presidio worker count to spot queuing. Appears only after the first call.
stacklok.ai_gateway.presidio.analyze.queue_waitHistogramsdirectionTime each Presidio call waited before it started.
stacklok.ai_gateway.presidio.analyze.chunksHistogram{chunk}directionNumber of chunks for each text that was split before scanning.
stacklok.ai_gateway.ner_cache.lookupsCounter{lookup}result (hit, miss), direction (request, response)Counts result cache reads. Use the hit rate to measure avoided Presidio calls.
stacklok.ai_gateway.ner_cache.errorsCounter{error}op (get, set), error_type (timeout, connection, decode, oversize)Counts cache backend and decoding faults. A failed read becomes a miss and a normal Presidio call.
stacklok.ai_gateway.ner_cache.op_durationHistogramsop (get, set), outcome (success, error)Round-trip time of each cache operation.
stacklok.ai_gateway.ner_cache.withheld_writesCounter{write}direction (request, response)Counts scan results the adapter chose not to write to the cache.
circuitbreaker.requestsCounter{call}name (guardrails-provider:presidio), outcome (success, failure, rejected, canceled)Counts calls through the circuit breaker in front of Presidio. rejected means the breaker was open.
circuitbreaker.state_transitionsCounter{transition}name, from and to (closed, open, half_open)Counts circuit breaker state changes.
circuitbreaker.stateGaugeNonenameCurrent circuit breaker state: 0 closed, 1 open, 2 half open.

The ner_cache metrics appear only when the scan result cache is on.

Guardrails adapter​

The guardrails adapter runs prompt injection screening.

MetricTypeUnitLabelsDescription
stacklok.ai_gateway.guardrail.category_detectionsCounter{detection}category (the guardrail's filter category, or CUSTOM_WORD for word filters), policy_type (content, word, topic, sensitive_information, grounding)Counts each category behind a denied prompt. Allowed prompts record nothing.
stacklok.ai_gateway.guardrail.unscreenableCounter{request}reason (non_text_media, tool_result, unrecognized_part, unrecognized_shape, no_content)Counts content the guardrail couldn't screen, for allowed and denied prompts alike.
stacklok.ai_gateway.verdict_cache.lookupsCounter{lookup}result (hit, miss)Counts verdict cache reads, one per conversation window looked up.
stacklok.ai_gateway.verdict_cache.errorsCounter{error}op (get, set, dial), error_type (timeout, connection, decode, oversize)Counts verdict cache backend and decoding faults. A miss or a canceled request isn't a fault.
stacklok.ai_gateway.verdict_cache.op_durationHistogramsop (get, set), outcome (success, error)Round-trip time of each verdict cache operation. A miss counts as success.

The verdict_cache metrics appear only when the adapter screens conversations in windows of recent turns with a cache it can reach: set guardrails.screeningWindowTurns and turn on guardrails.verdictCache.enabled with a reachable Redis or Valkey.

Adapter configuration​

MetricTypeUnitLabelsDescription
processor_config_reload_totalCounterNoneresult (success, failure)Counts attempts by an adapter to reload its configuration after the ConfigMap changes. A reload with unchanged content records nothing.

Connector Gateway​

Connector Gateway metrics carry no implementation label.

MetricTypeUnitLabelsDescription
stacklok.connector_gateway.workload_identity.resolutionsCounter{resolution}outcome (success, token_rejected, identity_unresolved, directory_unavailable)Counts MCP requests from Kubernetes workloads whose token names a trusted issuer, by resolution result.
stacklok.connector_gateway.workload_trust.installedGauge{trust}authority_id, revisionOne series with value 1 for each trusted issuer the gateway currently holds.
stacklok.connector_gateway.workload_trust.remaining_validityGaugesNoneSeconds until the gateway's copy of the trusted issuers expires; 0 once it has expired.
stacklok.connector_gateway.connector_credential.promptsCounter{prompt}kind (url_elicitation, tool_error)Counts tool calls answered with a prompt for the user to sign in to a connector's provider.
stacklok.connector_gateway.policy_webhook.callsCounter{call}webhook (the configured webhook name), outcome (success, rejected, error), failure_policy (fail, ignore; set only when outcome is error)Counts calls to each matching policy webhook per tool call. Emitted only when policy webhooks are configured.
reauth_challenges_totalCounterNonecause (missing, unparseable, expired, other)Counts 401 responses that ask an MCP client to sign in again, by the reason the ID token failed.
refresh_grants_refused_totalCounterNonecause (missing, unparseable, expired, other, upstream_failed)Counts refresh token requests the gateway refused because only a new sign-in can fix the session.
upstream_credential_unavailable_totalCounterNonereason (no_refresh_token, session_expired, refresh_rejected, refresh_refused, refresh_transient), provider_id (the identity provider name), error_class (invalid_grant, row_removed, oauth_error, identity, no_refresh_token, timeout, network, other; set only for the three refresh_* reasons)Counts identity provider credentials left out of a request because they were missing, expired, or failed to refresh.
kek_unsealable_reads_totalCounterNoneversion (the key version number)Counts reads of stored credentials sealed under a key version that is no longer in the keyring. See Rotate the Connector Gateway encryption key.

The workload_identity and workload_trust metrics appear only while the gateway accepts service account workloads; see Accept service account workloads. The last four counters don't use the stacklok. prefix, and Prometheus shows them under the names listed.

Enterprise Manager​

Some Enterprise Manager work runs only on the replica that holds leadership. Metrics for that work, marked leader only below, appear only on that pod.

Configuration server​

The configuration server signs and serves client configuration to the Stacklok CLI.

MetricTypeUnitLabelsDescription
stacklok.enterprise_manager.config_server.requestsCounter{request}outcome (success, rejected, error), operation (jwks, oauth_metadata, config_fetch), error_type (signing_not_configured, marshal_failed, resource_not_configured, missing_client_type, invalid_client_type, missing_client_version, invalid_client_version, sign_failed; set only on failure)Counts configuration server requests by operation and result.
stacklok.enterprise_manager.config_server.jws_sign.durationHistogramsNoneTime to sign each configuration envelope.

Platform administration​

MetricTypeUnitLabelsDescription
stacklok.enterprise_manager.platform.admin_denialsCounter{request}reason (distributed_claim, not_granted)Counts 403 responses to requests that need platform administrator rights.

Directory​

Directory metrics use two prefixes: stacklok.directory. for managed secrets and the connector catalog that gateways read, and stacklok.enterprise_manager.directory. for everything else.

MetricTypeUnitLabelsDescription
stacklok.directory.catalog.omitted_recordsCounter{record}reason (dangling_reference, unmappable, reserved_secret_ref, primary_idp_unavailable), rpc (ListAllConnectors, GetConnectorForSetup, ListAllIdentityProviders)Counts stored records left out of a catalog read by a gateway. Increments only when a read drops at least one record.
stacklok.directory.managed_secrets.rowsGauge{row}kek_versionLeader only. Number of managed secrets sealed under each key version, updated after each rewrap pass (every 5 minutes by default).
stacklok.directory.managed_secrets.rewrap_sweepsCounter{cycle}outcome (success, error, degraded)Leader only. Counts passes that reseal managed secrets under the active key version.
stacklok.enterprise_manager.directory.connection.mutationsCounter{mutation}outcome (success, rejected, error), operation (create, update, delete)Counts API calls that create, update, or delete a user's connector connection.
stacklok.enterprise_manager.directory.connection.token_revocationsCounter{revocation}outcome (success, error, skipped), reason (none, unconfigured, other_gateway, unresolvable_provider, still_used), operation (disconnect, connector_delete)Counts decisions to revoke, or skip revoking, a provider token when a connection is removed.
stacklok.enterprise_manager.directory.connector.mutationsCounter{mutation}outcome (success, rejected, error), operation (create, update, delete)Counts API calls that create, update, or delete a connector.
stacklok.enterprise_manager.directory.group.policy_changesCounter{change}outcome, operation (grant, revoke)Counts grants and revocations of a directory group's access to a connector.
stacklok.enterprise_manager.directory.credential.resolutionsCounter{resolution}outcome (success, rejected, error), secret_kind (managed_secret, kubernetes_secret, vault_secret, unknown)Counts lookups of a connector's stored secret, successful ones included.
stacklok.enterprise_manager.directory.workload.resolutionsCounter{resolution}outcome (success, rejected, error), reason (invalid_coordinate, subject_mismatch, trust_unknown, trust_disabled, profile_mismatch, no_binding, account_inactive; set only when rejected)Counts attempts to resolve a Kubernetes workload to a service account.
stacklok.enterprise_manager.directory.scim.requestsCounter{request}outcome, operation (create, update, delete, patch), resource_type (user, group)Counts SCIM provisioning requests.
stacklok.enterprise_manager.directory.okta.cyclesCounter{cycle}issuer_id, outcome (success, rejected, error), reason (empty_desired_population, deactivation_ratio_exceeded; set only when rejected)Leader only. Counts Okta directory sync cycles. A rejected cycle means a safety check stopped the sync.
stacklok.enterprise_manager.directory.okta.cycle.durationHistogramsissuer_id, outcomeLeader only. Duration of each Okta sync cycle.
stacklok.enterprise_manager.directory.okta.mutationsCounter{write}issuer_id, operation (user_create, user_replace, user_activate, user_deactivate, group_create, group_replace, group_clear, member_add, member_remove)Leader only. Counts directory changes each Okta sync cycle makes.
stacklok.enterprise_manager.directory.okta.last_success.ageGaugesissuer_idLeader only. Seconds since the last successful Okta sync cycle. Absent until a cycle succeeds.
stacklok.enterprise_manager.directory.variable_group.reconciliationsCounter{cycle}outcome (success, error)Leader only. Counts passes that rebuild groups from group_variables attributes, hourly by default.
stacklok.enterprise_manager.directory.variable_group.skipped_valuesCounter{value}skip_reason (not_string, too_long, empty)Leader only. Counts user attribute values those passes couldn't turn into a group.

The managed_secrets metrics appear only when an encryption key is configured. Because managed_secrets.rows repeats its last value until the process exits, zero rows alone doesn't show that a key version can be retired. Check for zero rows together with a recent increase in managed_secrets.rewrap_sweeps with outcome="success", aggregating both across pods with max by because non-leader pods don't report them, and confirm that no replica started before the rotation is still running. For the full procedure, see Retire an old version. For group_variables, see Configure SCIM provisioning.

Budgets​

These metrics cover budgets and pricing for the AI Gateway.

MetricTypeUnitLabelsDescription
stacklok.enterprise_manager.budget.admit.decisionsCounter{decision}outcome (success, rejected, error), reason (budget_exhausted, ungoverned, unpriceable_model, disconnect_limit; set only when rejected)Counts budget checks on model requests and why a request was refused.
stacklok.enterprise_manager.budget.observation.durationHistogramsoutcomeTime to record the cost of each finished interaction.
stacklok.enterprise_manager.budget.usage_events.recordedCounter{event}outcomeCounts attempts to store a usage event.
stacklok.enterprise_manager.budget.pricing.entriesGauge{entry}managed_by (baseline, operator, unowned)Number of model prices by source, written at startup and whenever pricing changes.
stacklok.enterprise_manager.budget.pricing.rate_fallbacksCounter{fallback}price_format (anthropic, openai, google), rate (the fallback rule applied, such as cachedInput->input)Counts charges that used a fallback rate because the model's price lacks a specific rate.
stacklok.enterprise_manager.budget.disconnect_limit.disconnectsCounter{disconnect}usage (absent, input_only, with_output)Counts interactions the client canceled that count toward the disconnect limit, by how much usage the provider reported.
stacklok.enterprise_manager.budget.disconnect_limit.deniesCounter{request}mode (observe, enforce)Counts requests from a caller at the disconnect limit. In observe mode these are requests the limit would have refused.
stacklok.enterprise_manager.budget.disconnect_limit.resetsCounter{reset}NoneCounts administrator resets of a caller's disconnect count.

The disconnect limit caps how many canceled streams one user or service account can produce per period. Configure it with budgets.disconnectLimit under the Enterprise Manager's appConfig value.

Metering​

These metrics cover the tool call records behind the Tool Usage screen.

MetricTypeUnitLabelsDescription
stacklok.enterprise_manager.metering.ingest.requestsCounter{request}outcome (success, error)Counts batches of tool call records the Connector Gateway delivers.
stacklok.enterprise_manager.metering.ingest.batch_sizeHistogram{record}NoneNumber of records accepted in each successful batch.
stacklok.enterprise_manager.metering.checkpoint.durationHistogramsoutcome (success, error)Leader only. Duration of each periodic integrity checkpoint over stored records.

HTTP and gRPC servers​

MetricTypeUnitLabelsDescription
http.server.request.durationHistogramshttp.request.method, url.scheme (http, https), http.route (the route pattern, or unknown_route), http.response.status_codeDuration of every request to the Enterprise Manager's HTTP API, including requests refused by authentication.
http.server.active_requestsUpDownCounter{request}http.request.method, url.schemeHTTP requests in progress. Appears as http_server_active_requests.
rpc.server.durationHistogrammsrpc.system (grpc), rpc.service, rpc.method, rpc.grpc.status_codeDuration of every gRPC call, such as the gateways' directory lookups. Appears as rpc_server_duration_milliseconds.

The /metrics endpoint also serves the standard controller-runtime metrics for the Enterprise Manager's Kubernetes controllers, such as controller_runtime_reconcile_total, controller_runtime_reconcile_errors_total, and controller_runtime_reconcile_time_seconds.

Shared metrics​

MetricTypeUnitLabelsDescription
stacklok.build_infoGauge1component (enterprise_manager, registry), version, commitAlways 1. Identifies the running version of the Enterprise Manager and the Registry Server. The Registry Server emits it only when its metrics are on. Appears as stacklok_build_info_ratio.

Next steps​