Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(triggers): allow complex expressions, add caching for performance #221

Merged
merged 10 commits into from
Oct 6, 2023

Conversation

andrewazores
Copy link
Member

@andrewazores andrewazores commented Oct 5, 2023

  • allow single-quoted durations
  • allow complex cel conditions
  • cache generated scripts
  • more refactoring, use singleton scripthost

Based on #220

diff --git a/smoketest.sh b/smoketest.sh
index 187c5a7e..e2cfebbe 100755
--- a/smoketest.sh
+++ b/smoketest.sh
@@ -202,7 +202,7 @@ runDemoApps() {
     podman run \
         --name quarkus-test-agent-1 \
         --pod cryostat-pod \
-        --env JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dcom.sun.management.jmxremote.port=9097 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -javaagent:/deployments/app/cryostat-agent.jar" \
+        --env JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dcom.sun.management.jmxremote.port=9097 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -javaagent:/deployments/app/cryostat-agent.jar=[ThreadCount>0]~default.jfc,[ThreadCount>0;TargetDuration>duration(\"30s\")]~Profiling" \
         --env QUARKUS_HTTP_PORT=10010 \
         --env ORG_ACME_CRYOSTATSERVICE_ENABLED="false" \
         --env CRYOSTAT_AGENT_APP_NAME="quarkus-test-agent-1" \
@@ -214,14 +214,16 @@ runDemoApps() {
         --env CRYOSTAT_AGENT_BASEURI="${protocol}://localhost:${webPort}/" \
         --env CRYOSTAT_AGENT_TRUST_ALL="true" \
         --env CRYOSTAT_AGENT_AUTHORIZATION="Basic $(echo user:pass | base64)" \
+        --env CRYOSTAT_AGENT_API_WRITES_ENABLED="true" \
         --env CRYOSTAT_AGENT_HARVESTER_PERIOD_MS=60000 \
         --env CRYOSTAT_AGENT_HARVESTER_MAX_FILES=10 \
+        --env CRYOSTAT_AGENT_SMART_TRIGGER_DEFINITIONS="[(ProcessCpuLoad>=0.0||SystemCpuLoad>=0.0)&&HeapMemoryUsagePercent>=0.0;TargetDuration>duration('40s')]~default.jfc" \
         --rm -d quay.io/andrewazores/quarkus-test:latest
 
     podman run \
         --name quarkus-test-agent-2 \
         --pod cryostat-pod \
-        --env JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -javaagent:/deployments/app/cryostat-agent.jar" \
+        --env JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -javaagent:/deployments/app/cryostat-agent.jar=[ThreadCount>0;TargetDuration>duration(\"2m\")]~Profiling" \
         --env QUARKUS_HTTP_PORT=10011 \
         --env ORG_ACME_CRYOSTATSERVICE_ENABLED="false" \
         --env CRYOSTAT_AGENT_APP_NAME="quarkus-test-agent-2" \
@@ -234,6 +236,8 @@ runDemoApps() {
         --env CRYOSTAT_AGENT_TRUST_ALL="true" \
         --env CRYOSTAT_AGENT_AUTHORIZATION="Basic $(echo user:pass | base64)" \
         --env CRYOSTAT_AGENT_API_WRITES_ENABLED="true" \
+        --env CRYOSTAT_AGENT_HARVESTER_TEMPLATE="default" \
+        --env CRYOSTAT_AGENT_SMART_TRIGGER_EVALUATION_PERIOD_MS=10000 \
         --rm -d quay.io/andrewazores/quarkus-test:latest
 
     # copy a jboss-client.jar into /clientlib first

@andrewazores andrewazores added the feat New feature or request label Oct 5, 2023
@mergify mergify bot added the safe-to-test label Oct 5, 2023
@andrewazores andrewazores force-pushed the trigger-syntax branch 3 times, most recently from 2416afb to f8dbe97 Compare October 5, 2023 18:50
@andrewazores andrewazores merged commit 5cc473b into cryostatio:main Oct 6, 2023
7 of 10 checks passed
@andrewazores andrewazores deleted the trigger-syntax branch October 6, 2023 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request safe-to-test
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants