Skip to content

Commit 261d7ed

Browse files
committed
Fix script bundle creation and improve PEM/Kelvin heap dump collection for large clusters
Signed-off-by: Dom Del Nano <ddelnano@gmail.com> (cherry picked from commit 7538f3b)
1 parent ba0df5d commit 261d7ed

3 files changed

Lines changed: 71 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2018- The Pixie Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
17+
import px
18+
19+
# TODO(ddelnano): asid is unused until gh#2245 is addressed.
20+
def collect_pprofs(asid: int):
21+
df = px.GetAgentStatus()
22+
df.ip_address = px.pluck_array(px.split(df.ip_address, ":"), 0)
23+
df.hostname_by_ip = px.pod_id_to_node_name(px.ip_to_pod_id(df.ip_address))
24+
df.hostname = px.select(df.hostname_by_ip == "", df.hostname, df.hostname_by_ip)
25+
df = df[['asid', 'hostname']]
26+
heap_stats = px._HeapGrowthStacks()
27+
df = df.merge(heap_stats, how='inner', left_on='asid', right_on='asid')
28+
df.asid = df.asid_x
29+
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)