From 87f43bc79c927a0cf9db1aafe9da20e7c24edaf9 Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Wed, 4 Dec 2024 10:43:40 -0500 Subject: [PATCH 01/10] feat(eventtemplates): add Preset event templates type and Quarkus-specific presets --- src/main/docker/Dockerfile.jvm | 1 + .../template_presets/QuarkusContinuous.jfc | 1136 +++++++++++++++++ .../template_presets/QuarkusProfiling.jfc | 1136 +++++++++++++++++ .../java/io/cryostat/ConfigProperties.java | 3 +- .../io/cryostat/events/EventTemplates.java | 41 +- .../events/PresetTemplateService.java | 209 +++ .../io/cryostat/events/S3TemplateService.java | 2 +- .../cryostat/events/TargetEventTemplates.java | 23 +- .../cryostat/recordings/RecordingHelper.java | 27 +- .../io/cryostat/targets/AgentJFRService.java | 2 +- src/main/resources/application.properties | 1 + 11 files changed, 2559 insertions(+), 22 deletions(-) create mode 100644 src/main/docker/include/template_presets/QuarkusContinuous.jfc create mode 100644 src/main/docker/include/template_presets/QuarkusProfiling.jfc create mode 100644 src/main/java/io/cryostat/events/PresetTemplateService.java diff --git a/src/main/docker/Dockerfile.jvm b/src/main/docker/Dockerfile.jvm index ed7c9d260..1e2763863 100644 --- a/src/main/docker/Dockerfile.jvm +++ b/src/main/docker/Dockerfile.jvm @@ -92,6 +92,7 @@ ENTRYPOINT [ "/deployments/app/entrypoint.bash", "/opt/jboss/container/java/run/ # We make distinct layers so if there are application changes the library layers can be re-used COPY --chown=185 src/main/docker/include/cryostat.jfc /usr/lib/jvm/jre/lib/jfr/ +COPY --chown=185 src/main/docker/include/template_presets/* /opt/cryostat.d/presets.d/ COPY --chown=185 src/main/docker/include/genpass.bash /deployments/app/ COPY --chown=185 src/main/docker/include/entrypoint.bash /deployments/app/ COPY --chown=185 src/main/docker/include/truststore-setup.bash /deployments/app/ diff --git a/src/main/docker/include/template_presets/QuarkusContinuous.jfc b/src/main/docker/include/template_presets/QuarkusContinuous.jfc new file mode 100644 index 000000000..c3f150b64 --- /dev/null +++ b/src/main/docker/include/template_presets/QuarkusContinuous.jfc @@ -0,0 +1,1136 @@ + + + + + + + true + + + true + + + true + + + + true + 1000 ms + + + + true + everyChunk + + + + true + 1000 ms + + + + true + everyChunk + + + + true + 1000 ms + + + + true + 10 s + + + + true + 10 s + + + + true + true + + + + true + + + + true + true + 20 ms + + + + true + true + 20 ms + + + + false + true + + + + false + + + + true + true + 20 ms + + + + true + true + + + + true + true + 20 ms + + + + true + true + 20 ms + + + + false + true + 20 ms + + + + true + true + + + + false + false + 0 ms + + + + false + false + 0 ms + + + + false + + + + false + + + + false + + + + false + + + + true + true + + + + false + true + 0 ms + + + + false + true + + + + true + true + 0 ms + + + + true + true + 0 ms + + + + true + + + + false + + + + true + beginChunk + + + + true + beginChunk + + + + true + 20 ms + + + + true + 20 ms + + + + true + 10 ms + + + + false + 10 ms + + + + false + 10 ms + + + + false + 10 ms + + + + false + 10 ms + + + + true + 10 ms + + + + true + true + + + + true + everyChunk + + + + true + beginChunk + + + + true + beginChunk + + + + true + beginChunk + + + + true + beginChunk + + + + true + beginChunk + + + + true + beginChunk + + + + true + beginChunk + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + false + everyChunk + + + + true + everyChunk + + + + true + beginChunk + + + + true + beginChunk + + + + true + beginChunk + + + + true + beginChunk + + + + false + + + + true + everyChunk + + + + true + everyChunk + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + true + + + + true + true + + + + true + + + + true + 0 ms + + + + true + 0 ms + true + + + + true + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + false + 0 ms + + + + false + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + 0 ms + + + + true + + + + true + + + + false + + + + false + + + + true + + + + false + true + + + + true + + + + false + everyChunk + + + + false + + + + false + everyChunk + + + + false + + + + true + false + 0 ns + + + + true + 1000 ms + + + + true + 1000 ms + + + + true + beginChunk + + + + true + 1000 ms + + + + true + 1000 ms + + + + true + 60 s + + + + false + + + + false + + + + true + + + + true + beginChunk + + + + true + everyChunk + + + + true + + + + true + beginChunk + + + + true + beginChunk + + + + true + beginChunk + + + + true + 30 s + + + + true + 30 s + + + + true + 30 s + + + + true + 30 s + + + + true + beginChunk + + + + true + 10 s + + + + true + 1000 ms + + + + true + 10 s + + + + true + beginChunk + + + + true + endChunk + + + + true + true + + + + true + 5 s + + + + true + beginChunk + + + + true + everyChunk + + + + false + true + + + + false + true + + + + true + 150/s + true + + + + true + everyChunk + + + + true + endChunk + + + + true + endChunk + + + + true + true + 20 ms + + + + true + true + 20 ms + + + + true + true + 20 ms + + + + true + true + 20 ms + + + + true + true + 20 ms + + + + false + true + + + + true + beginChunk + + + + false + true + + + + false + true + + + + false + true + + + + false + true + + + + false + true + + + + false + true + + + + true + true + + + + true + 1000 ms + + + + true + + + + true + + + + false + 0 ns + + + + true + + + + true + + + + true + true + 0 ms + + + + true + true + 1 ms + + + + true + 0 ms + + + + true + 0 ms + + + + false + 0 ms + + + + false + 0 ms + + + + false + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + true + false + + + + true + 0 ns + true + + + + true + 5 s + + + + true + 1 s + true + + + + true + endChunk + + + + true + endChunk + + + + true + endChunk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 20 ms + + 20 ms + + 20 ms + + false + + + diff --git a/src/main/docker/include/template_presets/QuarkusProfiling.jfc b/src/main/docker/include/template_presets/QuarkusProfiling.jfc new file mode 100644 index 000000000..65db7db3c --- /dev/null +++ b/src/main/docker/include/template_presets/QuarkusProfiling.jfc @@ -0,0 +1,1136 @@ + + + + + + + true + + + true + + + true + + + + true + 1000 ms + + + + true + everyChunk + + + + true + 1000 ms + + + + true + everyChunk + + + + true + 1000 ms + + + + true + 10 s + + + + true + 10 s + + + + true + true + + + + true + + + + true + true + 10 ms + + + + true + true + 10 ms + + + + false + true + + + + false + + + + true + true + 20 ms + + + + true + true + + + + true + true + 10 ms + + + + true + true + 10 ms + + + + true + true + 10 ms + + + + true + true + + + + false + false + 0 ms + + + + false + false + 0 ms + + + + false + + + + false + + + + false + + + + false + + + + true + true + + + + false + true + 0 ms + + + + false + true + + + + true + true + 0 ms + + + + true + true + 0 ms + + + + true + + + + false + + + + true + beginChunk + + + + true + beginChunk + + + + true + 10 ms + + + + true + 20 ms + + + + true + 0 ms + + + + false + 0 ms + + + + false + 0 ms + + + + false + 0 ms + + + + false + 0 ms + + + + true + 0 ms + + + + true + true + + + + true + 60 s + + + + true + beginChunk + + + + true + beginChunk + + + + true + beginChunk + + + + true + beginChunk + + + + true + beginChunk + + + + true + beginChunk + + + + true + beginChunk + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + false + everyChunk + + + + true + everyChunk + + + + true + beginChunk + + + + true + beginChunk + + + + true + beginChunk + + + + true + beginChunk + + + + false + + + + true + everyChunk + + + + true + everyChunk + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + true + + + + true + true + + + + true + + + + true + 0 ms + + + + true + 0 ms + true + + + + true + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + false + 0 ms + + + + false + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + 0 ms + + + + true + + + + true + + + + true + + + + true + + + + true + + + + false + true + + + + true + + + + false + everyChunk + + + + false + + + + false + everyChunk + + + + false + + + + true + true + 0 ns + + + + true + 1000 ms + + + + true + 1000 ms + + + + true + beginChunk + + + + true + 1000 ms + + + + true + 100 ms + + + + true + 10 s + + + + true + + + + false + + + + true + + + + true + beginChunk + + + + true + everyChunk + + + + true + + + + true + beginChunk + + + + true + beginChunk + + + + true + beginChunk + + + + true + 30 s + + + + true + 30 s + + + + true + 30 s + + + + true + 30 s + + + + true + beginChunk + + + + true + 10 s + + + + true + 1000 ms + + + + true + 10 s + + + + true + beginChunk + + + + true + endChunk + + + + true + true + + + + true + 5 s + + + + true + beginChunk + + + + true + everyChunk + + + + false + true + + + + false + true + + + + true + 300/s + true + + + + true + everyChunk + + + + true + endChunk + + + + true + endChunk + + + + true + true + 10 ms + + + + true + true + 10 ms + + + + true + true + 10 ms + + + + true + true + 10 ms + + + + true + true + 10 ms + + + + false + true + + + + true + beginChunk + + + + false + true + + + + false + true + + + + false + true + + + + false + true + + + + false + true + + + + false + true + + + + true + true + + + + true + 1000 ms + + + + true + + + + true + + + + false + 0 ns + + + + true + + + + true + + + + true + true + 0 ms + + + + true + true + 1 ms + + + + true + 0 ms + + + + true + 0 ms + + + + false + 0 ms + + + + false + 0 ms + + + + false + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + true + 0 ms + + + + true + true + + + + true + 0 ns + true + + + + true + 5 s + + + + true + 100 ms + true + + + + true + endChunk + + + + true + endChunk + + + + true + endChunk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 ms + + 10 ms + + 10 ms + + false + + + diff --git a/src/main/java/io/cryostat/ConfigProperties.java b/src/main/java/io/cryostat/ConfigProperties.java index e92832b53..af0cf153a 100644 --- a/src/main/java/io/cryostat/ConfigProperties.java +++ b/src/main/java/io/cryostat/ConfigProperties.java @@ -54,7 +54,8 @@ public class ConfigProperties { "storage.transient-archives.enabled"; public static final String STORAGE_TRANSIENT_ARCHIVES_TTL = "storage.transient-archives.ttl"; - public static final String TEMPLATES_DIR = "templates-dir"; + public static final String CUSTOM_TEMPLATES_DIR = "templates-dir"; + public static final String PRESET_TEMPLATES_DIR = "preset-templates-dir"; public static final String SSL_TRUSTSTORE_DIR = "ssl.truststore.dir"; public static final String URI_RANGE = "cryostat.target.uri-range"; diff --git a/src/main/java/io/cryostat/events/EventTemplates.java b/src/main/java/io/cryostat/events/EventTemplates.java index 5beac994b..343ffc43e 100644 --- a/src/main/java/io/cryostat/events/EventTemplates.java +++ b/src/main/java/io/cryostat/events/EventTemplates.java @@ -21,6 +21,7 @@ import io.cryostat.core.FlightRecorderException; import io.cryostat.core.templates.MutableTemplateService.InvalidXmlException; +import io.cryostat.core.templates.TemplateService; import io.cryostat.libcryostat.sys.FileSystem; import io.cryostat.libcryostat.templates.InvalidEventTemplateException; import io.cryostat.libcryostat.templates.Template; @@ -60,6 +61,7 @@ public class EventTemplates { @Inject FileSystem fs; @Inject TargetTemplateService.Factory targetTemplateServiceFactory; @Inject S3TemplateService customTemplateService; + @Inject PresetTemplateService presetTemplateService; @Inject Logger logger; @GET @@ -69,21 +71,46 @@ public List