Skip to content

Commit

Permalink
Update opentelementry-proto to 1.4 (#6906)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhalliday authored Dec 2, 2024
1 parent 9b2f6ba commit 3df2068
Show file tree
Hide file tree
Showing 42 changed files with 524 additions and 853 deletions.
8 changes: 7 additions & 1 deletion buildSrc/src/main/kotlin/otel.japicmp-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,13 @@ if (!project.hasProperty("otel.release") && !project.name.startsWith("bom")) {

// this is needed so that we only consider the current artifact, and not dependencies
ignoreMissingClasses.set(true)
packageExcludes.addAll("*.internal", "*.internal.*", "io.opentelemetry.internal.shaded.jctools.*")
packageExcludes.addAll(
"*.internal",
"*.internal.*",
"io.opentelemetry.internal.shaded.jctools.*",
// Temporarily suppress warnings from public generated classes from :sdk-extensions:jaeger-remote-sampler
"io.opentelemetry.sdk.extension.trace.jaeger.proto.api_v2"
)
val baseVersionString = if (apiBaseVersion == null) "latest" else baselineVersion
txtOutputFile.set(
apiNewVersion?.let { file("$rootDir/docs/apidiffs/${apiNewVersion}_vs_$baselineVersion/${base.archivesName.get()}.txt") }
Expand Down
4 changes: 2 additions & 2 deletions dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ rootProject.extra["versions"] = dependencyVersions
val DEPENDENCY_BOMS = listOf(
"com.fasterxml.jackson:jackson-bom:2.18.2",
"com.google.guava:guava-bom:33.3.1-jre",
"com.google.protobuf:protobuf-bom:3.25.5",
"com.google.protobuf:protobuf-bom:4.28.3",
"com.linecorp.armeria:armeria-bom:1.31.1",
"com.squareup.okhttp3:okhttp-bom:4.12.0",
"com.squareup.okio:okio-bom:3.9.1", // applies to transitive dependencies of okhttp
Expand Down Expand Up @@ -69,7 +69,7 @@ val DEPENDENCIES = listOf(
"io.jaegertracing:jaeger-client:1.8.1",
"io.opentelemetry.contrib:opentelemetry-aws-xray-propagator:1.39.0-alpha",
"io.opentelemetry.semconv:opentelemetry-semconv-incubating:1.28.0-alpha",
"io.opentelemetry.proto:opentelemetry-proto:1.3.2-alpha",
"io.opentelemetry.proto:opentelemetry-proto:1.4.0-alpha",
"io.opentracing:opentracing-api:0.33.0",
"io.opentracing:opentracing-noop:0.33.0",
"io.prometheus:prometheus-metrics-exporter-httpserver:1.3.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,26 @@ public static int sizeRepeatedInt64(ProtoFieldInfo field, List<Long> values) {
return field.getTagSize() + CodedOutputStream.computeUInt32SizeNoTag(payloadSize) + payloadSize;
}

/**
* Returns the size of a repeated int32 field.
*
* <p>Packed repeated fields contain the tag, an integer representing the incoming payload size,
* and an actual payload of repeated varints.
*/
public static int sizeRepeatedInt32(ProtoFieldInfo field, List<Integer> values) {
if (values.isEmpty()) {
return 0;
}

int payloadSize = 0;
for (int v : values) {
payloadSize += CodedOutputStream.computeInt32SizeNoTag(v);
}

// tag size + payload indicator size + actual payload size
return field.getTagSize() + CodedOutputStream.computeUInt32SizeNoTag(payloadSize) + payloadSize;
}

/** Returns the size of a repeated double field. */
public static int sizeRepeatedDouble(ProtoFieldInfo field, List<Double> values) {
// Same as fixed64.
Expand Down Expand Up @@ -310,6 +330,19 @@ public static int sizeInt32(ProtoFieldInfo field, int message) {
return field.getTagSize() + CodedOutputStream.computeInt32SizeNoTag(message);
}

/** Returns the size of an optional int32 field. */
public static int sizeInt32Optional(ProtoFieldInfo field, int message) {
return field.getTagSize() + CodedOutputStream.computeInt32SizeNoTag(message);
}

/** Returns the size of an optional int32 field. */
public static int sizeInt32Optional(ProtoFieldInfo field, @Nullable Integer message) {
if (message == null) {
return 0;
}
return sizeInt32Optional(field, (int) message);
}

/** Returns the size of a double field. */
public static int sizeDouble(ProtoFieldInfo field, double value) {
if (value == 0D) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,27 @@ public void serializeSInt32(ProtoFieldInfo field, int value) throws IOException

protected abstract void writeSInt32(ProtoFieldInfo info, int value) throws IOException;

/** Serializes a protobuf {@code uint32} field. */
/** Serializes a protobuf {@code int32} field. */
public void serializeInt32(ProtoFieldInfo field, int value) throws IOException {
if (value == 0) {
return;
}
writeint32(field, value);
}

/** Serializes a protobuf {@code int32} field. */
public void serializeInt32Optional(ProtoFieldInfo field, int value) throws IOException {
writeint32(field, value);
}

/** Serializes a protobuf {@code int32} field. */
public void serializeInt32Optional(ProtoFieldInfo field, @Nullable Integer value)
throws IOException {
if (value != null) {
serializeInt32Optional(field, (int) value);
}
}

protected abstract void writeint32(ProtoFieldInfo field, int value) throws IOException;

/** Serializes a protobuf {@code int64} field. */
Expand Down Expand Up @@ -340,6 +353,25 @@ protected abstract void writeStartRepeatedVarint(ProtoFieldInfo field, int paylo

protected abstract void writeEndRepeatedVarint() throws IOException;

/** Serializes a {@code repeated int32} field. */
public void serializeRepeatedInt32(ProtoFieldInfo field, List<Integer> values)
throws IOException {
if (values.isEmpty()) {
return;
}

int payloadSize = 0;
for (int v : values) {
payloadSize += CodedOutputStream.computeInt32SizeNoTag(v);
}

writeStartRepeatedVarint(field, payloadSize);
for (int value : values) {
writeUInt64Value(value);
}
writeEndRepeatedVarint();
}

/** Serializes a {@code repeated fixed64} field. */
public void serializeRepeatedFixed64(ProtoFieldInfo field, List<Long> values) throws IOException {
if (values.isEmpty()) {
Expand Down
2 changes: 1 addition & 1 deletion exporters/otlp/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ wire {
"opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest",
"opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest",
"opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest",
"opentelemetry.proto.collector.profiles.v1experimental.ExportProfilesServiceRequest"
"opentelemetry.proto.collector.profiles.v1development.ExportProfilesServiceRequest"
)

custom {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public abstract class ImmutableAttributeUnitData implements AttributeUnitData {
*
* @return a new AttributeUnitData mapping the given key to the given unit.
*/
public static AttributeUnitData create(long attributeKey, long unitIndex) {
return new AutoValue_ImmutableAttributeUnitData(attributeKey, unitIndex);
public static AttributeUnitData create(int attributeKeyStringIndex, int unitStringIndex) {
return new AutoValue_ImmutableAttributeUnitData(attributeKeyStringIndex, unitStringIndex);
}

ImmutableAttributeUnitData() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public abstract class ImmutableFunctionData implements FunctionData {
* @return a new FunctionData describing the given function characteristics.
*/
public static FunctionData create(
long nameIndex, long systemNameIndex, long filenameIndex, long startLine) {
int nameStringIndex, int systemNameStringIndex, int filenameStringIndex, long startLine) {
return new AutoValue_ImmutableFunctionData(
nameIndex, systemNameIndex, filenameIndex, startLine);
nameStringIndex, systemNameStringIndex, filenameStringIndex, startLine);
}

ImmutableFunctionData() {}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public abstract class ImmutableLineData implements LineData {
*
* @return a new LineData describing the given details a specific line in a source code.
*/
public static LineData create(long functionIndex, long line, long column) {
public static LineData create(int functionIndex, long line, long column) {
return new AutoValue_ImmutableLineData(functionIndex, line, column);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ public abstract class ImmutableLocationData implements LocationData {
* @return a new LocationData describing the given function and line table information.
*/
public static LocationData create(
long mappingIndex,
Integer mappingIndex,
long address,
List<LineData> lines,
boolean folded,
int typeIndex,
List<Long> attributes) {
List<Integer> attributeIndices) {
return new AutoValue_ImmutableLocationData(
mappingIndex, address, lines, folded, typeIndex, attributes);
mappingIndex, address, lines, folded, attributeIndices);
}

ImmutableLocationData() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package io.opentelemetry.exporter.otlp.internal.data;

import com.google.auto.value.AutoValue;
import io.opentelemetry.exporter.otlp.profiles.BuildIdKind;
import io.opentelemetry.exporter.otlp.profiles.MappingData;
import java.util.List;
import javax.annotation.concurrent.Immutable;
Expand All @@ -32,10 +31,8 @@ public static MappingData create(
long memoryStart,
long memoryLimit,
long fileOffset,
long filenameIndex,
long buildIdIndex,
BuildIdKind buildIdKind,
List<Long> attributeIndices,
int filenameStringIndex,
List<Integer> attributeIndices,
boolean hasFunctions,
boolean hasFilenames,
boolean hasLineNumbers,
Expand All @@ -44,9 +41,7 @@ public static MappingData create(
memoryStart,
memoryLimit,
fileOffset,
filenameIndex,
buildIdIndex,
buildIdKind,
filenameStringIndex,
attributeIndices,
hasFunctions,
hasFilenames,
Expand Down

This file was deleted.

Loading

0 comments on commit 3df2068

Please sign in to comment.