# Discard Settings Beta
yCrash tool uses it's internal algorithms to find performance problems in your application. However some of it's findings can be:
a. False Positive
b. Not a serious issue in your environment
c. You have already planned to fix it and wouldn't like to be alerted
In such circumstances, you want to instruct yCrash to supress such findings. Discard Settings feature facilitates you to accomplish it.
# How to suppress fatal, error, warning messages?
Download
discard-settings.json
from this location (opens new window).Place this
discard-settings.json
file in the yCrash Server’s upload directory. If you use remote storage, you can store thediscard-settings.json
file in the root directory of the remote storage (AWS S3, Google Cloud Storage). The yCrash application checks if the file exists locally first. If found, it reads from there. Otherwise, it looks for the file in the remote storage.Details on how to configure this file is given in the next section.
# How to configure 'discard-settings.json'?
Say suppose below are the issues that are reported in your RCA summary page:
Fig: Issues reported by yCrash
Here let's say '3 threads are looping on line #177 of org.eclipse.mat.collect.HashMapIntLong file in get() method. If threads loop infinitely, CPU consumption will start to spike up.' is a known issue in your application and you are going to fix it later. Thus you don't want yCrash to raise this error.
In such circumstances in the 'discard-settings.json' file, you'll find the 'globalSettings' array, allowing you to specify patterns to match and discard.
For example:
{
"globalSettings": [
{
"matchPattern": "looping on line #177 of org.eclipse.mat.collect.HashMapIntLong file in get() method"
}
]
}
2
3
4
5
6
7
# 1. REGEX (Regular Expression)
Say suppose in the report, you don't want to be alerted about the threads which are causing the CPU to spike (which is a bad idea though), then you can you can leverage the regular expression support. In such circumstance you can add a new entry using the 'matchPattern' and REGEX 'matchCriteria' as given below
{
"globalSettings": [
{
"matchPattern": "looping on line #177 of org.eclipse.mat.collect.HashMapIntLong file in get() method"
},
{
"matchPattern": ".* thread is consuming high CPU .*",
"matchCriteria": "REGEX"
}
]
}
2
3
4
5
6
7
8
9
10
11
In this example, the second entry utilizes a regular expression ("matchCriteria": "REGEX") to match any notification containing the phrase "thread is consuming high CPU." This way, you can discard the below errors from being reported:
- http-nio-8080-exec-33 thread is consuming high CPU (52.3%). Examine its stack trace in thread dump 1, thread dump 2, thread dump 3
- http-nio-8080-exec-7 thread is consuming high CPU (52.08%). Examine its stack trace in thread dump 1, thread dump 2, thread dump 3
- http-nio-8080-exec-24 thread is consuming high CPU (46.61%). Examine its stack trace in thread dump 1, thread dump 2, thread dump 3
# 2. WHOLE_WORD
Say suppose in the report, you don't want to be alerted about the threads which are stucked (which is a bad idea though), then you can you can leverage the WHOLE_WORD expression support. In such circumstance you can add a new entry using the 'matchPattern' and WHOLE_WORD 'matchCriteria' as given below
{
"globalSettings": [
{
"matchPattern": "thread are stucked",
"matchCriteria": "WHOLE_WORD"
}
]
}
2
3
4
5
6
7
8
# 3. CASE_SENSITIVE
Say suppose in the report, you don't want to be alerted about the threads which are blocked (which is a bad idea though), then you can you can leverage the CASE_SENSITIVE expression support. In such circumstance you can add a new entry using the 'matchPattern' and CASE_SENSITIVE 'matchCriteria' as given below
{
"globalSettings": [
{
"matchPattern": "threads are blocked",
"matchCriteria": "CASE_SENSITIVE"
}
]
}
2
3
4
5
6
7
8
# 4. NONE
Say suppose in the report, you do not want to be alerted about specific thread states, such as threads that are waiting, you can utilize the NONE match criteria.
In such cases, you can add an entry using the 'matchPattern' and 'matchCriteria' fields as shown below:
{
"globalSettings": [
{
"matchPattern": "threads are waiting",
"matchCriteria": "NONE"
}
]
}
2
3
4
5
6
7
8
This is the default behavior, meaning that no additional filtering conditions are applied beyond the presence of the specified pattern. It ensures that any discard statement containing the pattern is matched without further criteria.
Note:
If no "matchCriteria" is explicitly set, it defaults to "NONE".
# Application Level Settings
In scenarios where you monitor multiple applications using yCrash, you may want to configure discard rules selectively for each application. To achieve this, utilize the 'appSettings' array element in the 'discard-settings.json' file as given below:
{
"globalSettings": [
{
"matchPattern": "Add your first global problem statement here"
},
{
"matchPattern": "Add your first global problem statement here"
},
{
"matchPattern": "Add your global regex problem .* statement here",
"matchCriteria": "REGEX"
}
],
"appSettings": [
{
"appName": "app01",
"patterns": [
{
"matchPattern": "Add your first application-specific problem statement here"
},
{
"matchPattern": "Add your second application-specific problem statement here"
},
{
"matchPattern": "Add your application-specific regex problem .* statement here",
"matchCriteria": "REGEX"
}
]
},
{
"appName": "app02",
"patterns": [
{
"matchPattern": "Add your first application-specific problem statement here"
},
{
"matchPattern": "Add your second application-specific problem statement here"
},
{
"matchPattern": "Add your application-specific regex problem .* statement here",
"matchCriteria": "REGEX"
}
]
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Escaping Special Characters
If you want to add special characters, such as Carriage return \r
, Tab \t
, Double quote "
, Backslash \.
. they need to be escaped properly. Learn about it from here.