Gateway Monitoring
Scrape Gateway metrics with Prometheus, add alerting rules, and import the Grafana dashboard.
The Gateway exposes Prometheus metrics at /metrics on port 9090.
Scrape metrics
Kubernetes
With the Prometheus Operator, enable either a PodMonitor or a ServiceMonitor in the Gateway Helm values. Add additionalLabels if your Prometheus instance selects monitors by label.
metrics: podMonitor: enabled: true additionalLabels: release: prometheusmetrics: serviceMonitor: enabled: true additionalLabels: release: prometheusEnable only one
Enabling both podMonitor and serviceMonitor scrapes each Gateway twice and duplicates every metric.
Check the Gateway targets on the Prometheus Status > Targets page.
VM
Add a static scrape target to your Prometheus configuration:
scrape_configs: - job_name: twingate-gateway static_configs: - targets: ["<GATEWAY_HOST>:9090"]Alerting rules
Kubernetes
With the Prometheus Operator installed, the Gateway Helm chart can create a PrometheusRule:
metrics: prometheusRule: enabled: true rules: - alert: TwingateGatewayHighHTTPErrorRate expr: | max_over_time( (sum by (code, method, type, resource_type) (rate(twingate_gateway_http_requests_total{code=~"5[0-9][0-9]"}[5m])) > bool 0.8)[2m:30s] ) > 0 for: 2m labels: severity: critical annotations: description: Gateway HTTP {{ $labels.code }} error rate is above 0.8 requests/sec over last 2 minutes for method={{ $labels.method }}, type={{ $labels.type }}, resource_type={{ $labels.resource_type }}.The chart’s values.yaml includes more example rules as comments.
VM
Add the same rules to a Prometheus alerting rules file under a groups entry:
groups: - name: twingate-gateway rules: - alert: TwingateGatewayHighHTTPErrorRate # same expr, for, labels, and annotations as aboveGrafana dashboard
Kubernetes
Enable the dashboard in the Gateway Helm values. The chart creates a ConfigMap that the Grafana dashboard sidecar discovers:
metrics: grafanaDashboard: enabled: true labels: grafana_dashboard: "1"If Grafana runs in a different namespace from the Gateway, configure Grafana to search that namespace. With the Grafana Helm chart, add it to sidecar.dashboards.searchNamespace.
VM
Import the dashboard JSON from the Gateway repository. In Grafana, go to Dashboards > New > Import and upload or paste the file.
Metrics reference
Core metrics
Available in every deployment.
| Name | Type | Description |
|---|---|---|
twingate_gateway_tcp_connection_duration_seconds | Histogram | Duration of client TCP connections |
twingate_gateway_tcp_connections_total | Counter | Client TCP connections processed |
twingate_gateway_active_tcp_connections | Gauge | Currently active client TCP connections |
twingate_gateway_client_authentication_total | Counter | HTTP CONNECT authentication attempts from the Twingate Client |
twingate_gateway_client_connection_duration_seconds | Histogram | Duration of HTTP CONNECT authentication attempts |
twingate_gateway_recorded_session_duration_seconds | Histogram | Duration of recorded sessions (Kubernetes and SSH) |
Kubernetes and Web App metrics
HTTP request metrics are labeled by resource_type (kubernetes or web_app) and by type (http, websocket, spdy, or unknown).
| Name | Type | Description |
|---|---|---|
twingate_gateway_http_active_requests | Gauge | Currently active HTTP requests |
twingate_gateway_http_request_duration_seconds | Histogram | HTTP request latency |
twingate_gateway_http_request_size_bytes | Histogram | Incoming HTTP request size |
twingate_gateway_http_requests_total | Counter | HTTP requests processed |
twingate_gateway_http_response_size_bytes | Histogram | Outgoing HTTP response size |
twingate_gateway_api_server_active_requests | Gauge | Currently active requests from the Gateway to the upstream server (the Kubernetes API server or the web app) |
twingate_gateway_api_server_request_duration_seconds | Histogram | Request-response latency between the Gateway and the upstream server. For streaming, WebSocket, and SPDY connections, measures setup time only. |
twingate_gateway_api_server_requests_total | Counter | Requests from the Gateway to the upstream server |
SSH-specific metrics are not yet available.
Runtime and scrape metrics
The Gateway also exports standard Go runtime (go_*) and process (process_*) metrics, and these scrape metrics:
| Name | Type | Description |
|---|---|---|
promhttp_metric_handler_errors_total | Counter | Internal errors in the metrics handler |
promhttp_metric_handler_requests_in_flight | Gauge | Scrapes in progress |
promhttp_metric_handler_requests_total | Counter | Scrapes, by HTTP status code |
Last updated