Skip to content

Commit

Permalink
fix: send sampleRate url param only when needed (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomershafir authored Jan 2, 2024
1 parent fa45625 commit d630813
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.pyroscope.javaagent.impl;

import io.pyroscope.http.Format;
import io.pyroscope.javaagent.EventType;
import io.pyroscope.javaagent.Snapshot;
import io.pyroscope.javaagent.api.Exporter;
import io.pyroscope.javaagent.api.Logger;
Expand Down Expand Up @@ -147,10 +148,11 @@ private HttpUrl urlForSnapshot(final Snapshot snapshot) {
.addQueryParameter("name", nameWithStaticLabels())
.addQueryParameter("units", snapshot.eventType.units.id)
.addQueryParameter("aggregationType", snapshot.eventType.aggregationType.id)
.addQueryParameter("sampleRate", Long.toString(config.profilingIntervalInHertz()))
.addQueryParameter("from", Long.toString(started.getEpochSecond()))
.addQueryParameter("until", Long.toString(finished.getEpochSecond()))
.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");
return builder.build();
Expand Down

0 comments on commit d630813

Please sign in to comment.