Charmed Parca docs - How to autoinstrument machine workloads with parca-agent

Parca-agent-operator deploys a whole-system profiler, parca-agent. When deployed on a machine model as a subordinate to a principal charm, parca-agent will:

  • Collect stack traces from all processes running on the machine including that of the principal charm as well as any other process running on the machine (e.g: systemd and snapd).
  • Push all collected profiles to a parca server

1. Configure a machine

In a machine controller:

juju add-model profiling
juju add-machine --constraints="virt-type=virtual-machine" --base ubuntu@24.04

:warning: The machine virt-type needs to be virtual-machine for the parca-agent snap to work.

See more: Parca agent · Issue #37 · canonical/parca-agent-operator · GitHub

:warning: The machine’s ubuntu base image needs to be ubuntu@24.04 for the parca-agent snap to work. This, because only kernels support eBPF probes. See more: parca-agent doesn't work on lxc VMs with ubuntu 22.04 base · Issue #47 · canonical/parca-agent-operator · GitHub

2. Deploy a principal test charm

We’ll be deploying ubuntu charm as a test machine charm, but any arbitrary principal charm could be deployed given that it can run on ubuntu@24.04.

juju deploy ubuntu --channel edge --base ubuntu@24.04 --to <machine_id>

3. Deploy parca-agent

juju deploy parca-agent --channel edge
juju integrate parca-agent ubuntu

4. Deploy parca-k8s

Then, deploy a parca-k8s server, which will later be configured to receive collected profiling data from the parca-agent.

In a Kubernetes controller:

juju add-model cos
juju deploy parca-k8s parca --channel edge

5. Integrate parca-agent and parca-k8s

In cos model:

juju offer parca:parca-store-endpoint

In profiling machine model:

juju consume <k8s_controller>:cos.parca
juju integrate parca parca-agent

:warning: grafana-agent does not support proxying profiles. For now, we’ll use cross-model relations to integrate parca-agent and parca-k8s directly until we have a charmed OTel collector available.

6. View profiling data

Switch to the Kubernetes model and get the IP address of your parca-k8s service.

PARCA_IP=$(juju status | grep 'parca/0\*' | awk '{print $4}')

Then, in your local browser, open Parca UI on $PARCA_IP:7070

You should see an output similar to the one below, where you can find profiles for all processes running on the machine: