Skip to content

Commit a8f1e8e

Browse files
authored
update profiling server url for v2 (#13)
1 parent 657b853 commit a8f1e8e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

examples/extension/src/main/java/com/example/javaagent/config/EnvironmentConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
public class EnvironmentConfig {
1010

1111
public static final String MW_PROFILING_SERVER_URL =
12-
System.getenv().getOrDefault("MW_PROFILING_SERVER_URL", "https://profiling.middleware.io");
12+
System.getenv().get("MW_PROFILING_SERVER_URL");
1313

1414
public static final String MW_PROFILING_ALLOC =
1515
System.getenv().getOrDefault("MW_PROFILING_ALLOC", "512k");

examples/extension/src/main/java/com/example/profile/PyroscopeProfile.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,17 @@ public static void startProfiling() {
3333
try {
3434
String tenantId = authenticateAndGetTenantId();
3535
if (tenantId != null) {
36+
String profilingServerUrl = EnvironmentConfig.MW_PROFILING_SERVER_URL;
37+
if (profilingServerUrl == null) {
38+
profilingServerUrl = "https://" + tenantId + ".middleware.io/profiling";
39+
}
3640
PyroscopeAgent.start(
3741
new Config.Builder()
3842
.setApplicationName(SystemProperties.SERVICE_NAME)
3943
.setProfilingEvent(EventType.ITIMER)
4044
.setProfilingAlloc(EnvironmentConfig.MW_PROFILING_ALLOC)
4145
.setProfilingLock(EnvironmentConfig.MW_PROFILING_LOCK)
42-
.setServerAddress(EnvironmentConfig.MW_PROFILING_SERVER_URL)
46+
.setServerAddress(profilingServerUrl)
4347
.setTenantID(tenantId)
4448
.build());
4549
} else {

0 commit comments

Comments
 (0)