Skip to content

Commit 87cbf8a

Browse files
authored
Fix script bundle creation and improve PEM/Kelvin heap dump collection for large clusters (#2247)
1 parent 7f19235 commit 87cbf8a

File tree

3 files changed

+54
-10
lines changed

3 files changed

+54
-10
lines changed

src/pxl_scripts/px/collect_heap_dumps.pxl renamed to src/pxl_scripts/px/collect_agent_heaps/collect_agent_heaps.pxl

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616

1717
import px
1818

19-
df = px.GetAgentStatus()
20-
df.ip_address = px.pluck_array(px.split(df.ip_address, ":"), 0)
21-
df.hostname_by_ip = px.pod_id_to_node_name(px.ip_to_pod_id(df.ip_address))
22-
df.hostname = px.select(df.hostname_by_ip == "", df.hostname, df.hostname_by_ip)
23-
df = df[['asid', 'hostname']]
24-
heap_stats = px._HeapGrowthStacks()
25-
df = df.merge(heap_stats, how='inner', left_on='asid', right_on='asid')
26-
df.asid = df.asid_x
27-
df = df[['asid', 'hostname', 'heap']]
28-
px.display(df)
19+
20+
# TODO(ddelnano): asid is unused until gh#2245 is addressed.
21+
def collect_pprofs(asid: int):
22+
df = px.GetAgentStatus()
23+
df.ip_address = px.pluck_array(px.split(df.ip_address, ":"), 0)
24+
df.hostname_by_ip = px.pod_id_to_node_name(px.ip_to_pod_id(df.ip_address))
25+
df.hostname = px.select(df.hostname_by_ip == "", df.hostname, df.hostname_by_ip)
26+
df = df[['asid', 'hostname']]
27+
heap_stats = px._HeapGrowthStacks()
28+
df = df.merge(heap_stats, how='inner', left_on='asid', right_on='asid')
29+
df.asid = df.asid_x
30+
return df[['asid', 'hostname', 'heap']]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
short: Collect Agent Heap Dumps
3+
long: Script useful for debugging kelvin and PEM memory footprint.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"variables": [
3+
{
4+
"name": "asid",
5+
"type": "PX_INT64",
6+
"description": "Whether to filter the results to a particular ASID",
7+
"defaultValue": "-1"
8+
}
9+
],
10+
"globalFuncs": [
11+
{
12+
"outputName": "collect_pprofs",
13+
"func": {
14+
"name": "collect_pprofs",
15+
"args": [
16+
{
17+
"name": "asid",
18+
"variable": "asid"
19+
}
20+
]
21+
}
22+
}
23+
],
24+
"widgets": [
25+
{
26+
"name": "Table",
27+
"position": {
28+
"x": 0,
29+
"y": 0,
30+
"w": 12,
31+
"h": 4
32+
},
33+
"globalFuncOutputName": "collect_pprofs",
34+
"displaySpec": {
35+
"@type": "types.px.dev/px.vispb.Table"
36+
}
37+
}
38+
]
39+
}

0 commit comments

Comments
 (0)