Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exporter data classes for experimental profiling signal type. #6374

Merged
merged 14 commits into from
Jun 3, 2024
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
19 changes: 19 additions & 0 deletions sdk/profiles/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
plugins {
id("otel.java-conventions")
id("otel.publish-conventions")

id("otel.jmh-conventions")
id("otel.animalsniffer-conventions")
}

description = "OpenTelemetry Profiling SDK"
otelJava.moduleName.set("io.opentelemetry.sdk.profiles")

dependencies {
api(project(":api:all"))
api(project(":sdk:common"))

testImplementation("org.awaitility:awaitility")

annotationProcessor("com.google.auto.value:auto-value")
}
1 change: 1 addition & 0 deletions sdk/profiles/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
otel.release=alpha
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.sdk.profiles.data;

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

Check warning on line 13 in sdk/profiles/src/main/java/io/opentelemetry/sdk/profiles/data/AggregationTemporality.java

View check run for this annotation

Codecov / codecov/patch

sdk/profiles/src/main/java/io/opentelemetry/sdk/profiles/data/AggregationTemporality.java#L13

Added line #L13 was not covered by tests
jhalliday marked this conversation as resolved.
Show resolved Hide resolved

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

Check warning on line 16 in sdk/profiles/src/main/java/io/opentelemetry/sdk/profiles/data/AggregationTemporality.java

View check run for this annotation

Codecov / codecov/patch

sdk/profiles/src/main/java/io/opentelemetry/sdk/profiles/data/AggregationTemporality.java#L16

Added line #L16 was not covered by tests
jhalliday marked this conversation as resolved.
Show resolved Hide resolved

/**
* DELTA is an AggregationTemporality for a profiler which reports changes since last report time.
*/
DELTA,

Check warning on line 21 in sdk/profiles/src/main/java/io/opentelemetry/sdk/profiles/data/AggregationTemporality.java

View check run for this annotation

Codecov / codecov/patch

sdk/profiles/src/main/java/io/opentelemetry/sdk/profiles/data/AggregationTemporality.java#L21

Added line #L21 was not covered by tests

/**
* CUMULATIVE is an AggregationTemporality for a profiler which reports changes since a fixed
* start time.
*/
CUMULATIVE

Check warning on line 27 in sdk/profiles/src/main/java/io/opentelemetry/sdk/profiles/data/AggregationTemporality.java

View check run for this annotation

Codecov / codecov/patch

sdk/profiles/src/main/java/io/opentelemetry/sdk/profiles/data/AggregationTemporality.java#L27

Added line #L27 was not covered by tests
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.sdk.profiles.data;

import javax.annotation.concurrent.Immutable;

/**
* Represents a mapping between Attribute Keys and Units.
*
* @see "pprofextended.proto::AttributeUnit"
*/
@Immutable
public interface AttributeUnitData {
jhalliday marked this conversation as resolved.
Show resolved Hide resolved

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

/** Index into string table. */
long getUnitIndex();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.sdk.profiles.data;

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

Check warning on line 13 in sdk/profiles/src/main/java/io/opentelemetry/sdk/profiles/data/BuildIdKind.java

View check run for this annotation

Codecov / codecov/patch

sdk/profiles/src/main/java/io/opentelemetry/sdk/profiles/data/BuildIdKind.java#L13

Added line #L13 was not covered by tests

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

Check warning on line 16 in sdk/profiles/src/main/java/io/opentelemetry/sdk/profiles/data/BuildIdKind.java

View check run for this annotation

Codecov / codecov/patch

sdk/profiles/src/main/java/io/opentelemetry/sdk/profiles/data/BuildIdKind.java#L16

Added line #L16 was not covered by tests

/** Build ID based on the content hash of the binary. */
BINARY_HASH;

Check warning on line 19 in sdk/profiles/src/main/java/io/opentelemetry/sdk/profiles/data/BuildIdKind.java

View check run for this annotation

Codecov / codecov/patch

sdk/profiles/src/main/java/io/opentelemetry/sdk/profiles/data/BuildIdKind.java#L19

Added line #L19 was not covered by tests
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.sdk.profiles.data;

import javax.annotation.concurrent.Immutable;

/**
* 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. */
long getNameIndex();

/**
* 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. */
long getFilenameIndex();

/** Line number in source file. */
long getStartLine();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.sdk.profiles.data;

import javax.annotation.concurrent.Immutable;

/**
* 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. */
long getKeyIndex();

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

/** 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.
*/
long getNumUnitIndex();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.sdk.profiles.data;

import javax.annotation.concurrent.Immutable;

/**
* 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. */
long getFunctionIndex();

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

/** Column number in source code. */
long getColumn();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.sdk.profiles.data;

import javax.annotation.concurrent.Immutable;

/**
* 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. */
@SuppressWarnings("mutable")
byte[] getTraceId();
jhalliday marked this conversation as resolved.
Show resolved Hide resolved

/** A unique identifier for the linked span. The ID is an 8-byte array. */
@SuppressWarnings("mutable")
byte[] getSpanId();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.sdk.profiles.data;

import java.util.List;
import javax.annotation.concurrent.Immutable;

/**
* 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.
*
* @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.
*/
long getMappingIndex();

/** 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.
*/
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.
*/
boolean isFolded();

/** Type of frame (e.g. kernel, native, python, hotspot, php). Index into string table. */
int getTypeIndex();
jhalliday marked this conversation as resolved.
Show resolved Hide resolved

/** References to attributes in Profile.attribute_table. */
List<Long> getAttributes();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.sdk.profiles.data;

import java.util.List;
import javax.annotation.concurrent.Immutable;

/**
* 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();
jhalliday marked this conversation as resolved.
Show resolved Hide resolved

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

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

/** 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.
*/
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.
*/
long getBuildIdIndex();

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

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

boolean hasFunctions();

boolean hasFilenames();

boolean hasLineNumbers();

boolean hasInlineFrames();
}
Loading
Loading