mirror of
https://github.com/infiniteCable2/openpilot.git
synced 2026-08-05 00:05:57 +08:00
tools: remove sentry logging (#37836)
This commit is contained in:
-16
@@ -26,15 +26,6 @@ function op_install() {
|
||||
echo -e " ↳ [${GREEN}✔${NC}] op installed successfully. Open a new shell to use it."
|
||||
}
|
||||
|
||||
function loge() {
|
||||
if [[ -f "$LOG_FILE" ]]; then
|
||||
# error type
|
||||
echo "$1" >> $LOG_FILE
|
||||
# error log
|
||||
echo "$2" >> $LOG_FILE
|
||||
fi
|
||||
}
|
||||
|
||||
function retry() {
|
||||
local attempts=$1
|
||||
shift
|
||||
@@ -148,13 +139,11 @@ function op_check_os() {
|
||||
;;
|
||||
* )
|
||||
echo -e " ↳ [${RED}✗${NC}] Incompatible Ubuntu version $VERSION_CODENAME detected!"
|
||||
loge "ERROR_INCOMPATIBLE_UBUNTU" "$VERSION_CODENAME"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo -e " ↳ [${RED}✗${NC}] No /etc/os-release on your system. Make sure you're running on Ubuntu, or similar!"
|
||||
loge "ERROR_UNKNOWN_UBUNTU"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -162,7 +151,6 @@ function op_check_os() {
|
||||
echo -e " ↳ [${GREEN}✔${NC}] macOS detected."
|
||||
else
|
||||
echo -e " ↳ [${RED}✗${NC}] OS type $OSTYPE not supported!"
|
||||
loge "ERROR_UNKNOWN_OS" "$OSTYPE"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@@ -210,7 +198,6 @@ function op_setup() {
|
||||
SETUP_SCRIPT="tools/setup_dependencies.sh"
|
||||
if ! $OPENPILOT_ROOT/$SETUP_SCRIPT; then
|
||||
echo -e " ↳ [${RED}✗${NC}] Dependencies installation failed!"
|
||||
loge "ERROR_DEPENDENCIES_INSTALLATION"
|
||||
return 1
|
||||
fi
|
||||
et="$(date +%s)"
|
||||
@@ -222,7 +209,6 @@ function op_setup() {
|
||||
st="$(date +%s)"
|
||||
if ! retry 3 git submodule update --jobs 4 --init --recursive; then
|
||||
echo -e " ↳ [${RED}✗${NC}] Getting git submodules failed!"
|
||||
loge "ERROR_GIT_SUBMODULES"
|
||||
return 1
|
||||
fi
|
||||
et="$(date +%s)"
|
||||
@@ -232,7 +218,6 @@ function op_setup() {
|
||||
st="$(date +%s)"
|
||||
if ! retry 3 git lfs pull; then
|
||||
echo -e " ↳ [${RED}✗${NC}] Pulling git lfs files failed!"
|
||||
loge "ERROR_GIT_LFS"
|
||||
return 1
|
||||
fi
|
||||
et="$(date +%s)"
|
||||
@@ -468,7 +453,6 @@ function _op() {
|
||||
-d | --dir ) shift 1; OPENPILOT_ROOT="$1"; shift 1 ;;
|
||||
--dry ) shift 1; DRY="1" ;;
|
||||
-n | --no-verify ) shift 1; NO_VERIFY="1" ;;
|
||||
-l | --log ) shift 1; LOG_FILE="$1" ; shift 1 ;;
|
||||
esac
|
||||
|
||||
# parse Commands
|
||||
|
||||
+1
-45
@@ -33,39 +33,6 @@ cat << 'EOF'
|
||||
EOF
|
||||
}
|
||||
|
||||
function sentry_send_event() {
|
||||
SENTRY_KEY=dd0cba62ba0ac07ff9f388f8f1e6a7f4
|
||||
SENTRY_URL=https://sentry.io/api/4507726145781760/store/
|
||||
|
||||
EVENT=$1
|
||||
EVENT_TYPE=${2:-$EVENT}
|
||||
EVENT_LOG=${3:-"NA"}
|
||||
|
||||
PLATFORM=$(uname -s)
|
||||
ARCH=$(uname -m)
|
||||
SYSTEM=$(uname -a)
|
||||
if [[ $PLATFORM == "Darwin" ]]; then
|
||||
OS="macos"
|
||||
elif [[ $PLATFORM == "Linux" ]]; then
|
||||
OS="linux"
|
||||
fi
|
||||
|
||||
if [[ $ARCH == armv8* ]] || [[ $ARCH == arm64* ]] || [[ $ARCH == aarch64* ]]; then
|
||||
ARCH="aarch64"
|
||||
elif [[ $ARCH == "x86_64" ]] || [[ $ARCH == i686* ]]; then
|
||||
ARCH="x86"
|
||||
fi
|
||||
|
||||
PYTHON_VERSION=$(echo $(python3 --version 2> /dev/null || echo "NA"))
|
||||
BRANCH=$(echo $(git -C $OPENPILOT_ROOT rev-parse --abbrev-ref HEAD 2> /dev/null || echo "NA"))
|
||||
COMMIT=$(echo $(git -C $OPENPILOT_ROOT rev-parse HEAD 2> /dev/null || echo "NA"))
|
||||
|
||||
curl -s -o /dev/null -X POST -g --data "{ \"exception\": { \"values\": [{ \"type\": \"$EVENT\" }] }, \"tags\" : { \"event_type\" : \"$EVENT_TYPE\", \"event_log\" : \"$EVENT_LOG\", \"os\" : \"$OS\", \"arch\" : \"$ARCH\", \"python_version\" : \"$PYTHON_VERSION\" , \"git_branch\" : \"$BRANCH\", \"git_commit\" : \"$COMMIT\", \"system\" : \"$SYSTEM\" } }" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H "X-Sentry-Auth: Sentry sentry_version=7, sentry_key=$SENTRY_KEY, sentry_client=op_setup/0.1" \
|
||||
$SENTRY_URL 2> /dev/null
|
||||
}
|
||||
|
||||
function check_stdin() {
|
||||
if [ -t 0 ]; then
|
||||
INTERACTIVE=1
|
||||
@@ -131,7 +98,6 @@ function check_git() {
|
||||
echo "Checking for git..."
|
||||
if ! command -v "git" > /dev/null 2>&1; then
|
||||
echo -e " ↳ [${RED}✗${NC}] git not found on your system, can't continue!"
|
||||
sentry_send_event "SETUP_FAILURE" "ERROR_GIT_NOT_FOUND"
|
||||
return 1
|
||||
else
|
||||
echo -e " ↳ [${GREEN}✔${NC}] git found.\n"
|
||||
@@ -150,7 +116,6 @@ function git_clone() {
|
||||
fi
|
||||
|
||||
echo -e " ↳ [${RED}✗${NC}] failed to clone openpilot!"
|
||||
sentry_send_event "SETUP_FAILURE" "ERROR_GIT_CLONE"
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -159,18 +124,9 @@ function install_with_op() {
|
||||
$OPENPILOT_ROOT/tools/op.sh install
|
||||
$OPENPILOT_ROOT/tools/op.sh post-commit
|
||||
|
||||
LOG_FILE=$(mktemp)
|
||||
|
||||
if ! $OPENPILOT_ROOT/tools/op.sh --log $LOG_FILE setup; then
|
||||
if ! $OPENPILOT_ROOT/tools/op.sh setup; then
|
||||
echo -e "\n[${RED}✗${NC}] failed to install openpilot!"
|
||||
|
||||
ERROR_TYPE="$(cat "$LOG_FILE" | sed '1p;d')"
|
||||
ERROR_LOG="$(cat "$LOG_FILE" | sed '2p;d')"
|
||||
sentry_send_event "SETUP_FAILURE" "$ERROR_TYPE" "$ERROR_LOG" || true
|
||||
|
||||
return 1
|
||||
else
|
||||
sentry_send_event "SETUP_SUCCESS" || true
|
||||
fi
|
||||
|
||||
echo -e "\n----------------------------------------------------------------------"
|
||||
|
||||
Reference in New Issue
Block a user