Skip to content

Commit

Permalink
chore: make pyroscope url configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
dweber019 committed Oct 17, 2023
1 parent 8b3b4b5 commit 8e7feb2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.pyroscope.javaagent.PyroscopeAgent;
import io.pyroscope.javaagent.api.Logger;
import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import io.pyroscope.javaagent.config.Config;
import io.pyroscope.javaagent.EventType;
Expand All @@ -14,6 +15,9 @@
@SpringBootApplication
public class PyroscopeApplication {

@Value("${pyroscope.url}")
private String pyroscopeUrl;

public static void main(String[] args) {
SpringApplication.run(PyroscopeApplication.class, args);
}
Expand All @@ -25,7 +29,7 @@ public void init() {
.setApplicationName("spring-app")
.setProfilingEvent(EventType.ITIMER)
.setFormat(Format.JFR)
.setServerAddress("http://pyroscope:4040")
.setServerAddress(pyroscopeUrl)
// Optionally, if authentication is enabled, specify the API key.
// .setAuthToken(System.getenv("PYROSCOPE_AUTH_TOKEN"))
// Optionally, if you'd like to set allocation threshold to register events, in bytes. '0' registers all events
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
spring:
application:
name: Gabelstrapler Buggs App

pyroscope:
url: ${PYROSCOPE_URL:http://pyroscope:4040}

0 comments on commit 8e7feb2

Please sign in to comment.