Monitoring PrivX with OpenTelemetry
Telemetry is data that a system records about its own operation. Starting with PrivX 46, you can use OpenTelemetry metrics to monitor HTTP activity in PrivX services and measure how long their database operations take. These measurements can help you investigate slow responses, compare services across nodes, and identify when performance changed.
This article assumes you are familiar with OpenTelemetry concepts and know how to configure and operate an OpenTelemetry Collector. If you are new to OpenTelemetry, start with OpenTelemetry Concepts and the Collector overview. Refer to OpenTelemetry documentation for telemetry infrastructure setup, enablement, and additional environment variables for the metrics producer.
How PrivX Exports Metrics
Metric export is built into PrivX and is disabled by default. If you want to start collecting metrics, configure PrivX to send them to your OpenTelemetry Collector. If you do not need metrics, you can skip this configuration.
Once you configure metric export and enable recording, PrivX services collect HTTP and database measurements locally and periodically send aggregated metrics to your OpenTelemetry Collector using the OpenTelemetry Protocol (OTLP). The Collector forwards the metrics to your monitoring backend, where you can query them, build dashboards, and set up alerts without writing custom collection scripts. In a high-availability (HA) deployment, each metric identifies the PrivX service and node that produced it.
For example, you can set up an alert when HTTP requests take longer than usual. If the alert fires, compare request durations for the same service across nodes to see whether the slowdown affects one node or several. Then check whether database operations also slowed down during that period. If you contact support, the time range and affected services and nodes give the support team a starting point for the investigation.
Supported Metrics
PrivX supplies only measurements, not a monitoring product.
PrivX exports HTTP metrics for requests handled by instrumented PrivX services and a database metric for calls those services make to the database. The metric names, units, and attributes closely follow the OpenTelemetry Semantic Conventions.
| Metric | What it measures |
|---|---|
privx.http.server.request.duration | Time in seconds that a PrivX service spends handling an HTTP request. For a successful WebSocket upgrade, timing ends when the upgrade completes. |
privx.http.server.active_requests | Number of HTTP requests a PrivX service is currently handling. Established WebSocket sessions are excluded. |
privx.http.server.request.body.size | Declared size of the HTTP request body in bytes. PrivX records this metric when the request body length is known. |
privx.http.server.response.body.size | Size of the HTTP response body in bytes written by the service. This excludes headers and WebSocket messages. |
privx.db.client.operation.duration | Time in seconds that a PrivX service waits for a database call to return. This can include time spent acquiring a connection, communicating with the database, and executing the operation. |
You can group HTTP metrics by request method (http.request.method) and route (http.route). The route is the registered route template. Completed requests also have an HTTP status code (http.response.status_code).
You can group database measurements by operation name (db.operation.name) to see which operations slowed down. The duration reflects the time observed by the PrivX service, so an increase can also indicate a delay outside the database server.
Metric Export Configuration
Before enabling metric export, make sure your OpenTelemetry Collector is configured to receive metrics from PrivX over the OpenTelemetry Protocol (OTLP) and forward them to your monitoring backend. For an introduction to OpenTelemetry or help configuring the Collector, see OpenTelemetry Concepts and Collector Configuration.
The following OpenTelemetry SDK environment variables apply to both RPM-based and Kubernetes deployments. Use the following environment variables to configure metric export, then follow the instructions for your deployment:
| Environment Variable | Description |
|---|---|
OTEL_EXPORTER_OTLP_ENDPOINT | HTTP or HTTPS URL of the Collector's OTLP receiver. For OTLP over HTTP, specify the base URL. The exporter appends /v1/metrics. |
OTEL_EXPORTER_OTLP_PROTOCOL | Protocol used to send metrics. Set it to grpc for OTLP over gRPC or http/protobuf for OTLP over HTTP with Protobuf encoding. Choose the protocol your receiver accepts. |
OTEL_SDK_DISABLED | Set to true to disable the OpenTelemetry SDK even when a Collector endpoint is configured. On RPM-based installations, leave it unset or set it to false to allow export. The PrivX Helm chart sets it to true by default, so set it to false in your Helm values override to enable export. |
OTEL_EXPORTER_OTLP_CERTIFICATE | Path to a PEM-encoded CA certificate bundle that the service uses to verify the Collector's certificate. Leave it empty to use the system trust store. |
OTEL_METRIC_EXPORT_INTERVAL | Time between exports, in milliseconds. For example, 60000 exports metrics once per minute. |
OTEL_RESOURCE_ATTRIBUTES | Additional attributes that identify the source of the metrics. For example, service.namespace=privx-production distinguishes the production deployment from other deployments that use the same Collector. |
For additional settings, see OTLP Exporter Configuration and the SDK Environment Variable Specification.
Enabling Metric Export on RPM-Based PrivX Servers
-
On each PrivX Server that should export metrics, configure
/opt/privx/scripts/local-env. -
Set
OTEL_EXPORTER_OTLP_ENDPOINTto your Collector's OTLP receiver URL andOTEL_EXPORTER_OTLP_PROTOCOLto the protocol the receiver accepts. Make sureOTEL_SDK_DISABLEDis unset or set tofalse. -
Apply the configuration. Restart the affected PrivX services to load the settings. In an HA deployment, follow your usual procedure for restarting services across nodes.
Enabling Metric Export on Kubernetes
The PrivX Helm chart disables the OpenTelemetry SDK by default. To enable metric export, set OTEL_SDK_DISABLED to false and configure the Collector endpoint and protocol in privx.telemetry. These settings apply to the PrivX microservice containers.
-
Create a Helm values override file named
telemetry.yaml. The following example uses OTLP over gRPC and assumes that the containers trust the Collector's server certificate. Replace the endpoint with your Collector's address.privx:telemetry:OTEL_SDK_DISABLED: "false"OTEL_EXPORTER_OTLP_ENDPOINT: "https://otel-collector.observability.svc:4317"OTEL_EXPORTER_OTLP_PROTOCOL: "grpc"For OTLP over HTTP, set the protocol to
http/protobufand use the Collector's HTTP endpoint, typically on port4318. Specify the base URL inOTEL_EXPORTER_OTLP_ENDPOINT. The exporter appends/v1/metrics. -
If the Collector uses a private certificate authority (CA) that the containers do not trust, mount the CA certificate bundle in each PrivX microservice container that will export metrics. Set
privx.telemetry.OTEL_EXPORTER_OTLP_CERTIFICATEto the path of the PEM file inside the container. If the containers already trust the Collector's certificate, leave this setting empty to use the system trust store. -
Apply the override as part of your usual PrivX Helm upgrade. Keep the release name, namespace, chart, and values files used for your installation. Add
-f ./telemetry.yamlafter your existing values files. Helm rolls out new pods for the affected Deployments, and the PrivX services read the settings at startup.
If you later update only the contents of a mounted CA bundle or a referenced Secret, restart the affected Deployments so the services reload the certificate or credentials.
Pausing Telemetry
If you suspect that telemetry is causing an operational issue, you can pause metric recording while you investigate and resume it without restarting PrivX. This setting applies when metric export is configured and OTEL_SDK_DISABLED is unset or set to false.
In the PrivX Web UI, go to Administration → Settings → Global. In the Telemetry section, the Disable telemetry setting controls whether PrivX records new measurements:
- To pause recording, enable Disable telemetry and save the changes. Once the pause takes effect, PrivX skips new measurements but may finish recording measurements it has already started.
- To resume recording, clear Disable telemetry and save the changes. If
OTEL_SDK_DISABLEDis set totrue, clearing Disable telemetry in the PrivX Web UI cannot resume recording.
Troubleshooting Metrics Export
Verifying metrics export
- In the PrivX Web UI, go to Administration → Settings → Global. In the Telemetry section, make sure Disable telemetry is disabled.
- Send an HTTP request to a PrivX service configured to export metrics. Wait at least one configured export interval, then check whether the Collector received
privx.http.server.request.durationfrom that service. - Query your monitoring backend for metrics from the same service to confirm that the Collector forwards them.
Metrics have never appeared
PrivX services can start even if telemetry initialization fails. If the Collector receives no metrics after you follow the steps in Verifying Metric Export, check the following:
If the Collector receives no metrics:
- Make sure Disable telemetry is disabled.
- Check that the affected service has loaded the expected exporter settings. On Kubernetes, make sure the Helm override sets
OTEL_SDK_DISABLEDtofalseand the rollout has completed. - Check that the endpoint and protocol configured on the PrivX node match the Collector receiver. If you changed the exporter settings, restart the affected PrivX services to load the changes.
- Check that the PrivX node can reach the Collector. Review the PrivX service and Collector logs for connection or authentication errors.
Metrics stopped appearing
Check whether metric recording was paused and whether the affected PrivX node can reach the Collector. During a Collector outage, PrivX continues to operate and retries metric delivery for a limited time. Export resumes when the Collector becomes available, but measurements can be lost during the outage. If you see a gap in the metrics, check the PrivX service status separately.
Metrics stop after Collector address or credentials change
Check that the exporter settings on each affected PrivX node match the Collector receiver. If you updated the endpoint, protocol, certificates, or authentication headers, restart the affected PrivX services so they load the changes. Generate an HTTP request and check for metrics after the next export interval.
Metrics from different HA nodes appear together
In your monitoring tool, group metrics by both service name and instance identity. PrivX uses the hostname to identify the instance. If several deployments share a Collector, use a deployment namespace or logical node attribute to distinguish their metrics.