-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New feature branch to allow a custom listener to be created for ERXSt…
…atisticsStore. Such a listener can be used to notify an external monitoring system (e.g. StatsD/Graphite) if request handling is slow.
- Loading branch information
Showing
7 changed files
with
190 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...e/ERExtensions/Sources/er/extensions/statistics/store/DumbERXStatisticsStoreListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package er.extensions.statistics.store; | ||
|
||
public class DumbERXStatisticsStoreListener implements ERXStatisticsStoreListener { | ||
|
||
public void log(long requestTime, RequestDescription description) {} | ||
|
||
public void deadlock(int deadlocksCount) {} | ||
} |
9 changes: 9 additions & 0 deletions
9
.../Core/ERExtensions/Sources/er/extensions/statistics/store/ERXStatisticsStoreListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package er.extensions.statistics.store; | ||
|
||
public interface ERXStatisticsStoreListener { | ||
|
||
public void log(long requestTime, RequestDescription description); | ||
|
||
public void deadlock(int deadlocksCount); | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
...rks/Core/ERExtensions/Sources/er/extensions/statistics/store/EmptyRequestDescription.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package er.extensions.statistics.store; | ||
|
||
public class EmptyRequestDescription implements RequestDescription { | ||
|
||
public static final String ERROR_STRING = "Error-during-context-description"; | ||
private String descriptionString = ERROR_STRING; | ||
|
||
public EmptyRequestDescription(String descriptionString) { | ||
if (descriptionString != null) { | ||
this.descriptionString = descriptionString; | ||
} | ||
} | ||
|
||
public String getComponentName() { | ||
throw new IllegalStateException("field was not set use toString method instead!"); | ||
} | ||
|
||
public String getRequestHandler() { | ||
throw new IllegalStateException("field was not set use toString method instead!"); | ||
} | ||
|
||
public String getAdditionalInfo() { | ||
throw new IllegalStateException("field was not set use toString method instead!"); | ||
} | ||
|
||
public RequestDescriptionType getType() { | ||
return RequestDescriptionType.EMPTY; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return descriptionString; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...ks/Core/ERExtensions/Sources/er/extensions/statistics/store/NormalRequestDescription.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package er.extensions.statistics.store; | ||
|
||
public class NormalRequestDescription implements RequestDescription { | ||
|
||
private final String componentName; | ||
private final String requestHandler; | ||
private final String additionalInfo; | ||
|
||
public NormalRequestDescription(String componentName, String requestHandler, String additionalInfo) { | ||
this.componentName = componentName; | ||
this.requestHandler = requestHandler; | ||
this.additionalInfo = additionalInfo; | ||
} | ||
|
||
public String getComponentName() { | ||
return componentName; | ||
} | ||
|
||
public String getRequestHandler() { | ||
return requestHandler; | ||
} | ||
|
||
public String getAdditionalInfo() { | ||
return additionalInfo; | ||
} | ||
|
||
public RequestDescriptionType getType() { | ||
return RequestDescriptionType.NORMAL; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return componentName + "-" + requestHandler + additionalInfo; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Frameworks/Core/ERExtensions/Sources/er/extensions/statistics/store/RequestDescription.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package er.extensions.statistics.store; | ||
|
||
public interface RequestDescription { | ||
|
||
public String getComponentName(); | ||
|
||
public String getRequestHandler(); | ||
|
||
public String getAdditionalInfo(); | ||
|
||
public RequestDescriptionType getType(); | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
...orks/Core/ERExtensions/Sources/er/extensions/statistics/store/RequestDescriptionType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package er.extensions.statistics.store; | ||
|
||
public enum RequestDescriptionType { | ||
NORMAL, EMPTY, DEADLOCK | ||
} |