Skip to content

Commit 30cb14b

Browse files
committed
add logging to loadProfileConverter
1 parent b1701c5 commit 30cb14b

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

sentry-async-profiler/api/sentry-async-profiler.api

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ public final class io/sentry/asyncprofiler/convert/JfrAsyncProfilerToSentryProfi
88
public static fun convertFromFileStatic (Ljava/nio/file/Path;)Lio/sentry/protocol/profiling/SentryProfile;
99
}
1010

11+
public final class io/sentry/asyncprofiler/convert/NonAggregatingEventCollector : io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/EventCollector {
12+
public fun <init> ()V
13+
public fun afterChunk ()V
14+
public fun beforeChunk ()V
15+
public fun collect (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event;)V
16+
public fun finish ()Z
17+
public fun forEach (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/EventCollector$Visitor;)V
18+
}
19+
1120
public final class io/sentry/asyncprofiler/profiling/JavaContinuousProfiler : io/sentry/IContinuousProfiler, io/sentry/transport/RateLimiter$IRateLimitObserver {
1221
public fun <init> (Lio/sentry/ILogger;Ljava/lang/String;ILio/sentry/ISentryExecutorService;)V
1322
public fun close (Z)V

sentry/src/main/java/io/sentry/profiling/ProfilingServiceLoader.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import io.sentry.IProfileConverter;
66
import io.sentry.ISentryExecutorService;
77
import io.sentry.NoOpContinuousProfiler;
8+
import io.sentry.ScopesAdapter;
89
import io.sentry.SentryLevel;
910
import java.util.Iterator;
1011
import java.util.ServiceLoader;
@@ -49,16 +50,22 @@ public final class ProfilingServiceLoader {
4950
* @return an IProfileConverter instance or null if no provider is found
5051
*/
5152
public static @Nullable IProfileConverter loadProfileConverter() {
53+
ILogger logger = ScopesAdapter.getInstance().getGlobalScope().getOptions().getLogger();
5254
try {
5355
JavaProfileConverterProvider provider =
5456
loadSingleProvider(JavaProfileConverterProvider.class);
5557
if (provider != null) {
58+
logger.log(
59+
SentryLevel.DEBUG,
60+
"Loaded profile converter from provider: %s",
61+
provider.getClass().getName());
5662
return provider.getProfileConverter();
5763
} else {
64+
logger.log(SentryLevel.DEBUG, "No profile converter provider found, returning null");
5865
return null;
5966
}
6067
} catch (Throwable t) {
61-
// Log error and return null to skip conversion
68+
logger.log(SentryLevel.ERROR, "Failed to load profile converter provider, returning null", t);
6269
return null;
6370
}
6471
}
@@ -74,3 +81,4 @@ public final class ProfilingServiceLoader {
7481
}
7582
}
7683
}
84+

0 commit comments

Comments
 (0)