Skip to content

Commit

Permalink
clean up logging, fix cache condition check
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Matsuoka committed Dec 11, 2024
1 parent 6f2534d commit e9667a4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/main/java/io/cryostat/recordings/ActiveRecordings.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,10 @@ public String uploadToGrafana(
throws Exception {
// Send an intermediate response back to the client while another thread handles the upload
// request
logger.info("Creating grafana upload request");
logger.trace("Creating grafana upload request");
GrafanaActiveUploadRequest request =
new GrafanaActiveUploadRequest(UUID.randomUUID().toString(), remoteId, targetId);
logger.info(
logger.trace(
"Request created: ("
+ request.getId()
+ ", "
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/cryostat/recordings/ArchivedRecordings.java
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,10 @@ public String uploadArchivedToGrafana(HttpServerResponse response, @RestPath Str
}
// Send an intermediate response back to the client while another thread handles the upload
// request
logger.info("Creating grafana upload request");
logger.trace("Creating grafana upload request");
GrafanaArchiveUploadRequest request =
new GrafanaArchiveUploadRequest(UUID.randomUUID().toString(), pair);
logger.info(
logger.trace(
"Request created: (" + request.getId() + ", " + request.getPair().toString() + ")");
response.endHandler(
(e) -> bus.publish(LongRunningRequestGenerator.GRAFANA_ARCHIVE_ADDRESS, request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import jakarta.inject.Inject;
import org.apache.commons.lang3.tuple.Pair;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.slf4j.Logger;
import org.jboss.logging.Logger;

@ApplicationScoped
public class LongRunningRequestGenerator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ public Uni<Map<String, AnalysisResult>> reportFor(String jvmId, String filename)
@Override
public boolean keyExists(ActiveRecording recording) {
String key = ReportsService.key(recording);
return (quarkusCache || memoryCache)
return (quarkusCache && memoryCache)
&& (activeCache.as(CaffeineCache.class).keySet().contains(key)
|| delegate.keyExists(recording));
}

@Override
public boolean keyExists(String jvmId, String filename) {
String key = recordingHelper.archivedRecordingKey(jvmId, filename);
return (quarkusCache || memoryCache)
return (quarkusCache && memoryCache)
&& (archivedCache.as(CaffeineCache.class).keySet().contains(key)
|| delegate.keyExists(jvmId, filename));
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/cryostat/reports/Reports.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public Response get(HttpServerResponse response, @RestPath String encodedKey) {

// If we don't have a cached result, delegate to the ArchiveRequestGenerator
// and return the job ID with a location header.
logger.info("Cache miss. Creating archived reports request");
logger.trace("Cache miss. Creating archived reports request");
ArchivedReportRequest request =
new ArchivedReportRequest(UUID.randomUUID().toString(), pair);
response.bodyEndHandler(
Expand Down Expand Up @@ -136,7 +136,7 @@ public Response getActive(

// If there isn't a cached result available, delegate to the ArchiveRequestGenerator
// and return the job ID with a location header.
logger.info("Cache miss. Creating active reports request");
logger.trace("Cache miss. Creating active reports request");
ActiveReportRequest request =
new ActiveReportRequest(UUID.randomUUID().toString(), recording);
response.bodyEndHandler(
Expand Down

0 comments on commit e9667a4

Please sign in to comment.