Skip to content

Commit 3df2068

Browse files
authored
Update opentelementry-proto to 1.4 (#6906)
1 parent 9b2f6ba commit 3df2068

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+524
-853
lines changed

buildSrc/src/main/kotlin/otel.japicmp-conventions.gradle.kts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,13 @@ if (!project.hasProperty("otel.release") && !project.name.startsWith("bom")) {
181181

182182
// this is needed so that we only consider the current artifact, and not dependencies
183183
ignoreMissingClasses.set(true)
184-
packageExcludes.addAll("*.internal", "*.internal.*", "io.opentelemetry.internal.shaded.jctools.*")
184+
packageExcludes.addAll(
185+
"*.internal",
186+
"*.internal.*",
187+
"io.opentelemetry.internal.shaded.jctools.*",
188+
// Temporarily suppress warnings from public generated classes from :sdk-extensions:jaeger-remote-sampler
189+
"io.opentelemetry.sdk.extension.trace.jaeger.proto.api_v2"
190+
)
185191
val baseVersionString = if (apiBaseVersion == null) "latest" else baselineVersion
186192
txtOutputFile.set(
187193
apiNewVersion?.let { file("$rootDir/docs/apidiffs/${apiNewVersion}_vs_$baselineVersion/${base.archivesName.get()}.txt") }

dependencyManagement/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ rootProject.extra["versions"] = dependencyVersions
1010
val DEPENDENCY_BOMS = listOf(
1111
"com.fasterxml.jackson:jackson-bom:2.18.2",
1212
"com.google.guava:guava-bom:33.3.1-jre",
13-
"com.google.protobuf:protobuf-bom:3.25.5",
13+
"com.google.protobuf:protobuf-bom:4.28.3",
1414
"com.linecorp.armeria:armeria-bom:1.31.1",
1515
"com.squareup.okhttp3:okhttp-bom:4.12.0",
1616
"com.squareup.okio:okio-bom:3.9.1", // applies to transitive dependencies of okhttp
@@ -69,7 +69,7 @@ val DEPENDENCIES = listOf(
6969
"io.jaegertracing:jaeger-client:1.8.1",
7070
"io.opentelemetry.contrib:opentelemetry-aws-xray-propagator:1.39.0-alpha",
7171
"io.opentelemetry.semconv:opentelemetry-semconv-incubating:1.28.0-alpha",
72-
"io.opentelemetry.proto:opentelemetry-proto:1.3.2-alpha",
72+
"io.opentelemetry.proto:opentelemetry-proto:1.4.0-alpha",
7373
"io.opentracing:opentracing-api:0.33.0",
7474
"io.opentracing:opentracing-noop:0.33.0",
7575
"io.prometheus:prometheus-metrics-exporter-httpserver:1.3.3",

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,26 @@ public static int sizeRepeatedInt64(ProtoFieldInfo field, List<Long> values) {
225225
return field.getTagSize() + CodedOutputStream.computeUInt32SizeNoTag(payloadSize) + payloadSize;
226226
}
227227

228+
/**
229+
* Returns the size of a repeated int32 field.
230+
*
231+
* <p>Packed repeated fields contain the tag, an integer representing the incoming payload size,
232+
* and an actual payload of repeated varints.
233+
*/
234+
public static int sizeRepeatedInt32(ProtoFieldInfo field, List<Integer> values) {
235+
if (values.isEmpty()) {
236+
return 0;
237+
}
238+
239+
int payloadSize = 0;
240+
for (int v : values) {
241+
payloadSize += CodedOutputStream.computeInt32SizeNoTag(v);
242+
}
243+
244+
// tag size + payload indicator size + actual payload size
245+
return field.getTagSize() + CodedOutputStream.computeUInt32SizeNoTag(payloadSize) + payloadSize;
246+
}
247+
228248
/** Returns the size of a repeated double field. */
229249
public static int sizeRepeatedDouble(ProtoFieldInfo field, List<Double> values) {
230250
// Same as fixed64.
@@ -310,6 +330,19 @@ public static int sizeInt32(ProtoFieldInfo field, int message) {
310330
return field.getTagSize() + CodedOutputStream.computeInt32SizeNoTag(message);
311331
}
312332

333+
/** Returns the size of an optional int32 field. */
334+
public static int sizeInt32Optional(ProtoFieldInfo field, int message) {
335+
return field.getTagSize() + CodedOutputStream.computeInt32SizeNoTag(message);
336+
}
337+
338+
/** Returns the size of an optional int32 field. */
339+
public static int sizeInt32Optional(ProtoFieldInfo field, @Nullable Integer message) {
340+
if (message == null) {
341+
return 0;
342+
}
343+
return sizeInt32Optional(field, (int) message);
344+
}
345+
313346
/** Returns the size of a double field. */
314347
public static int sizeDouble(ProtoFieldInfo field, double value) {
315348
if (value == 0D) {

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

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,27 @@ public void serializeSInt32(ProtoFieldInfo field, int value) throws IOException
122122

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

125-
/** Serializes a protobuf {@code uint32} field. */
125+
/** Serializes a protobuf {@code int32} field. */
126126
public void serializeInt32(ProtoFieldInfo field, int value) throws IOException {
127127
if (value == 0) {
128128
return;
129129
}
130130
writeint32(field, value);
131131
}
132132

133+
/** Serializes a protobuf {@code int32} field. */
134+
public void serializeInt32Optional(ProtoFieldInfo field, int value) throws IOException {
135+
writeint32(field, value);
136+
}
137+
138+
/** Serializes a protobuf {@code int32} field. */
139+
public void serializeInt32Optional(ProtoFieldInfo field, @Nullable Integer value)
140+
throws IOException {
141+
if (value != null) {
142+
serializeInt32Optional(field, (int) value);
143+
}
144+
}
145+
133146
protected abstract void writeint32(ProtoFieldInfo field, int value) throws IOException;
134147

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

341354
protected abstract void writeEndRepeatedVarint() throws IOException;
342355

356+
/** Serializes a {@code repeated int32} field. */
357+
public void serializeRepeatedInt32(ProtoFieldInfo field, List<Integer> values)
358+
throws IOException {
359+
if (values.isEmpty()) {
360+
return;
361+
}
362+
363+
int payloadSize = 0;
364+
for (int v : values) {
365+
payloadSize += CodedOutputStream.computeInt32SizeNoTag(v);
366+
}
367+
368+
writeStartRepeatedVarint(field, payloadSize);
369+
for (int value : values) {
370+
writeUInt64Value(value);
371+
}
372+
writeEndRepeatedVarint();
373+
}
374+
343375
/** Serializes a {@code repeated fixed64} field. */
344376
public void serializeRepeatedFixed64(ProtoFieldInfo field, List<Long> values) throws IOException {
345377
if (values.isEmpty()) {

exporters/otlp/common/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ wire {
4242
"opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest",
4343
"opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest",
4444
"opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest",
45-
"opentelemetry.proto.collector.profiles.v1experimental.ExportProfilesServiceRequest"
45+
"opentelemetry.proto.collector.profiles.v1development.ExportProfilesServiceRequest"
4646
)
4747

4848
custom {

exporters/otlp/profiles/src/main/java/io/opentelemetry/exporter/otlp/internal/data/ImmutableAttributeUnitData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public abstract class ImmutableAttributeUnitData implements AttributeUnitData {
2525
*
2626
* @return a new AttributeUnitData mapping the given key to the given unit.
2727
*/
28-
public static AttributeUnitData create(long attributeKey, long unitIndex) {
29-
return new AutoValue_ImmutableAttributeUnitData(attributeKey, unitIndex);
28+
public static AttributeUnitData create(int attributeKeyStringIndex, int unitStringIndex) {
29+
return new AutoValue_ImmutableAttributeUnitData(attributeKeyStringIndex, unitStringIndex);
3030
}
3131

3232
ImmutableAttributeUnitData() {}

exporters/otlp/profiles/src/main/java/io/opentelemetry/exporter/otlp/internal/data/ImmutableFunctionData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ public abstract class ImmutableFunctionData implements FunctionData {
2525
* @return a new FunctionData describing the given function characteristics.
2626
*/
2727
public static FunctionData create(
28-
long nameIndex, long systemNameIndex, long filenameIndex, long startLine) {
28+
int nameStringIndex, int systemNameStringIndex, int filenameStringIndex, long startLine) {
2929
return new AutoValue_ImmutableFunctionData(
30-
nameIndex, systemNameIndex, filenameIndex, startLine);
30+
nameStringIndex, systemNameStringIndex, filenameStringIndex, startLine);
3131
}
3232

3333
ImmutableFunctionData() {}

exporters/otlp/profiles/src/main/java/io/opentelemetry/exporter/otlp/internal/data/ImmutableLabelData.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

exporters/otlp/profiles/src/main/java/io/opentelemetry/exporter/otlp/internal/data/ImmutableLineData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public abstract class ImmutableLineData implements LineData {
2525
*
2626
* @return a new LineData describing the given details a specific line in a source code.
2727
*/
28-
public static LineData create(long functionIndex, long line, long column) {
28+
public static LineData create(int functionIndex, long line, long column) {
2929
return new AutoValue_ImmutableLineData(functionIndex, line, column);
3030
}
3131

exporters/otlp/profiles/src/main/java/io/opentelemetry/exporter/otlp/internal/data/ImmutableLocationData.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@ public abstract class ImmutableLocationData implements LocationData {
2828
* @return a new LocationData describing the given function and line table information.
2929
*/
3030
public static LocationData create(
31-
long mappingIndex,
31+
Integer mappingIndex,
3232
long address,
3333
List<LineData> lines,
3434
boolean folded,
35-
int typeIndex,
36-
List<Long> attributes) {
35+
List<Integer> attributeIndices) {
3736
return new AutoValue_ImmutableLocationData(
38-
mappingIndex, address, lines, folded, typeIndex, attributes);
37+
mappingIndex, address, lines, folded, attributeIndices);
3938
}
4039

4140
ImmutableLocationData() {}

0 commit comments

Comments
 (0)