HTTP metrics
Every Containers scope records HTTP metrics (requests per minute, response time, error rate, and healthchecks) so you can see how it performs. Nullplatform publishes them to the provider you use, like Prometheus or Datadog.
How metrics are recorded
By default, every application pod runs an nginx container next to your application, called the traffic manager. It receives the scope's HTTP traffic and records each request. The logs-controller DaemonSet then publishes those metrics to your provider.
This works with any ingress, which is why it's the default.
Get metrics from Istio
If your scopes are exposed through the Istio gateway, Istio already sees every request. Turn on the gateway's telemetry, and the scope's metrics come straight from Istio:
- Smaller pods: each pod runs only your application, so it uses less CPU and memory
- Same metrics: same names, labels, and providers, with no metrics lost
- No extra infrastructure: the logs-controller you already run reads the gateway logs
You choose per scope. Scopes that use Istio metrics and scopes that use the traffic manager run side by side in the same cluster, and requests are never counted twice.
What changes with Istio metrics
Without the traffic manager, a few things are measured or handled at the gateway:
- Response time: measured at the gateway, so it includes the hop from the gateway to the pod
- Response size: the size the gateway sends, without nginx gzip compression
- Healthcheck metrics: generated from the pod's readiness status, with a response time of 0 ms
- Proxy limits: body size and timeouts are the gateway's
When the traffic manager is required
Istio metrics need the scope's traffic to go through the Istio gateway. Otherwise, the traffic manager is required, and a deployment set to use Istio fails with an explanatory error:
| Case | Why |
|---|---|
| Scopes exposed through a load balancer Ingress, like ALB | Traffic reaches the pods directly, without going through Istio |
Scopes on ARO clusters (GATEWAY_TYPE=aro_cluster) | Traffic goes through OpenShift Routes, not the Istio gateway |
Scopes with TRAFFIC_MANAGER_CONFIG_MAP set | The ConfigMap customizes the traffic manager |
Turn on Istio metrics
Follow these steps to turn on the Istio gateway telemetry and get a Containers scope's HTTP metrics from it.
Prerequisites
- Scopes exposed through the Istio gateway (HTTPRoute ingress)
nullplatform-basechart 2.45.0 or laterk8s-logs-controller1.8.0 or later- Containers scope (
nullplatform/scopes) 1.21.0 or later - An agent whose
npCLI is version 2.6 or later kubectlaccess to the cluster
1. Protect the namespaces
Skip this step if your nullplatform-base chart is 2.43.1 or later. Older charts create the gateways namespace, and sometimes nullplatform and nullplatform-tools, without a keep policy. The next upgrade deletes them with everything inside, like the gateways, the load balancer, and the certificates, and these steps upgrade the chart.
List the namespaces the release created:
helm -n nullplatform-tools get manifest nullplatform-base | grep -A3 'kind: Namespace' | grep 'name:'
Then annotate each one so the upgrade keeps it:
kubectl annotate namespace <namespace> helm.sh/resource-policy=keep --overwrite
If the gateways namespace was already deleted, see Recover a deleted gateways namespace.
2. Turn on the gateway access logs
Two pieces need it: istiod must know the np-gateway-access-log provider, which defines the access log format, and the logs-controller must read the gateway logs.
The versions below are the minimum that support Istio metrics. If you already run a later one, keep yours. Replace <istio-version> with the Istio version installed in your cluster.
- Terraform
- Helm
Set these variables and apply:
module "istio" {
source = "git::https://github.com/nullplatform/tofu-modules.git//infrastructure/commons/istio?ref=v9.19.0"
# ...
gateway_access_log_enabled = true
}
module "base" {
source = "git::https://github.com/nullplatform/tofu-modules.git//nullplatform/base?ref=v9.19.0"
# ...
nullplatform_base_helm_version = "2.45.0"
logging_controller_image_tag = "v1.8.0"
logging_istio_access_logs_enabled = true
}
-
Export the current istiod values:
helm get values istiod -n istio-system -o yaml > istiod-values.yaml -
Append the provider to
meshConfig.extensionProvidersinistiod-values.yaml. It's a list, so keep the providers you already have:meshConfig:
extensionProviders:
# ...your existing providers
- name: np-gateway-access-log
envoyFileAccessLog:
path: /dev/stdout
logFormat:
labels:
start_time: "%START_TIME%"
method: "%REQ(:METHOD)%"
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%"
protocol: "%PROTOCOL%"
code: "%RESPONSE_CODE%"
response_flags: "%RESPONSE_FLAGS%"
response_code_details: "%RESPONSE_CODE_DETAILS%"
connection_termination_details: "%CONNECTION_TERMINATION_DETAILS%"
upstream_transport_failure_reason: "%UPSTREAM_TRANSPORT_FAILURE_REASON%"
bytes_received: "%BYTES_RECEIVED%"
size: "%BYTES_SENT%"
response_time: "%DURATION%"
upstream_service_time: "%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%"
x_forwarded_for: "%REQ(X-FORWARDED-FOR)%"
agent: "%REQ(USER-AGENT)%"
request_id: "%REQ(X-REQUEST-ID)%"
authority: "%REQ(:AUTHORITY)%"
upstream_host: "%UPSTREAM_HOST%"
upstream_cluster: "%UPSTREAM_CLUSTER_RAW%"
upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%"
downstream_local_address: "%DOWNSTREAM_LOCAL_ADDRESS%"
remote: "%DOWNSTREAM_REMOTE_ADDRESS%"
requested_server_name: "%REQUESTED_SERVER_NAME%"
route_name: "%ROUTE_NAME%" -
Upgrade istiod with those values:
helm upgrade istiod istio/istiod -n istio-system --version <istio-version> -f istiod-values.yaml -
Turn on the gateway access logs in the
nullplatform-baserelease, with the logs-controller version that reads them:helm upgrade nullplatform-base nullplatform/nullplatform-base -n nullplatform-tools \
--version 2.45.0 --reuse-values \
--set logging.controller.image=public.ecr.aws/nullplatform/k8s-logs-controller:v1.8.0 \
--set logging.istioAccessLogs.enabled=true
3. Check the cluster
Confirm that each gateway has a Telemetry and that the logs-controller reads the gateway logs:
# One Telemetry per gateway
kubectl get telemetry -n gateways
# The logs-controller reads the gateway logs
kubectl -n nullplatform-tools get ds nullplatform-log-controller \
-o jsonpath='{.spec.template.spec.containers[0].env[?(@.name=="ISTIO_ACCESS_LOGS_ENABLED")].value}'
You should see np-gateway-access-log-gateway-public (and np-gateway-access-log-gateway-private if you have a private gateway), and true.
4. Set the scope to use Istio metrics
Create a scope configuration for the scope, or for the namespace, account, or organization that contains it:
{
"deployment": {
"traffic_proxy": "istio"
}
}
If the scope configuration form doesn't show a traffic_proxy setting, add it to the specification first.
To make Istio metrics the default for every scope an agent handles, set the TRAFFIC_PROXY=istio environment variable on the agent instead. A scope configuration takes precedence over it.
5. Deploy the scope
Start a new deployment. The change goes out with the scope's regular deployment strategy.
6. Check the scope
Confirm that the new pods run without the traffic manager. Replace <namespace> with the scope's Kubernetes namespace, which is nullplatform by default:
kubectl get pods -n <namespace> -l scope_id=<scope-id> \
-o custom-columns=NAME:.metadata.name,CONTAINERS:.spec.containers[*].name,PROXY:.metadata.labels.traffic_proxy
Each pod runs only the application container and has the traffic_proxy=istio label. Send traffic to the scope and check its metrics in the scope's Performance tab.
Roll back
Set traffic_proxy to nginx and deploy again. The scope goes back to recording metrics with the traffic manager.
Recover a deleted gateways namespace
-
Recreate the namespace and gateways:
helm -n nullplatform-tools upgrade nullplatform-base nullplatform/nullplatform-base --version <current-version> --reuse-values -
Recreate the certificates:
helm -n cert-manager upgrade cert-manager-config nullplatform/nullplatform-cert-manager-config --version <current-version> --reuse-values -
The load balancer comes back with a new hostname. Point the scopes'
DNSEndpointobjects (kubectl get dnsendpoint -A) at the new gateway address. Scope domains don't respond until you do.kubectl get gateway gateway-public -n gateways -o jsonpath='{.status.addresses[0].value}'
Next steps
- Scope configurations: set
traffic_proxyper organization, account, namespace, or scope - Configurable HTTP ports: main and additional HTTP ports of a Containers scope
- Scopes: logs and metrics: configure a custom telemetry provider for scopes