Skip to content

Commit 809457d

Browse files
authored
Add exporter data classes for experimental profiling signal type. (#6374)
1 parent 788347e commit 809457d

17 files changed

+584
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
plugins {
2+
id("otel.java-conventions")
3+
id("otel.publish-conventions")
4+
5+
id("otel.animalsniffer-conventions")
6+
}
7+
8+
description = "OpenTelemetry - Profiles Exporter"
9+
otelJava.moduleName.set("io.opentelemetry.exporter.otlp.profiles")
10+
11+
dependencies {
12+
api(project(":sdk:common"))
13+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
otel.release=alpha
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.exporter.otlp.profiles;
7+
8+
/**
9+
* Specifies the method of aggregating metric values.
10+
*
11+
* <p>TODO: This is intentionally not the same as metrics/AggregationTemporality. For profiles.proto
12+
* 'v1experimental' version, this class is considered distinct from the pre-exiting
13+
* AggregationTemporality in metrics.proto. As the profiles.proto stabilises, they may be refactored
14+
* into a version in common.proto. Meanwhile the Java class structure reflects the .proto structure
15+
* in making distinct entities.
16+
*
17+
* <p>refs for refactoring discussion:
18+
*
19+
* @see
20+
* "https://github.com/open-telemetry/opentelemetry-proto/blob/v1.3.0/opentelemetry/proto/metrics/v1/metrics.proto#L261"
21+
* @see
22+
* "https://github.com/open-telemetry/opentelemetry-proto/blob/v1.3.0/opentelemetry/proto/profiles/v1experimental/pprofextended.proto#L147"
23+
* @see "https://github.com/open-telemetry/opentelemetry-proto/issues/547"
24+
* @see "https://github.com/open-telemetry/opentelemetry-proto/pull/534#discussion_r1552403726"
25+
* @see "profiles.proto::AggregationTemporality"
26+
*/
27+
public enum AggregationTemporality {
28+
29+
/**
30+
* DELTA is an AggregationTemporality for a profiler which reports changes since last report time.
31+
*/
32+
DELTA,
33+
34+
/**
35+
* CUMULATIVE is an AggregationTemporality for a profiler which reports changes since a fixed
36+
* start time.
37+
*/
38+
CUMULATIVE
39+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.exporter.otlp.profiles;
7+
8+
import javax.annotation.concurrent.Immutable;
9+
10+
/**
11+
* Represents a mapping between Attribute Keys and Units.
12+
*
13+
* @see "pprofextended.proto::AttributeUnit"
14+
*/
15+
@Immutable
16+
public interface AttributeUnitData {
17+
18+
/** Index into string table. */
19+
long getAttributeKey();
20+
21+
/** Index into string table. */
22+
long getUnitIndex();
23+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.exporter.otlp.profiles;
7+
8+
/**
9+
* Indicates the semantics of the build_id field.
10+
*
11+
* @see "pprofextended.proto::BuildIdKind"
12+
*/
13+
public enum BuildIdKind {
14+
15+
/** Linker-generated build ID, stored in the ELF binary notes. */
16+
LINKER,
17+
18+
/** Build ID based on the content hash of the binary. */
19+
BINARY_HASH;
20+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.exporter.otlp.profiles;
7+
8+
import javax.annotation.concurrent.Immutable;
9+
10+
/**
11+
* Describes a function.
12+
*
13+
* @see "pprofextended.proto::Function"
14+
*/
15+
@Immutable
16+
public interface FunctionData {
17+
18+
/** Name of the function, in human-readable form if available. Index into string table. */
19+
long getNameIndex();
20+
21+
/**
22+
* Name of the function, as identified by the system. For instance, it can be a C++ mangled name.
23+
* Index into string table.
24+
*/
25+
long getSystemNameIndex();
26+
27+
/** Source file containing the function. Index into string table. */
28+
long getFilenameIndex();
29+
30+
/** Line number in source file. */
31+
long getStartLine();
32+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.exporter.otlp.profiles;
7+
8+
import javax.annotation.concurrent.Immutable;
9+
10+
/**
11+
* Provides additional context for a sample, such as thread ID or allocation size, with optional
12+
* units.
13+
*
14+
* @see "pprofextended.proto::Label"
15+
*/
16+
@Immutable
17+
public interface LabelData {
18+
19+
/** Index into string table. */
20+
long getKeyIndex();
21+
22+
/** String value of the label data, if applicable. Index into string table */
23+
long getStrIndex();
24+
25+
/** Numeric value of the label data, if applicable. */
26+
long getNum();
27+
28+
/**
29+
* Specifies the units of num, applicable only if num is present. Use arbitrary string (for
30+
* example, "requests") as a custom count unit.
31+
*/
32+
long getNumUnitIndex();
33+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.exporter.otlp.profiles;
7+
8+
import javax.annotation.concurrent.Immutable;
9+
10+
/**
11+
* Details a specific line in a source code, linked to a function.
12+
*
13+
* @see "pprofextended.proto::Line"
14+
*/
15+
@Immutable
16+
public interface LineData {
17+
18+
/** The index of the corresponding Function for this line. Index into function table. */
19+
long getFunctionIndex();
20+
21+
/** Line number in source code. */
22+
long getLine();
23+
24+
/** Column number in source code. */
25+
long getColumn();
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.exporter.otlp.profiles;
7+
8+
import javax.annotation.concurrent.Immutable;
9+
10+
/**
11+
* A connection from a profile Sample to a trace Span.
12+
*
13+
* @see "pprofextended.proto::Link"
14+
*/
15+
@Immutable
16+
public interface LinkData {
17+
18+
/**
19+
* Returns a unique identifier of a trace that this linked span is part of as 32 character
20+
* lowercase hex String.
21+
*/
22+
String getTraceId();
23+
24+
/** Returns a unique identifier for the linked span, as 16 character lowercase hex String. */
25+
String getSpanId();
26+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.exporter.otlp.profiles;
7+
8+
import java.util.List;
9+
import javax.annotation.concurrent.Immutable;
10+
11+
/**
12+
* Describes a function.
13+
*
14+
* @see "pprofextended.proto::Location"
15+
*/
16+
@Immutable
17+
public interface LocationData {
18+
19+
/**
20+
* The index of the corresponding profile.Mapping for this location. It can be unset if the
21+
* mapping is unknown or not applicable for this profile type.
22+
*/
23+
long getMappingIndex();
24+
25+
/** The instruction address for this location, if available. */
26+
long getAddress();
27+
28+
/**
29+
* Multiple line indicates this location has inlined functions, where the last entry represents
30+
* the caller into which the preceding entries were inlined.
31+
*/
32+
List<LineData> getLines();
33+
34+
/**
35+
* Provides an indication that multiple symbols map to this location's address, for example due to
36+
* identical code folding by the linker.
37+
*/
38+
boolean isFolded();
39+
40+
/** Type of frame (e.g. kernel, native, python, hotspot, php). Index into string table. */
41+
int getTypeIndex();
42+
43+
/** References to attributes in Profile.attribute_table. */
44+
List<Long> getAttributes();
45+
}

0 commit comments

Comments
 (0)