Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a check to verify if perf is installed on the system when gather perf #633

Merged
merged 10 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
33 changes: 25 additions & 8 deletions .github/workflows/build_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- master
push:
branches:
- master
- '*'
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

Expand Down Expand Up @@ -58,7 +58,19 @@ jobs:

convert-to-deb:
needs: build-rpm
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
strategy:
matrix:
include:
- distro: debian-11
image: debian:11
artifact_name: obdiag-deb-package-debian11
- distro: ubuntu-22.04
image: ubuntu:22.04
artifact_name: obdiag-deb-package-ubuntu2204

container:
image: ${{ matrix.image }}

steps:
- name: Checkout code
Expand All @@ -70,19 +82,24 @@ jobs:
name: obdiag-rpm-packages
path: .

- name: Install Alien
- name: Update and Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y alien
apt-get update && apt-get install -y \
alien \
dpkg-dev \
rpm2cpio \
cpio \
fakeroot

- name: Convert RPM to DEB
run: |
ls -lh oceanbase-diagnostic-tool-*.rpm
sudo alien -k --scripts oceanbase-diagnostic-tool-*.rpm
pwd
ls -lh ./oceanbase-diagnostic-tool_*.deb

- name: Upload DEB Artifact
uses: actions/upload-artifact@v3
with:
name: obdiag-deb-package
name: ${{ matrix.artifact_name }}
path: ./oceanbase-diagnostic-tool_*.deb
retention-days: 3
retention-days: 3
Empty file modified dev_helper.sh
100644 → 100755
Empty file.
26 changes: 19 additions & 7 deletions src/handler/gather/gather_perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,14 @@ def __handle_from_node(self, node, local_stored_path):
resp["error"] = "can't find observer"
return resp
for pid_observer in pid_observer_list:
if self.scope == "sample":
self.__gather_perf_sample(ssh_client, remote_dir_full_path, pid_observer)
elif self.scope == "flame":
self.__gather_perf_flame(ssh_client, remote_dir_full_path, pid_observer)
else:
self.__gather_perf_sample(ssh_client, remote_dir_full_path, pid_observer)
self.__gather_perf_flame(ssh_client, remote_dir_full_path, pid_observer)
if self.__perf_checker(ssh_client):
if self.scope == "sample":
self.__gather_perf_sample(ssh_client, remote_dir_full_path, pid_observer)
elif self.scope == "flame":
self.__gather_perf_flame(ssh_client, remote_dir_full_path, pid_observer)
else:
self.__gather_perf_sample(ssh_client, remote_dir_full_path, pid_observer)
self.__gather_perf_flame(ssh_client, remote_dir_full_path, pid_observer)
self.__gather_top(ssh_client, remote_dir_full_path, pid_observer)

zip_dir(ssh_client, "/tmp", remote_dir_name, self.stdio)
Expand Down Expand Up @@ -177,6 +178,17 @@ def __gather_perf_sample(self, ssh_client, gather_path, pid_observer):
except:
self.stdio.error("generate perf sample data on server [{0}] failed".format(ssh_client.get_name()))

def __perf_checker(self, ssh_client):
cmd = "command -v perf1"
result = ssh_client.exec_cmd(cmd)

if result:
self.stdio.verbose("perf is installed at [{0}] on server [{1}]".format(result, ssh_client.get_name()))
return True
else:
self.stdio.error("perf is not installed on server [{0}]. gather perf information will be skipped. Please install perf manually. ".format(ssh_client.get_name()))
return False

def __gather_perf_flame(self, ssh_client, gather_path, pid_observer):
try:
self.stdio.start_loading('gather perf flame')
Expand Down
Loading