Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Features

- Remove vendored code and upgrade to async profiler 4.2 ([#4856](https://github.com/getsentry/sentry-java/pull/4856))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should mention that this means compatibility with newer JDK versions.


### Improvements

- Fallback to distinct-id as user.id logging attribute when user is not set ([#4847](https://github.com/getsentry/sentry-java/pull/4847))
Expand Down
299 changes: 5 additions & 294 deletions sentry-async-profiler/api/sentry-async-profiler.api
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ public final class io/sentry/asyncprofiler/BuildConfig {
public static final field VERSION_NAME Ljava/lang/String;
}

public final class io/sentry/asyncprofiler/convert/JfrAsyncProfilerToSentryProfileConverter : io/sentry/asyncprofiler/vendor/asyncprofiler/convert/JfrConverter {
public fun <init> (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/JfrReader;Lio/sentry/asyncprofiler/vendor/asyncprofiler/convert/Arguments;Lio/sentry/SentryStackTraceFactory;Lio/sentry/ILogger;)V
public final class io/sentry/asyncprofiler/convert/JfrAsyncProfilerToSentryProfileConverter : one/convert/JfrConverter {
public fun <init> (Lone/jfr/JfrReader;Lone/convert/Arguments;Lio/sentry/SentryStackTraceFactory;Lio/sentry/ILogger;)V
public static fun convertFromFileStatic (Ljava/lang/String;)Lio/sentry/protocol/profiling/SentryProfile;
}

public final class io/sentry/asyncprofiler/convert/NonAggregatingEventCollector : io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/EventCollector {
public final class io/sentry/asyncprofiler/convert/NonAggregatingEventCollector : one/jfr/event/EventCollector {
public fun <init> ()V
public fun afterChunk ()V
public fun beforeChunk ()V
public fun collect (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event;)V
public fun collect (Lone/jfr/event/Event;)V
public fun finish ()Z
public fun forEach (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/EventCollector$Visitor;)V
public fun forEach (Lone/jfr/event/EventCollector$Visitor;)V
}

public final class io/sentry/asyncprofiler/profiling/JavaContinuousProfiler : io/sentry/IContinuousProfiler, io/sentry/transport/RateLimiter$IRateLimitObserver {
Expand Down Expand Up @@ -45,292 +45,3 @@ public final class io/sentry/asyncprofiler/provider/AsyncProfilerProfileConverte
public fun convertFromFile (Ljava/lang/String;)Lio/sentry/protocol/profiling/SentryProfile;
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/convert/Arguments {
public field alloc Z
public field bci Z
public field classify Z
public field cpu Z
public field dot Z
public field exclude Ljava/util/regex/Pattern;
public final field files Ljava/util/List;
public field from J
public field grain D
public field help Z
public field highlight Ljava/lang/String;
public field include Ljava/util/regex/Pattern;
public field inverted Z
public field leak Z
public field lines Z
public field live Z
public field lock Z
public field minwidth D
public field nativemem Z
public field norm Z
public field output Ljava/lang/String;
public field reverse Z
public field simple Z
public field skip I
public field state Ljava/lang/String;
public field threads Z
public field title Ljava/lang/String;
public field to J
public field total Z
public field wall Z
public fun <init> ([Ljava/lang/String;)V
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/convert/Frame : java/util/HashMap {
public static final field TYPE_C1_COMPILED B
public static final field TYPE_CPP B
public static final field TYPE_INLINED B
public static final field TYPE_INTERPRETED B
public static final field TYPE_JIT_COMPILED B
public static final field TYPE_KERNEL B
public static final field TYPE_NATIVE B
}

public abstract class io/sentry/asyncprofiler/vendor/asyncprofiler/convert/JfrConverter {
protected final field args Lio/sentry/asyncprofiler/vendor/asyncprofiler/convert/Arguments;
protected final field collector Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/EventCollector;
protected final field jfr Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/JfrReader;
protected field methodNames Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/Dictionary;
public fun <init> (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/JfrReader;Lio/sentry/asyncprofiler/vendor/asyncprofiler/convert/Arguments;)V
protected fun collectEvents ()V
public fun convert ()V
protected fun convertChunk ()V
protected fun createCollector (Lio/sentry/asyncprofiler/vendor/asyncprofiler/convert/Arguments;)Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/EventCollector;
public synthetic fun getCategory (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/StackTrace;)Lio/sentry/asyncprofiler/vendor/asyncprofiler/convert/Classifier$Category;
public fun getClassName (J)Ljava/lang/String;
public fun getMethodName (JB)Ljava/lang/String;
public fun getPlainThreadName (I)Ljava/lang/String;
public fun getStackTraceElement (JBI)Ljava/lang/StackTraceElement;
public fun getThreadName (I)Ljava/lang/String;
protected fun getThreadStates (Z)Ljava/util/BitSet;
protected fun isNativeFrame (B)Z
protected fun toThreadState (Ljava/lang/String;)I
protected fun toTicks (J)J
}

protected abstract class io/sentry/asyncprofiler/vendor/asyncprofiler/convert/JfrConverter$AggregatedEventVisitor : io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/EventCollector$Visitor {
protected fun <init> (Lio/sentry/asyncprofiler/vendor/asyncprofiler/convert/JfrConverter;)V
protected abstract fun visit (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event;J)V
public final fun visit (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event;JJ)V
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/ClassRef {
public final field name J
public fun <init> (J)V
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/Dictionary {
public fun <init> ()V
public fun <init> (I)V
public fun clear ()V
public fun forEach (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/Dictionary$Visitor;)V
public fun get (J)Ljava/lang/Object;
public fun preallocate (I)I
public fun put (JLjava/lang/Object;)V
public fun size ()I
}

public abstract interface class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/Dictionary$Visitor {
public abstract fun visit (JLjava/lang/Object;)V
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/DictionaryInt {
public fun <init> ()V
public fun <init> (I)V
public fun clear ()V
public fun forEach (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/DictionaryInt$Visitor;)V
public fun get (J)I
public fun get (JI)I
public fun preallocate (I)I
public fun put (JI)V
}

public abstract interface class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/DictionaryInt$Visitor {
public abstract fun visit (JI)V
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/JfrClass {
public fun field (Ljava/lang/String;)Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/JfrField;
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/JfrField {
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/JfrReader : java/io/Closeable {
public field chunkEndNanos J
public field chunkStartNanos J
public field chunkStartTicks J
public final field classes Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/Dictionary;
public field endNanos J
public final field enums Ljava/util/Map;
public final field javaThreads Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/Dictionary;
public final field methods Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/Dictionary;
public final field settings Ljava/util/Map;
public final field stackTraces Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/Dictionary;
public field startNanos J
public field startTicks J
public field stopAtNewChunk Z
public final field strings Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/Dictionary;
public final field symbols Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/Dictionary;
public final field threads Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/Dictionary;
public field ticksPerSec J
public final field types Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/Dictionary;
public final field typesByName Ljava/util/Map;
public fun <init> (Ljava/lang/String;)V
public fun <init> (Ljava/nio/ByteBuffer;)V
public fun close ()V
public fun durationNanos ()J
public fun eof ()Z
public fun getBytes ()[B
public fun getDouble ()D
public fun getEnumKey (Ljava/lang/String;Ljava/lang/String;)I
public fun getEnumValue (Ljava/lang/String;I)Ljava/lang/String;
public fun getFloat ()F
public fun getString ()Ljava/lang/String;
public fun getVarint ()I
public fun getVarlong ()J
public fun hasMoreChunks ()Z
public fun incomplete ()Z
public fun readAllEvents ()Ljava/util/List;
public fun readAllEvents (Ljava/lang/Class;)Ljava/util/List;
public fun readEvent ()Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event;
public fun readEvent (Ljava/lang/Class;)Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event;
public fun registerEvent (Ljava/lang/String;Ljava/lang/Class;)V
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/MethodRef {
public final field cls J
public final field name J
public final field sig J
public fun <init> (JJJ)V
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/StackTrace {
public final field locations [I
public final field methods [J
public final field types [B
public fun <init> ([J[B[I)V
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/AllocationSample : io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event {
public final field allocationSize J
public final field classId I
public final field tlabSize J
public fun <init> (JIIIJJ)V
public fun classId ()J
public fun hashCode ()I
public fun sameGroup (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event;)Z
public fun value ()J
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/CPULoad : io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event {
public final field jvmSystem F
public final field jvmUser F
public final field machineTotal F
public fun <init> (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/JfrReader;)V
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/ContendedLock : io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event {
public final field classId I
public final field duration J
public fun <init> (JIIJI)V
public fun classId ()J
public fun hashCode ()I
public fun sameGroup (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event;)Z
public fun value ()J
}

public abstract class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event : java/lang/Comparable {
public final field stackTraceId I
public final field tid I
public final field time J
protected fun <init> (JII)V
public fun classId ()J
public fun compareTo (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event;)I
public synthetic fun compareTo (Ljava/lang/Object;)I
public fun hashCode ()I
public fun sameGroup (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event;)Z
public fun samples ()J
public fun toString ()Ljava/lang/String;
public fun value ()J
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/EventAggregator : io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/EventCollector {
public fun <init> (ZD)V
public fun afterChunk ()V
public fun beforeChunk ()V
public fun coarsen (D)V
public fun collect (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event;)V
public fun collect (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event;JJ)V
public fun finish ()Z
public fun forEach (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/EventCollector$Visitor;)V
public fun size ()I
}

public abstract interface class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/EventCollector {
public abstract fun afterChunk ()V
public abstract fun beforeChunk ()V
public abstract fun collect (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event;)V
public abstract fun finish ()Z
public abstract fun forEach (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/EventCollector$Visitor;)V
}

public abstract interface class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/EventCollector$Visitor {
public abstract fun visit (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event;JJ)V
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/ExecutionSample : io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event {
public final field samples I
public final field threadState I
public fun <init> (JIIII)V
public fun samples ()J
public fun value ()J
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/GCHeapSummary : io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event {
public final field afterGC Z
public final field committed J
public final field gcId I
public final field reserved J
public final field used J
public fun <init> (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/JfrReader;)V
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/LiveObject : io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event {
public final field allocationSize J
public final field allocationTime J
public final field classId I
public fun <init> (JIIIJJ)V
public fun classId ()J
public fun hashCode ()I
public fun sameGroup (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event;)Z
public fun value ()J
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/MallocEvent : io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event {
public final field address J
public final field size J
public fun <init> (JIIJJ)V
public fun value ()J
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/MallocLeakAggregator : io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/EventCollector {
public fun <init> (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/EventCollector;)V
public fun afterChunk ()V
public fun beforeChunk ()V
public fun collect (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event;)V
public fun finish ()Z
public fun forEach (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/EventCollector$Visitor;)V
}

public final class io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/ObjectCount : io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/event/Event {
public final field classId I
public final field count J
public final field gcId I
public final field totalSize J
public fun <init> (Lio/sentry/asyncprofiler/vendor/asyncprofiler/jfr/JfrReader;)V
}

3 changes: 2 additions & 1 deletion sentry-async-profiler/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ kotlin { explicitApi() }
dependencies {
api(projects.sentry)

implementation("tools.profiler:async-profiler:3.0")
implementation("tools.profiler:async-profiler:4.2")
implementation("tools.profiler:jfr-converter:4.2")

compileOnly(libs.jetbrains.annotations)
compileOnly(libs.nopen.annotations)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
import io.sentry.Sentry;
import io.sentry.SentryLevel;
import io.sentry.SentryStackTraceFactory;
import io.sentry.asyncprofiler.vendor.asyncprofiler.convert.Arguments;
import io.sentry.asyncprofiler.vendor.asyncprofiler.convert.JfrConverter;
import io.sentry.asyncprofiler.vendor.asyncprofiler.jfr.JfrReader;
import io.sentry.asyncprofiler.vendor.asyncprofiler.jfr.StackTrace;
import io.sentry.asyncprofiler.vendor.asyncprofiler.jfr.event.Event;
import io.sentry.asyncprofiler.vendor.asyncprofiler.jfr.event.EventCollector;
import io.sentry.protocol.SentryStackFrame;
import io.sentry.protocol.profiling.SentryProfile;
import io.sentry.protocol.profiling.SentrySample;
Expand All @@ -20,6 +14,12 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import one.convert.Arguments;
import one.convert.JfrConverter;
import one.jfr.JfrReader;
import one.jfr.StackTrace;
import one.jfr.event.Event;
import one.jfr.event.EventCollector;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -247,6 +247,11 @@ private String extractSanitizedClassName(String classNameWithLambdas) {
}
}

private String getPlainThreadName(int tid) {
String threadName = jfr.threads.get(tid);
return threadName == null ? "[tid=" + tid + ']' : threadName;
}

private boolean hasPackageStructure(String className) {
return className.lastIndexOf('.') > 0;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.sentry.asyncprofiler.convert;

import io.sentry.asyncprofiler.vendor.asyncprofiler.jfr.event.Event;
import io.sentry.asyncprofiler.vendor.asyncprofiler.jfr.event.EventCollector;
import java.util.ArrayList;
import java.util.List;
import one.jfr.event.Event;
import one.jfr.event.EventCollector;
import org.jetbrains.annotations.ApiStatus;

@ApiStatus.Internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ private void start() {
// Example command: start,jfr,event=wall,interval=9900us,file=/path/to/trace.jfr
final String command =
String.format(
"start,jfr,event=wall,interval=%s,file=%s", profilingIntervalMicros, filename);
"start,jfr,event=wall,nobatch,interval=%s,file=%s",
profilingIntervalMicros, filename);

logger.log(SentryLevel.INFO, command);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to remove this again? Or lower log level? I imagine it's quite spammy.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, oversight on my part. Will remove this


profiler.execute(command);

Expand Down
Loading
Loading