Skip to content
Permalink
Browse files

[FIXED JENKINS-49931] DISABLED by default

  • Loading branch information...
escoem committed Mar 6, 2018
1 parent 3824571 commit a3ff0c7e985b0ecb9a4460bab94932bc55a17b6a
Showing with 19 additions and 0 deletions.
  1. +19 −0 src/main/java/com/cloudbees/jenkins/support/impl/HeapUsageHistogram.java
@@ -33,6 +33,10 @@
// first 200 classes so 203 lines required because of the header
private static final int MAX = 203;

// disabled by default because of JENKINS-49931
// to be reviewed in the future.
private static /*final*/ boolean DISABLED = Boolean.parseBoolean(System.getProperty(HeapUsageHistogram.class.getCanonicalName() + ".DISABLED", "true"));

private static final Logger logger = Logger.getLogger(HeapUsageHistogram.class.getName());

@NonNull
@@ -47,6 +51,12 @@ public String getDisplayName() {
return "Master Heap Histogram";
}

@Override
public boolean isSelectedByDefault() {
return false;
}


@Override
public void addContents(@NonNull Container result) {
result.add(
@@ -74,6 +84,15 @@ private String getLiveHistogram() throws IOException {
}

private String getRawLiveHistogram() {
if (DISABLED) {
return new StringBuilder().append('\n')
.append("Histogram generation is disabled. If you want to enable it, do either:")
.append('\n')
.append("* Add the system property: -Dcom.cloudbees.jenkins.support.impl.HeapUsageHistogram.DISABLED=false")
.append('\n')
.append("* Run from Script Console the line: com.cloudbees.jenkins.support.impl.HeapUsageHistogram.DISABLED=false")
.toString();
}
String result;
try {
ObjectName objName = new ObjectName("com.sun.management:type=DiagnosticCommand");

0 comments on commit a3ff0c7

Please sign in to comment.
You can’t perform that action at this time.