- Home
- About Pixie
- Installing Pixie
- Using Pixie
- Tutorials
- Reference
This tutorial will demonstrate how to use the Pixie datasource plugin to visualize data from Pixie in Grafana.
A Kubernetes cluster with Pixie installed. If you do not have a cluster, you can create a minikube cluster and install Pixie using our install guides.
A Grafana server with the Pixie datasource plugin installed. You can find the installation directions here.
Before you can create a dashboard, you will need to add Pixie as a datasource:
Click on Data Sources. The data sources page opens showing a list of previously configured data sources for the Grafana instance.
Click Add data source to see a list of all supported data sources.
Search for "Pixie Grafana Datasource Plugin" and press the Select button. The datasource configuration page will open.
If you've used Pixie's Live UI or CLI, you should be familiar with the concept of open source PxL scripts. PxL scripts are used to query and visualize observability data collected by the Pixie platform. Developers use PxL scripts to monitor and debug a wide range of use-cases.
Several of Pixie's most popular PxL scripts have been made available as Grafana dashboards. You can find the dashboard JSON files here.
To import a Pixie dashboard:
Find Pixie dashboards at Grafana.com/dashboards.
(coming soon)
First, we'll need to create a new dashboard:
Click the New dashboard item under the Dashboards icon in the side menu.
In the new dashboard view, click Add an empty panel.
In the Edit Panel view, go to the Query tab.
Configure the query by selecting the Pixie Grafana Datasource Plugin from the data source selector.
Click the Save icon in the top right corner of your screen to save the dashboard.
The Pixie Datasource Plugin offers several pre-written scripts that you can use to quickly create dashboard panels. Let's look at a script that creates a time series graph for HTTP throughput per service.
This script creates a time series graph of HTTP throughput per service. You should see data plotted over time, but the exact numbers will vary depending on the traffic in your cluster.
You can apply filtering / grouping to the output columns of the pre-made scripts. Let's look at a script that creates a table of the raw HTTP requests flowing through your cluster.
From the Query editor tab, select the Raw HTTP Events (Long Format) option from the Script drop-down selector.
The description of the script in the Script drop-down menu tells you that this script should be used with the Table visualization panel. Select the Table panel type from the top right drop-down menu.
This script shows all of the HTTP requests flowing through your cluster.
Columns Display
selector.Groupby Columns
selector.In the image below, I've grouped the columns by unique HTTP request path (
req_path
) and selected the Add Aggregate Pair button to count the number of HTTP requests per unique request path.
Grafana offers dashboard variables to help you create more interactive dashboards.
If you have Pixie installed on more than one cluster, you can create a pixieCluster
dashboard variable to view data for any cluster in your Pixie organization. If you do not create a pixieCluster
dashboard variable, the plugin will default to showing data for the Cluster ID specified when configuring the Pixie Datasource.
To create a new dashboard variable for cluster name:
Navigate to the Grafana dashboard settings.
Select the Variables option in the side menu, then click the Add variable button.
Under the General section, name the variable pixieCluster
.
Under the Query Options section, select Clusters
for Fetchable Data
.
Click the Update button.
You can now select your cluster from the pixieCluster
drop-down menu above the panel:
Let's create a new dashboard variable for pod name and use it to filter the HTTP requests:
Following the same steps as above, navigate to the dashboard settings and add a new variable.
Under the General section, name the variable podName
.
Under the Query Options section, select Pods
for Fetchable Data
.
Click the Submit button to preview the pod values.
Click the Update button.
Modify the last few lines of the Raw HTTP Events (Long Format) query script to insert a filter using podName:
# Keep only the selected columns (and order them in the following order)df = df[[$__columns]]# Filter HTTP events to only include the ones made to the selected poddf = df[df.pod == '$podName']# Output the DataFramepx.display(df)
podName
drop-down menu above the panel will now filter the results to only include HTTP requests made to the selected pod.Use the Pod Metrics script to see high-level metrics for each pod in your cluster:
Use the Node Metrics script to see high-level metrics for each node in your cluster:
Use the Namespace Metrics script to see high-level metrics for each namespace in your cluster:
Use the Service Metrics script to see high-level metrics for each service in your cluster:
Use the HTTP Error Rate by Service (Wide Format) script to see HTTP error and total request count for each service in your cluster:
Use the Raw HTTP Requests script to see overall HTTP request throughput for your cluster:
Use the HTTP Service Graph script to see a graph of the HTTP requests in your cluster. Note: this node graph panel requires Grafana version 8.0.0+
.
Use the Network Connections script to see network connections to, from, and within your cluster. Note: this node graph panel requires Grafana version 8.0.0+
.
Use the Inbound Connections script to see inbound network connections to your cluster (connections made from external IPs). Note: this node graph panel requires Grafana version 8.0.0+
.
Use the Outbound Connections script to see outbound network connections from your cluster (connections made to external IPs). Note: this node graph panel requires Grafana version 8.0.0+
.
Writing scripts that work with the Pixie Grafana datasource plugin is a lot like writing a regular PxL script, with a few exceptions that are noted in the plugin reference docs.
When writing a custom script, it's often easiest to modify an existing script instead of starting from scratch. Start by identifying one of the pre-made scripts or dashboards that does something similar to what you're looking for. The Script selector in the Query editor tab shows descriptions for each pre-made script.
Once you've identified a script that does something similar to what you are aiming to do, edit the script and refresh the panel.
If you don't see any data in your graph, try:
Changing the current time range to the "Last 5 minutes".
Switching to the Table visualization to make sure that the query is returning some sort of data in table form.
Making sure that your cluster has HTTP traffic that Pixie can automatically trace. Instructions for installing a demo application with HTTP traffic can be found here. If you're using your own application, double check that Pixie supports the protocols for the traffic in your cluster.