-
-
Notifications
You must be signed in to change notification settings - Fork 467
Expand file tree
/
Copy pathAsyncProfilerContinuousProfilerProvider.java
More file actions
38 lines (35 loc) · 1.35 KB
/
AsyncProfilerContinuousProfilerProvider.java
File metadata and controls
38 lines (35 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package io.sentry.asyncprofiler.provider;
import io.sentry.IContinuousProfiler;
import io.sentry.ILogger;
import io.sentry.ISentryExecutorService;
import io.sentry.NoOpContinuousProfiler;
import io.sentry.SentryLevel;
import io.sentry.asyncprofiler.profiling.JavaContinuousProfiler;
import io.sentry.profiling.JavaContinuousProfilerProvider;
import io.sentry.profiling.JavaProfileConverterProvider;
import org.jetbrains.annotations.NotNull;
/**
* AsyncProfiler implementation of {@link JavaContinuousProfilerProvider} and {@link
* JavaProfileConverterProvider}. This provider integrates AsyncProfiler with Sentry's continuous
* profiling system and provides profile conversion functionality.
*/
public final class AsyncProfilerContinuousProfilerProvider
implements JavaContinuousProfilerProvider {
@Override
public @NotNull IContinuousProfiler getContinuousProfiler(
ILogger logger,
String profilingTracesDirPath,
int profilingTracesHz,
ISentryExecutorService executorService) {
try {
return new JavaContinuousProfiler(
logger, profilingTracesDirPath, profilingTracesHz, executorService);
} catch (Exception e) {
logger.log(
SentryLevel.WARNING,
"Failed to initialize AsyncProfiler. Profiling will be disabled.",
e);
return NoOpContinuousProfiler.getInstance();
}
}
}