|
| 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']] |
0 commit comments