Charmed Pyroscope

Charmed Pyroscope is a solution that handles deployment, scaling, and Day 2 operations specific to Grafana Pyroscope, a distributed continuous profiling backend by Grafana Labs.

The solution consists of two charms which have distinct responsibilities:

Together, these two charms drive the Grafana Pyroscope application, and can be composed with other operators to deliver a complex application or service. In particular, you can integrate the coordinator charm with COS to collect and visualise continuous profiling data, enhancing your observability toolkit.

Grafana Pyroscope allows you to aggregate continuous profiling data from all your charmed applications with high availability, multi-tenancy, and durable storage.

This solution is intended to be:

  • used together with grafana-k8s;

  • used with other charms that will push their profiles into it for storage and querying.

Pyroscope Coordinator Charm

pyroscope-coordinator-k8s is the coordinator for a distributed Grafana Pyroscope deployment.

This operator is the main entry point to the distributed Pyroscope deployment. It is responsible for configuring the worker nodes and runs an Nginx instance to provide an unified access point to all incoming traffic.

Important

This charm must be deployed alongside at least one Pyroscope worker charm to function correctly; it is not functional on its own.

This charm is intended to be:

  • used together with the pyroscope-worker-k8s charm;

  • deployed alongside COS or COS Lite to extend the observability stack with continuous profiling capabilities.

Pyroscope Worker Charm

pyroscope-worker-k8s runs Pyroscope application components as configured by the pyroscope-coordinator-k8s charm

This operator is responsible for running and operating a single instance of the main pyroscope process. It also applies the configuration generated by the coordinator and monitors the process status.

A pyroscope-worker-k8s application will coordinate with other worker applications, mediated by their shared connection to a pyroscope-coordinator-k8s instance, to run a Grafana Pyroscope cluster.

Important

This charm only works in conjunction with the coordinator charm and is not functional when deployed in isolation.

This charm is intended to be:

  • used together with the pyroscope-coordinator-k8s charm;

  • deployed alongside COS or COS Lite to extend the observability stack with continuous profiling capabilities.

Charmed Pyroscope ingress model

Pyroscope accepts http traffic (e.g. to serve the UI) and grpc traffic (to ingest profiles) on the same port (4040).

Due to functional limitations in Traefik and Nginx, the same behaviour cannot be cleanly implemented using Traefik’s ingress or ingress-per-unit primitives, or through Nginx alone.

Therefore, we chose to split the incoming traffic into two streams: an http route for http requests, and a grpc route for all grpc traffic. The nginx workload deployed by the coordinator charm will proxy_pass/grpc_pass both streams to the same port on the worker node(s).

This also leaves us free to, in the future, expose them on different ingresses.

Therefore, we use the following routing strategy. For grpc traffic:

ingress(traefik):42424 --> coordinator(nginx):42424 --> worker:4040

and for http traffic:

ingress(traefik)/prefix --> coordinator(nginx):8080 --> worker:4040

Where the prefix is <model-name>-<coordinator-app-name>.

Example

If you have a deployment like:

Unit                 Workload  Agent  Address       Ports          Message
graf/0*              active    idle   10.1.232.148  
pyroscope-worker/0*  active    idle   10.1.232.155                 (all roles) ready.
pyroscope/0*         active    idle   10.1.232.153                 Degraded.
s3-integrator/0*     active    idle   10.1.232.176  
trfk/0*              active    idle   10.1.232.184                 Serving at 10.64.140.43

and you want to send grpc profiles to Pyroscope, you can do so:

  • directly to the worker, at 10.1.232.155:4040

  • via the coordinator, at 10.1.232.153:42424

  • over traefik, at 10.64.140.43:42424

and if you want to access the Pyroscope UI, you can browse:

  • directly to the worker, at 10.1.232.155:4040

  • via the coordinator, at 10.1.232.153:8080

  • over traefik, at 10.64.140.43:8080