Skip to main content

Turn on telemetry

To send the traces and metrics of OpenLM Platform to your OpenTelemetry collector, set three values in your values file, apply them with Helm, and restart the services. Most of the time goes into the restart.

Before you begin​

Make sure you have the following:

  • OpenLM Platform installed with this guide: the commands load their variables from openlm-install.env and change your openlm-values.yaml, the files from step 4.
  • An OpenTelemetry collector: the services must reach it from inside the cluster, and it must accept OTLP over gRPC, by default on port 4317. If you don't have one, install the monitoring tools first. That page sets up a collector and sends you back here.

What OpenLM Platform sends​

After you turn telemetry on, each service sends:

  • Traces of the requests it receives and the background jobs it runs. A trace includes the service's calls to other services over HTTP, to MongoDB and to Redis.
  • Metrics: request counts and durations (http_server_request_duration_seconds), open connections (kestrel_active_connections), and .NET runtime figures such as memory, garbage collection and the thread pool.

Each service sends under its own name, for example OpenLM.SecurityService or AgentsHub. The same name appears in the _svc field of the service's log lines. Traces show it as <environment name>/<service name>, and so does the job label of the service's metrics in Prometheus, so you can tell installations apart when several send to the same collector.

The web UIs (the deployments whose names end in ui), the API gateway and a few other deployments don't send telemetry, so your tools don't list every deployment.

To see which calls a service records in its traces, read the Telemetry configuration is line in its log. For example, when it shows AddEntityFrameworkInstrumentation: False, the service's SQL Server queries don't appear in its traces. A long step with nothing inside it can then be time spent in the database.

Set the values​

In openlm-values.yaml, replace the openlm_telemetry_config_generic block from step 4 with the following block:

openlm_telemetry_config_generic:
configmap:
vars_list:
TELEMETRY__ENABLED: "true"
TELEMETRY__COLLECTORENDPOINT: "http://otel-collector.openlm-telemetry:4317"
TELEMETRY__ENVIRONMENTNAME: "production"

Each value does the following:

ValueSet it to
TELEMETRY__ENABLED"true" turns telemetry on, "false" turns it off. Keep the quotes.
TELEMETRY__COLLECTORENDPOINTYour collector's OTLP gRPC address, as the services reach it inside the cluster. The example is the collector from Install the monitoring tools.
TELEMETRY__ENVIRONMENTNAMEA short name for this installation, such as production or test. It appears in front of the service name in traces and in Prometheus.

Helm merges this block with the chart's other telemetry settings, so you don't need to copy them.

Apply the values​

Apply the changed values file with the same command as in step 6:

source ./openlm-install.env
helm upgrade --install openlm-platform openlm/openlm-platform \
--version "$OPENLM_VERSION" -n "$NS" -f openlm-values.yaml --timeout 60m

Like every upgrade, the command waits 10 to 30 minutes for the topic setup job.

Restart the services​

The services read the telemetry settings only when they start, and helm upgrade doesn't restart them when only the settings change. Restart them yourself after the command finishes.

If the cluster has free memory, restart all deployments at once:

kubectl -n "$NS" rollout restart deployment
kubectl -n "$NS" get pods -w

A rolling restart starts each new pod before it stops the old one, so it needs room for one extra copy of each service. When a new pod stays Pending and kubectl -n "$NS" describe pod <pod> shows Insufficient memory, the cluster doesn't have that room. Use the following loop instead. It deletes the pods of one deployment, waits until Kubernetes has replaced them and they're ready, and moves on to the next deployment:

for d in $(kubectl -n "$NS" get deploy -o name | grep -v tyk-gateway); do
sel=$(kubectl -n "$NS" get "$d" -o go-template='{{range $k, $v := .spec.selector.matchLabels}}{{$k}}={{$v}},{{end}}' | sed 's/,$//')
echo "== $d"
kubectl -n "$NS" delete pod -l "$sel" --wait=true
kubectl -n "$NS" wait pod -l "$sel" --for=condition=Ready --timeout=10m
done

The loop skips the API gateway, which doesn't send telemetry. Each service is unavailable while its new pod starts, so run the loop in a maintenance window. If an earlier rollout restart created pods that stay Pending, undo it for those deployments first, for example kubectl -n "$NS" rollout undo deployment/openlm-identity.

Check that data arrives​

Check the service logs first, then your monitoring tools:

  1. List the last telemetry line of each deployment:

    for x in $(kubectl -n "$NS" get deploy -o name); do
    printf '%s %s\n' "${x#*/}" "$(kubectl -n "$NS" logs "$x" 2>/dev/null | grep -o -E 'Telemetry:: Telemetry (enabled|disabled)' | tail -1)"
    done

    Most back-end services print Telemetry:: Telemetry enabled. Deployments that don't send telemetry print nothing after their name. The identity service logs Telemetry disabled and then Telemetry enabled a few seconds later when it starts: the last line counts.

  2. Use OpenLM Platform for a few minutes: sign in and open a few pages.

  3. In your monitoring tools, look for the service names. With the tools from Install the monitoring tools, open the OpenLM services dashboard in Grafana. Its Services sending traces panel counts the services that sent data.

Check

The services print Telemetry:: Telemetry enabled, and their names appear in your monitoring tools.

If a service prints Telemetry enabled but sends nothing, check that the collector address resolves and answers from inside the cluster, and read the collector's own log for refused connections.

Turn telemetry off​

To stop sending telemetry, set TELEMETRY__ENABLED back to "false", apply the values with Helm, and restart the services as described in Restart the services.

The documentation team might draft this page using a large language model. A technical writer reviews every page and verifies it against the product before publishing it. A human makes the final decision.