diff --git a/agent/src/main/java/io/pyroscope/http/Format.java b/agent/src/main/java/io/pyroscope/http/Format.java index 046ab24..d5204da 100644 --- a/agent/src/main/java/io/pyroscope/http/Format.java +++ b/agent/src/main/java/io/pyroscope/http/Format.java @@ -1,8 +1,6 @@ package io.pyroscope.http; public enum Format { - @Deprecated // use jfr - COLLAPSED ("collapsed"), JFR ("jfr"); /** diff --git a/agent/src/main/java/io/pyroscope/javaagent/config/Config.java b/agent/src/main/java/io/pyroscope/javaagent/config/Config.java index 1e4f0bf..3448cd8 100644 --- a/agent/src/main/java/io/pyroscope/javaagent/config/Config.java +++ b/agent/src/main/java/io/pyroscope/javaagent/config/Config.java @@ -193,9 +193,6 @@ public final class Config { DefaultLogger.PRECONFIG_LOGGER.log(Logger.Level.WARN, "Setting PYROSCOPE_PROFILER_LOCK to 0 registers every lock event, causing significant overhead and results in large profiles, making it not ideal for production. We recommend a starting value of 10ms, adjusting as needed."); } - if (format == Format.COLLAPSED) { - DefaultLogger.PRECONFIG_LOGGER.log(Logger.Level.WARN, "COLLAPSED format is deprecated"); - } } public long profilingIntervalInHertz() { @@ -480,8 +477,6 @@ private static Format format(ConfigurationProvider configurationProvider) { if (format == null || format.isEmpty()) return DEFAULT_FORMAT; switch (format.trim().toLowerCase()) { - case "collapsed": - return Format.COLLAPSED; case "jfr": return Format.JFR; default: diff --git a/agent/src/main/java/io/pyroscope/javaagent/impl/PyroscopeExporter.java b/agent/src/main/java/io/pyroscope/javaagent/impl/PyroscopeExporter.java index 2979a2a..6c00843 100644 --- a/agent/src/main/java/io/pyroscope/javaagent/impl/PyroscopeExporter.java +++ b/agent/src/main/java/io/pyroscope/javaagent/impl/PyroscopeExporter.java @@ -52,29 +52,24 @@ private void uploadSnapshot(final Snapshot snapshot) throws InterruptedException while (retry) { tries++; final RequestBody requestBody; - if (config.format == Format.JFR) { - byte[] labels = snapshot.labels.toByteArray(); - logger.log(Logger.Level.DEBUG, "Upload attempt %d to %s. %s %s JFR: %s, labels: %s", tries, url.toString(), - snapshot.started.toString(), snapshot.ended.toString(), snapshot.data.length, labels.length); - MultipartBody.Builder bodyBuilder = new MultipartBody.Builder() - .setType(MultipartBody.FORM); - RequestBody jfrBody = RequestBody.create(snapshot.data); - if (config.compressionLevelJFR != Deflater.NO_COMPRESSION) { - jfrBody = GzipSink.gzip(jfrBody, config.compressionLevelJFR); - } - bodyBuilder.addFormDataPart("jfr", "jfr", jfrBody); - if (labels.length > 0) { - RequestBody labelsBody = RequestBody.create(labels, PROTOBUF); - if (config.compressionLevelLabels != Deflater.NO_COMPRESSION) { - labelsBody = GzipSink.gzip(labelsBody, config.compressionLevelLabels); - } - bodyBuilder.addFormDataPart("labels", "labels", labelsBody); + byte[] labels = snapshot.labels.toByteArray(); + logger.log(Logger.Level.DEBUG, "Upload attempt %d to %s. %s %s JFR: %s, labels: %s", tries, url.toString(), + snapshot.started.toString(), snapshot.ended.toString(), snapshot.data.length, labels.length); + MultipartBody.Builder bodyBuilder = new MultipartBody.Builder() + .setType(MultipartBody.FORM); + RequestBody jfrBody = RequestBody.create(snapshot.data); + if (config.compressionLevelJFR != Deflater.NO_COMPRESSION) { + jfrBody = GzipSink.gzip(jfrBody, config.compressionLevelJFR); + } + bodyBuilder.addFormDataPart("jfr", "jfr", jfrBody); + if (labels.length > 0) { + RequestBody labelsBody = RequestBody.create(labels, PROTOBUF); + if (config.compressionLevelLabels != Deflater.NO_COMPRESSION) { + labelsBody = GzipSink.gzip(labelsBody, config.compressionLevelLabels); } - requestBody = bodyBuilder.build(); - } else { - logger.log(Logger.Level.DEBUG, "Upload attempt %d to %s. collapsed: %s", tries, url.toString(), snapshot.data.length); - requestBody = RequestBody.create(snapshot.data); + bodyBuilder.addFormDataPart("labels", "labels", labelsBody); } + requestBody = bodyBuilder.build(); Request.Builder request = new Request.Builder() .post(requestBody) .url(url); @@ -153,8 +148,7 @@ private HttpUrl urlForSnapshot(final Snapshot snapshot) { .addQueryParameter("spyName", Config.DEFAULT_SPY_NAME); if (EventType.CPU == snapshot.eventType || EventType.ITIMER == snapshot.eventType || EventType.WALL == snapshot.eventType) builder.addQueryParameter("sampleRate", Long.toString(config.profilingIntervalInHertz())); - if (config.format == Format.JFR) - builder.addQueryParameter("format", "jfr"); + builder.addQueryParameter("format", "jfr"); return builder.build(); }