PxL Scripts

PxL (Pixie Language) is Pixie’s query language for exploring telemetry data. It is based on Python and the Pandas DataFrame API.

Built-in Scripts

Pixie comes with many pre-built scripts accessible from the Live UI:

Cluster Overview

| Script | Description | |——–|β€”β€”β€”β€”-| | px/cluster | Service graph with HTTP traffic, latency, error, and throughput per service | | px/namespace | Pods and services in a namespace with service map | | px/namespaces | All namespaces with pod/service counts and resource consumption |

Service Performance

| Script | Description | |——–|β€”β€”β€”β€”-| | px/service | Latency, error, and throughput over time for a service | | px/services | LET (Latency, Error, Throughput) for all services in a namespace | | px/service_stats | LET over time with traffic summary | | px/service_edge_stats | Statistics about traffic between two services | | pxbeta/service_endpoints | Performance per logical endpoint (with URL wildcards) |

Request Tracing

| Script | Description | |——–|β€”β€”β€”β€”-| | px/http_data | Recent HTTP/2 requests in the cluster | | px/http_data_filtered | HTTP requests filtered by service, pod, path, status code | | px/dns_data | Recent DNS requests with request/response bodies |

Database Monitoring

| Script | Description | |——–|β€”β€”β€”β€”-| | px/mysql_data | Recent MySQL requests with full bodies | | px/mysql_stats | MySQL latency, error, and throughput by pod | | px/sql_queries | Latency per normalized SQL query | | px/pgsql_data / px/pgsql_stats | PostgreSQL monitoring | | px/redis_data / px/redis_stats | Redis monitoring | | px/cql_data / px/cql_stats | Cassandra monitoring |

Network Monitoring

| Script | Description | |——–|β€”β€”β€”β€”-| | px/net_flow_graph | Network flow graph between pods | | px/dns_flow_graph | DNS request flow graph | | bpftrace/tcp_drops | TCP drops between pod pairs | | bpftrace/tcp_retransmits | TCP retransmission counts |

Infrastructure

| Script | Description | |——–|β€”β€”β€”β€”-| | px/nodes | Resource usage (CPU, memory, network) for all nodes | | px/node | Detailed stats for a single node | | px/pod | Pod overview with HTTP metrics, resources, and CPU flamegraph | | px/pods | Overview of all pods in a namespace | | px/perf_flamegraph | Stack trace samples for application profiling | | px/jvm_stats | JVM stats for Java processes |

Script Editor

The Pixie Live UI includes a built-in script editor (Ctrl+E) for modifying and creating PxL scripts.

Example: Filtering HTTP errors

import px

# Get HTTP events
df = px.DataFrame('http_events', start_time='-5m')

# Access the service name
df.service = df.ctx['service']

# Filter to only catalogue service
df = df[df.service == 'px-sock-shop/catalogue']

# Filter to errors greater or equal to 400
df = df[df.resp_status >= 400]

px.display(df)

Example: MySQL error analysis

import px

df = px.DataFrame('mysql_events', start_time='-5m')

# Filter to error responses
df = df[df.resp_status == 3]

px.display(df)

Scratch Pad

The Scratch Pad allows running custom PxL scripts without modifying built-in ones. Access it from the Live UI navigation.

A script consists of two parts:

  • PxL Script β€” the data query logic (Python-like)
  • Vis Spec β€” the visualization specification (JSON)

results matching ""

    No results matching ""