File tree Expand file tree Collapse file tree 2 files changed +24
-14
lines changed
dd-java-agent/agent-crashtracking/src/main/resources/com/datadog/crashtracking Expand file tree Collapse file tree 2 files changed +24
-14
lines changed Original file line number Diff line number Diff line change 2222# The expected contents are:
2323# - agent: Path to the agent jar
2424# - tags: Comma-separated list of tags to be sent with the OOME event; key:value pairs are supported
25- declare -A config
2625while IFS=" =" read -r key value; do
27- config[ " $key " ] =" $value "
26+ declare " config_ $key " =" $value "
2827done < " $configFile "
2928
29+ # Exiting early if configuration is missing
30+ if [ -z " ${config_agent} " ] || [ -z " ${config_tags} " ]; then
31+ echo " Error: Missing configuration"
32+ exit 1
33+ fi
34+
3035# Debug: Print the loaded values (Optional)
31- echo " Agent Jar: ${config[agent] } "
32- echo " Tags: ${config[tags] } "
36+ echo " Agent Jar: ${config_agent } "
37+ echo " Tags: ${config_tags } "
3338echo " PID: $PID "
3439
3540# Execute the Java command with the loaded values
36- java -Ddd.dogstatsd.start-delay=0 -jar " ${config[agent] } " sendOomeEvent " ${config[tags] } "
41+ java -Ddd.dogstatsd.start-delay=0 -jar " ${config_agent } " sendOomeEvent " ${config_tags } "
3742RC=$?
38- rm -f ${configFile} # Remove the configuration file
43+ rm -f " ${configFile} " # Remove the configuration file
3944
4045if [ $RC -eq 0 ]; then
4146 echo " OOME Event generated successfully"
Original file line number Diff line number Diff line change 3030# The expected contents are:
3131# - agent: Path to the agent jar
3232# - hs_err: Path to the hs_err log file
33- declare -A config
3433while IFS=" =" read -r key value; do
35- config[ " $key " ] =" $value "
34+ declare " config_ $key " =" $value "
3635done < " $configFile "
3736
37+ # Exiting early if configuration is missing
38+ if [ -z " ${config_agent} " ] || [ -z " ${config_hs_err} " ]; then
39+ echo " Error: Missing configuration"
40+ exit 1
41+ fi
42+
3843# Debug: Print the loaded values (Optional)
39- echo " Agent Jar: ${config[agent] } "
40- echo " Error Log: ${config[hs_err] } "
44+ echo " Agent Jar: ${config_agent } "
45+ echo " Error Log: ${config_hs_err } "
4146echo " PID: $PID "
4247
4348# Execute the Java command with the loaded values
44- java -jar " ${config[agent] } " uploadCrash " ${config[hs_err] } "
49+ java -jar " ${config_agent } " uploadCrash " ${config_hs_err } "
4550RC=$?
46- rm -f ${configFile} # Remove the configuration file
51+ rm -f " ${configFile} " # Remove the configuration file
4752
4853if [ $RC -eq 0 ]; then
49- echo " Error file ${config[hs_err] } was uploaded successfully"
54+ echo " Error file ${config_hs_err } was uploaded successfully"
5055else
51- echo " Error: Failed to upload error file ${config[hs_err] } "
56+ echo " Error: Failed to upload error file ${config_hs_err } "
5257 exit $RC
5358fi
You can’t perform that action at this time.
0 commit comments