Skip to content

Commit 4b269c5

Browse files
Merge branch 'main' of github.com:code-dot-org/javabuilder into dwebb
2 parents a141b46 + 1106d59 commit 4b269c5

File tree

7 files changed

+51
-889
lines changed

7 files changed

+51
-889
lines changed

cicd/3-app/javabuilder/template.yml.erb

Lines changed: 48 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,9 @@ Resources:
658658
Properties:
659659
ActionsEnabled: true
660660
AlarmActions:
661-
- !If [SilenceAlertsCondition, !Ref AWS::NoValue, !Sub "arn:aws:sns:${AWS::Region}:${AWS::AccountId}:javabuilder-high-usage"]
661+
# TODO: after we have run at high usage for a while, consider re-enabling this alarm. Right now it is too noisy
662+
# - !If [SilenceAlertsCondition, !Ref AWS::NoValue, !Sub "arn:aws:sns:${AWS::Region}:${AWS::AccountId}:javabuilder-high-usage"]
663+
- !Ref AWS::NoValue
662664
AlarmDescription: Send message if abnormally high Javabuilder usage detected.
663665
Monitors usage across the HTTP API, WebSocket API, and all Build and Run
664666
Lambdas.
@@ -760,133 +762,98 @@ Resources:
760762
Type: AWS::CloudWatch::Alarm
761763
Properties:
762764
AlarmName: !Sub "${SubDomainName}_<%=name.downcase%>_slow_cleanup_time"
763-
AlarmDescription: p(95) cleanup time in Javabuilder's <%=name%> build and run lambda exceeded
764-
the normal cleanup time for 15 minutes. Investigate if there has been a performance regression.
765+
AlarmDescription: Average cleanup time in Javabuilder's <%=name%> build and run lambda was high for at
766+
least 15 out of the last 20 minutes. Investigate if there has been a performance regression.
765767
ActionsEnabled: true
766768
OKActions: []
767769
AlarmActions:
768770
- !If [SilenceAlertsCondition, !Ref AWS::NoValue, !Sub "arn:aws:sns:${AWS::Region}:${AWS::AccountId}:javabuilder-slow-performance"]
769771
InsufficientDataActions: []
772+
MetricName: CleanupTime
773+
Namespace: Javabuilder
774+
Statistic: Average
775+
Dimensions:
776+
- Name: functionName
777+
Value: !Ref BuildAndRunJava<%=name%>ProjectFunction
770778
EvaluationPeriods: 20
771779
DatapointsToAlarm: 15
772-
ComparisonOperator: GreaterThanUpperThreshold
780+
ComparisonOperator: GreaterThanThreshold
773781
TreatMissingData: notBreaching
774-
Metrics:
775-
- Id: m1
776-
ReturnData: true
777-
MetricStat:
778-
Metric:
779-
Namespace: Javabuilder
780-
MetricName: CleanupTime
781-
Dimensions:
782-
- Name: functionName
783-
Value: !Ref BuildAndRunJava<%=name%>ProjectFunction
784-
Period: 60
785-
Stat: p95
786-
- Id: ad1
787-
Label: CleanupTime (expected)
788-
ReturnData: true
789-
Expression: ANOMALY_DETECTION_BAND(m1, 5)
790-
ThresholdMetricId: ad1
782+
Threshold: 200
783+
Period: 60
791784
792785
<%=name%>SlowColdBootTimeAlarm:
793786
Type: AWS::CloudWatch::Alarm
794787
Properties:
795788
AlarmName: !Sub "${SubDomainName}_<%=name.downcase%>_slow_cold_boot_time"
796-
AlarmDescription: p(95) cold boot time in Javabuilder's <%=name%> build and run lambda exceeded
797-
the normal cleanup time for 15 minutes. Investigate if there has been a performance regression.
789+
AlarmDescription: Average cold boot time in Javabuilder's <%=name%> build and run lambda was high for at
790+
least 15 out of the last 20 minutes. Investigate if there has been a performance regression.
798791
ActionsEnabled: true
799792
OKActions: []
800793
AlarmActions:
801794
- !If [SilenceAlertsCondition, !Ref AWS::NoValue, !Sub "arn:aws:sns:${AWS::Region}:${AWS::AccountId}:javabuilder-slow-performance"]
802795
InsufficientDataActions: []
796+
MetricName: ColdBootTime
797+
Namespace: Javabuilder
798+
Statistic: Average
799+
Dimensions:
800+
- Name: functionName
801+
Value: !Ref BuildAndRunJava<%=name%>ProjectFunction
803802
EvaluationPeriods: 20
804803
DatapointsToAlarm: 15
805-
ComparisonOperator: GreaterThanUpperThreshold
804+
ComparisonOperator: GreaterThanThreshold
806805
TreatMissingData: notBreaching
807-
Metrics:
808-
- Id: m1
809-
ReturnData: true
810-
MetricStat:
811-
Metric:
812-
Namespace: Javabuilder
813-
MetricName: ColdBootTime
814-
Dimensions:
815-
- Name: functionName
816-
Value: !Ref BuildAndRunJava<%=name%>ProjectFunction
817-
Period: 60
818-
Stat: p95
819-
- Id: ad1
820-
Label: ColdBootTime (expected)
821-
ReturnData: true
822-
Expression: ANOMALY_DETECTION_BAND(m1, 2)
823-
ThresholdMetricId: ad1
806+
Threshold: 10500
807+
Period: 60
824808
825809
<%=name%>SlowInitializationTimeAlarm:
826810
Type: AWS::CloudWatch::Alarm
827811
Properties:
828812
AlarmName: !Sub "${SubDomainName}_<%=name.downcase%>_slow_initialization_time"
829-
AlarmDescription: p(95) initialization time in Javabuilder's <%=name%> build and run lambda exceeded
830-
the normal cleanup time for 15 minutes. Investigate if there has been a performance regression.
813+
AlarmDescription: Average initialization time in Javabuilder's <%=name%> build and run lambda was high for at
814+
least 15 out of the last 20 minutes. Investigate if there has been a performance regression.
831815
ActionsEnabled: true
832816
OKActions: []
833817
AlarmActions:
834818
- !If [SilenceAlertsCondition, !Ref AWS::NoValue, !Sub "arn:aws:sns:${AWS::Region}:${AWS::AccountId}:javabuilder-slow-performance"]
835819
InsufficientDataActions: []
820+
MetricName: InitializationTime
821+
Namespace: Javabuilder
822+
Statistic: Average
823+
Dimensions:
824+
- Name: functionName
825+
Value: !Ref BuildAndRunJava<%=name%>ProjectFunction
836826
EvaluationPeriods: 20
837827
DatapointsToAlarm: 15
838-
ComparisonOperator: GreaterThanUpperThreshold
828+
ComparisonOperator: GreaterThanThreshold
839829
TreatMissingData: notBreaching
840-
Metrics:
841-
- Id: m1
842-
ReturnData: true
843-
MetricStat:
844-
Metric:
845-
Namespace: Javabuilder
846-
MetricName: InitializationTime
847-
Dimensions:
848-
- Name: functionName
849-
Value: !Ref BuildAndRunJava<%=name%>ProjectFunction
850-
Period: 60
851-
Stat: p95
852-
- Id: ad1
853-
Label: InitializationTime (expected)
854-
ReturnData: true
855-
Expression: ANOMALY_DETECTION_BAND(m1, 5)
856-
ThresholdMetricId: ad1
830+
Threshold: 5000
831+
Period: 60
832+
857833
858834
<%=name%>SlowTransitionTimeAlarm:
859835
Type: AWS::CloudWatch::Alarm
860836
Properties:
861837
AlarmName: !Sub "${SubDomainName}_<%=name.downcase%>_slow_transition_time"
862-
AlarmDescription: p(95) transition time in Javabuilder's <%=name%> build and run lambda exceeded
863-
the normal cleanup time for 15 minutes. Investigate if there has been a performance regression.
838+
AlarmDescription: Average transition time in Javabuilder's <%=name%> build and run lambda was high for at
839+
least 15 out of the last 20 minutes. Investigate if there has been a performance regression.
864840
ActionsEnabled: true
865841
OKActions: []
866842
AlarmActions:
867843
- !If [SilenceAlertsCondition, !Ref AWS::NoValue, !Sub "arn:aws:sns:${AWS::Region}:${AWS::AccountId}:javabuilder-slow-performance"]
868844
InsufficientDataActions: []
845+
MetricName: TransitionTime
846+
Namespace: Javabuilder
847+
Statistic: Average
848+
Dimensions:
849+
- Name: functionName
850+
Value: !Ref BuildAndRunJava<%=name%>ProjectFunction
869851
EvaluationPeriods: 20
870852
DatapointsToAlarm: 15
871-
ComparisonOperator: GreaterThanUpperThreshold
853+
ComparisonOperator: GreaterThanThreshold
872854
TreatMissingData: notBreaching
873-
Metrics:
874-
- Id: m1
875-
ReturnData: true
876-
MetricStat:
877-
Metric:
878-
Namespace: Javabuilder
879-
MetricName: TransitionTime
880-
Dimensions:
881-
- Name: functionName
882-
Value: !Ref BuildAndRunJava<%=name%>ProjectFunction
883-
Period: 60
884-
Stat: p95
885-
- Id: ad1
886-
Label: TransitionTime (expected)
887-
ReturnData: true
888-
Expression: ANOMALY_DETECTION_BAND(m1, 5)
889-
ThresholdMetricId: ad1
855+
Threshold: 2500
856+
Period: 60
890857
891858
<%=name%>HighInvocationsAlarm:
892859
Type: AWS::CloudWatch::Alarm

org-code-javabuilder/lib/src/main/java/org/code/javabuilder/UserClassLoader.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ private boolean isInAllowedPackage(String[] allowedPackageList, String name) {
126126
"org.code.media.",
127127
"org.code.neighborhood.",
128128
"org.code.theater.",
129-
"org.code.lang"
129+
"org.code.lang",
130+
"org.mockito."
130131
};
131132

132133
// Allowed packages for code with elevated permissions, such as validation code.

org-code-javabuilder/studentlib/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ java {
1414
dependencies {
1515
// Required to compile student unit tests
1616
implementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
17+
implementation group: 'org.mockito', name: 'mockito-inline', version: '3.9.0'
1718
}
1819

1920
test {

0 commit comments

Comments
 (0)