Skip to content

Commit

Permalink
Add SDK data classes for experimental profiling signal type.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhalliday committed Apr 10, 2024
1 parent 3044610 commit 64da240
Show file tree
Hide file tree
Showing 13 changed files with 126 additions and 208 deletions.
Expand Up @@ -7,13 +7,12 @@

/**
* Specifies the method of aggregating metric values.
*
* @see "profiles.proto::AggregationTemporality"
*/
public enum AggregationTemporality {

/**
* The default AggregationTemporality, it MUST not be used.
*/
/** The default AggregationTemporality, it MUST not be used. */
UNSPECIFIED,

/**
Expand All @@ -22,7 +21,8 @@ public enum AggregationTemporality {
DELTA,

/**
* CUMULATIVE is an AggregationTemporality for a profiler which reports changes since a fixed start time.
* CUMULATIVE is an AggregationTemporality for a profiler which reports changes since a fixed
* start time.
*/
CUMULATIVE
}
Expand Up @@ -9,18 +9,15 @@

/**
* Represents a mapping between Attribute Keys and Units.
*
* @see "pprofextended.proto::AttributeUnit"
*/
@Immutable
public interface AttributeUnitData {

/**
* Index into string table.
*/
/** Index into string table. */
long getAttributeKey();

/**
* Index into string table.
*/
/** Index into string table. */
long getUnitIndex();
}
Expand Up @@ -7,17 +7,14 @@

/**
* Indicates the semantics of the build_id field.
*
* @see "pprofextended.proto::BuildIdKind"
*/
public enum BuildIdKind {

/**
* Linker-generated build ID, stored in the ELF binary notes.
*/
/** Linker-generated build ID, stored in the ELF binary notes. */
LINKER,

/**
* Build ID based on the content hash of the binary.
*/
/** Build ID based on the content hash of the binary. */
BINARY_HASH;
}
Expand Up @@ -9,39 +9,32 @@

/**
* Describes a function.
*
* @see "pprofextended.proto::Function"
*/
@Immutable
public interface FunctionData {

/**
* Unique nonzero id for the function.
*
* @deprecated retained only for pprof compatibility.
*/
@Deprecated
long getId();

/**
* Name of the function, in human-readable form if available.
* Index into string table.
*/
/** Name of the function, in human-readable form if available. Index into string table. */
long getNameIndex();

/**
* Name of the function, as identified by the system.
* For instance, it can be a C++ mangled name.
* Name of the function, as identified by the system. For instance, it can be a C++ mangled name.
* Index into string table.
*/
long getSystemNameIndex();

/**
* Source file containing the function.
* Index into string table.
*/
/** Source file containing the function. Index into string table. */
long getFilenameIndex();

/**
* Line number in source file.
*/
/** Line number in source file. */
long getStartLine();
}
Expand Up @@ -8,32 +8,26 @@
import javax.annotation.concurrent.Immutable;

/**
* Provides additional context for a sample,
* such as thread ID or allocation size, with optional units.
* Provides additional context for a sample, such as thread ID or allocation size, with optional
* units.
*
* @see "pprofextended.proto::Label"
*/
@Immutable
public interface LabelData {

/**
* Index into string table.
*/
/** Index into string table. */
long getKeyIndex();

/**
* String value of the label data, if applicable.
* Index into string table
*/
/** String value of the label data, if applicable. Index into string table */
long getStrIndex();

/**
* Numeric value of the label data, if applicable.
*/
/** Numeric value of the label data, if applicable. */
long getNum();

/**
* Specifies the units of num, applicable only if num is present.
* Use arbitrary string (for example, "requests") as a custom count unit.
* Specifies the units of num, applicable only if num is present. Use arbitrary string (for
* example, "requests") as a custom count unit.
*/
long getNumUnitIndex();
}
Expand Up @@ -9,24 +9,18 @@

/**
* Details a specific line in a source code, linked to a function.
*
* @see "pprofextended.proto::Line"
*/
@Immutable
public interface LineData {

/**
* The index of the corresponding Function for this line.
* Index into function table.
*/
/** The index of the corresponding Function for this line. Index into function table. */
long getFunctionIndex();

/**
* Line number in source code.
*/
/** Line number in source code. */
long getLine();

/**
* Column number in source code.
*/
/** Column number in source code. */
long getColumn();
}
Expand Up @@ -9,22 +9,17 @@

/**
* A connection from a profile Sample to a trace Span.
*
* @see "pprofextended.proto::Link"
*/
@Immutable
public interface LinkData {

/**
* A unique identifier of a trace that this linked span is part of.
* The ID is a 16-byte array.
*/
/** A unique identifier of a trace that this linked span is part of. The ID is a 16-byte array. */
@SuppressWarnings("mutable")
byte[] getTraceId();

/**
* A unique identifier for the linked span.
* The ID is an 8-byte array.
*/
/** A unique identifier for the linked span. The ID is an 8-byte array. */
@SuppressWarnings("mutable")
byte[] getSpanId();
}
Expand Up @@ -10,51 +10,45 @@

/**
* Describes a function.
*
* @see "pprofextended.proto::Location"
*/
@Immutable
public interface LocationData {

/**
* Unique nonzero id for the location.
* Could use instruction addresses or any integer sequence as ids.
* Unique nonzero id for the location. Could use instruction addresses or any integer sequence as
* ids.
*
* @deprecated retained only for pprof compatibility.
*/
@Deprecated
long getId();

/**
* The index of the corresponding profile.Mapping for this location.
* It can be unset if the mapping is unknown or not applicable for this profile type.
* The index of the corresponding profile.Mapping for this location. It can be unset if the
* mapping is unknown or not applicable for this profile type.
*/
long getMappingIndex();

/**
* The instruction address for this location, if available.
*/
/** The instruction address for this location, if available. */
long getAddress();

/**
* Multiple line indicates this location has inlined functions,
* where the last entry represents the caller into which the
* preceding entries were inlined.
* Multiple line indicates this location has inlined functions, where the last entry represents
* the caller into which the preceding entries were inlined.
*/
List<LineData> getLines();

/**
* Provides an indication that multiple symbols map to this location's
* address, for example due to identical code folding by the linker.
* Provides an indication that multiple symbols map to this location's address, for example due to
* identical code folding by the linker.
*/
boolean isFolded();

/**
* Type of frame (e.g. kernel, native, python, hotspot, php).
* Index into string table.
*/
/** Type of frame (e.g. kernel, native, python, hotspot, php). Index into string table. */
int getTypeIndex();

/**
* References to attributes in Profile.attribute_table.
*/
/** References to attributes in Profile.attribute_table. */
List<Long> getAttributes();
}
Expand Up @@ -10,61 +10,53 @@

/**
* Describes the mapping of a binary in memory.
*
* @see "pprofextended.proto::Mapping"
*/
@Immutable
public interface MappingData {

/**
* Unique nonzero id for the mapping.
*
* @deprecated retained only for pprof compatibility.
*/
@Deprecated
long getId();

/**
* Address at which the binary (or DLL) is loaded into memory.
*/
/** Address at which the binary (or DLL) is loaded into memory. */
long getMemoryStart();

/**
* The limit of the address range occupied by this mapping.
*/
/** The limit of the address range occupied by this mapping. */
long getMemoryLimit();

/**
* Offset in the binary that corresponds to the first mapped address.
*/
/** Offset in the binary that corresponds to the first mapped address. */
long getFileOffset();

/**
* The object this entry is loaded from.
* This can be a filename on disk for the main binary and shared libraries,
* or virtual abstraction like "[vdso]".
* Index into the string table.
* The object this entry is loaded from. This can be a filename on disk for the main binary and
* shared libraries, or virtual abstraction like "[vdso]". Index into the string table.
*/
long getFilenameIndex();

/**
* Uniquely identifies a particular program version with high probability.
* e.g., for binaries generated by GNU tools, the contents of the .note.gnu.build-id field.
* Index into the string table.
* Uniquely identifies a particular program version with high probability. e.g., for binaries
* generated by GNU tools, the contents of the .note.gnu.build-id field. Index into the string
* table.
*/
long getBuildIdIndex();

/**
* Specifies the kind of build id.
* See BuildIdKind enum for more details
*/
/** Specifies the kind of build id. See BuildIdKind enum for more details */
BuildIdKind getBuildIdKind();

/**
* References to attributes in Profile.attribute_table.
*/
/** References to attributes in Profile.attribute_table. */
List<Long> getAttributeIndices();

boolean hasFunctions();

boolean hasFilenames();

boolean hasLineNumbers();

boolean hasInlineFrames();
}

0 comments on commit 64da240

Please sign in to comment.