Skip to content

Commit 2cb26e1

Browse files
committed
add changelog entry, improve logs
1 parent 0514903 commit 2cb26e1

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Fixes
6+
7+
- Fix profiling init for Spring and Spring Boot w Agent auto-init ([#4815](https://github.com/getsentry/sentry-java/pull/4815))
8+
59
### Improvements
610

711
- Fallback to distinct-id as user.id logging attribute when user is not set ([#4847](https://github.com/getsentry/sentry-java/pull/4847))

sentry/src/main/java/io/sentry/util/InitUtil.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ public static IContinuousProfiler initializeProfiler(@NotNull SentryOptions opti
8282

8383
if (!(continuousProfiler instanceof NoOpContinuousProfiler)) {
8484
options.setContinuousProfiler(continuousProfiler);
85+
options.getLogger().log(SentryLevel.INFO, "Successfully loaded profiler");
86+
} else {
87+
options
88+
.getLogger()
89+
.log(
90+
SentryLevel.WARNING,
91+
"Could not load profiler, profiling will be disabled. If you are using Spring or Spring Boot with the OTEL Agent profiler init will be retried.");
8592
}
8693

8794
return continuousProfiler;
@@ -101,25 +108,20 @@ public static IProfileConverter initializeProfileConverter(@NotNull SentryOption
101108
if (options.isContinuousProfilingEnabled()
102109
&& options.getProfilerConverter() instanceof NoOpProfileConverter) {
103110

104-
options
105-
.getLogger()
106-
.log(
107-
SentryLevel.DEBUG,
108-
"Profile converter is NoOp, attempting to reload with Spring Boot classloader");
109-
110111
converter = ProfilingServiceLoader.loadProfileConverter();
111112

112113
options.setProfilerConverter(converter);
113114

114115
if (!(converter instanceof NoOpProfileConverter)) {
116+
options.getLogger().log(SentryLevel.INFO, "Successfully loaded profile converter");
117+
} else {
115118
options
116119
.getLogger()
117120
.log(
118-
SentryLevel.INFO,
119-
"Successfully loaded profile converter via Spring Boot classloader");
121+
SentryLevel.WARNING,
122+
"Could not load profile converter. If you are using Spring or Spring Boot with the OTEL Agent, profile converter init will be retried.");
120123
}
121124
}
122125
return converter;
123126
}
124-
// TODO: Add initialization of profiler here
125127
}

0 commit comments

Comments
 (0)