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

Update opentelementry-proto to 1.4 #6906

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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.1",
"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 @@
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) {
jack-berg marked this conversation as resolved.
Show resolved Hide resolved
if (values.isEmpty()) {
return 0;

Check warning on line 236 in exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/MarshalerUtil.java

View check run for this annotation

Codecov / codecov/patch

exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/MarshalerUtil.java#L236

Added line #L236 was not covered by tests
}

int payloadSize = 0;

Check warning on line 239 in exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/MarshalerUtil.java

View check run for this annotation

Codecov / codecov/patch

exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/MarshalerUtil.java#L239

Added line #L239 was not covered by tests
for (int v : values) {
payloadSize += CodedOutputStream.computeInt32SizeNoTag(v);
}

Check warning on line 242 in exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/MarshalerUtil.java

View check run for this annotation

Codecov / codecov/patch

exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/MarshalerUtil.java#L241-L242

Added lines #L241 - L242 were not covered by tests

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

Check warning on line 245 in exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/MarshalerUtil.java

View check run for this annotation

Codecov / codecov/patch

exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/MarshalerUtil.java#L245

Added line #L245 was not covered by tests
}

/** 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 @@
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);

Check warning on line 335 in exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/MarshalerUtil.java

View check run for this annotation

Codecov / codecov/patch

exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/MarshalerUtil.java#L335

Added line #L335 was not covered by tests
}

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

Check warning on line 341 in exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/MarshalerUtil.java

View check run for this annotation

Codecov / codecov/patch

exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/MarshalerUtil.java#L341

Added line #L341 was not covered by tests
}
return sizeInt32Optional(field, (int) message);

Check warning on line 343 in exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/MarshalerUtil.java

View check run for this annotation

Codecov / codecov/patch

exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/MarshalerUtil.java#L343

Added line #L343 was not covered by tests
}

/** 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 @@

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

/** Serializes a protobuf {@code uint32} field. */
/** Serializes a protobuf {@code int32} field. */
Copy link
Contributor

Choose a reason for hiding this comment

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

So - IIRC - this is actually how we serialize both uint32 and int32 in Java.

public void serializeInt32(ProtoFieldInfo field, int value) throws IOException {
if (value == 0) {
return;
}
writeint32(field, value);
}

/** Serializes a protobuf {@code int32} field. */
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I'd explicitly call this out as serialization a {@code optional int32} field.

Yes, it's in the name of the method.

public void serializeInt32Optional(ProtoFieldInfo field, int value) throws IOException {
writeint32(field, value);
}

Check warning on line 136 in exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/Serializer.java

View check run for this annotation

Codecov / codecov/patch

exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/Serializer.java#L135-L136

Added lines #L135 - L136 were not covered by tests

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

Check warning on line 142 in exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/Serializer.java

View check run for this annotation

Codecov / codecov/patch

exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/Serializer.java#L142

Added line #L142 was not covered by tests
}
}

Check warning on line 144 in exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/Serializer.java

View check run for this annotation

Codecov / codecov/patch

exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/Serializer.java#L144

Added line #L144 was not covered by tests

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 writeEndRepeatedVarint() throws IOException;

/** Serializes a {@code repeated int32} field. */
public void serializeRepeatedInt32(ProtoFieldInfo field, List<Integer> values)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Maybe take Collection instead of List for more flexibility here.

Copy link
Member

Choose a reason for hiding this comment

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

List is already used elsewhere in methods serializing repeated fields. I agree that Collection is more flexible, but shouldn't obligate @jhalliday to make that switch here. If Jonathan wants to follow the "boy scout rule", and bundle the switch to Collection in with this PR, I'm open to that. Can also open a separate issue and resolve in a followup PR.

throws IOException {
if (values.isEmpty()) {
return;

Check warning on line 360 in exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/Serializer.java

View check run for this annotation

Codecov / codecov/patch

exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/Serializer.java#L360

Added line #L360 was not covered by tests
}

int payloadSize = 0;

Check warning on line 363 in exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/Serializer.java

View check run for this annotation

Codecov / codecov/patch

exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/Serializer.java#L363

Added line #L363 was not covered by tests
for (int v : values) {
payloadSize += CodedOutputStream.computeInt32SizeNoTag(v);
}

Check warning on line 366 in exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/Serializer.java

View check run for this annotation

Codecov / codecov/patch

exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/Serializer.java#L365-L366

Added lines #L365 - L366 were not covered by tests

writeStartRepeatedVarint(field, payloadSize);

Check warning on line 368 in exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/Serializer.java

View check run for this annotation

Codecov / codecov/patch

exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/Serializer.java#L368

Added line #L368 was not covered by tests
for (int value : values) {
writeUInt64Value(value);
}
writeEndRepeatedVarint();
}

Check warning on line 373 in exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/Serializer.java

View check run for this annotation

Codecov / codecov/patch

exporters/common/src/main/java/io/opentelemetry/exporter/internal/marshal/Serializer.java#L370-L373

Added lines #L370 - L373 were not covered by tests

/** 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
Loading