Skip to content

Commit f360e4c

Browse files
authored
Update to OTLP 1.1, regenerate protos and pdata (#9588)
**Description:** Updates to OTLP 1.1, published in January 2024. Updates the `otel/build-protobuf` Docker image to the current release label. User-visible protocol changes: Adds Span flags and SpanLink flags. **Link to tracking Issue:** Fixes #9587 Fixes #9550 **Testing:** `make test` **Documentation:** Could not find any documentation on this process, added some in CONTRIBUTING.md.
1 parent f11c5bb commit f360e4c

File tree

12 files changed

+296
-71
lines changed

12 files changed

+296
-71
lines changed

.chloggen/update-otlp.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
change_type: enhancement
2+
component: pdata
3+
note: Update to OTLP v1.1.0
4+
issues: [9587]
5+
subtext: Introduces Span and SpanLink flags.
6+
change_logs: [user]

CONTRIBUTING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,19 @@ target would result in unacceptable latency in the local development loop.
661661
The default repo-level target (i.e. running `make` at the root of the repo) should meaningfully validate the entire repo. This should include
662662
running the default common target for each module as well as additional repo-level targets.
663663

664+
## How to update the OTLP protocol version
665+
666+
When a new OTLP version is published, the following steps are required to update this code base:
667+
668+
1. Edit the top-level Makefile's `OPENTELEMETRY_PROTO_VERSION` variable
669+
2. Run `make genproto`
670+
3. Inspect modifications to the generated code in `pdata/internal/data/protogen`
671+
4. When new fields are added in the protocol, make corresponding changes in `pdata/internal/cmd/pdatagen/internal`
672+
5. Run `make genpdata`
673+
6. Inspect modifications to the generated code in `pdata/*`
674+
7. Run `make genproto-cleanup`, to remove temporary files
675+
8. Update the supported OTLP version in [README.md](./README.md).
676+
664677
## Exceptions
665678

666679
While the rules in this and other documents in this repository is what we strive to follow, we acknowledge that rules may be

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ ocb:
156156
# The source directory for OTLP ProtoBufs.
157157
OPENTELEMETRY_PROTO_SRC_DIR=pdata/internal/opentelemetry-proto
158158

159-
# The SHA matching the current version of the proto to use
160-
OPENTELEMETRY_PROTO_VERSION=v1.0.0
159+
# The branch matching the current version of the proto to use
160+
OPENTELEMETRY_PROTO_VERSION=v1.1.0
161161

162162
# Find all .proto files.
163163
OPENTELEMETRY_PROTO_FILES := $(subst $(OPENTELEMETRY_PROTO_SRC_DIR)/,,$(wildcard $(OPENTELEMETRY_PROTO_SRC_DIR)/opentelemetry/proto/*/v1/*.proto $(OPENTELEMETRY_PROTO_SRC_DIR)/opentelemetry/proto/collector/*/v1/*.proto))
@@ -171,7 +171,7 @@ PROTO_PACKAGE=go.opentelemetry.io/collector/$(PROTO_TARGET_GEN_DIR)
171171
# Intermediate directory used during generation.
172172
PROTO_INTERMEDIATE_DIR=pdata/internal/.patched-otlp-proto
173173

174-
DOCKER_PROTOBUF ?= otel/build-protobuf:0.9.0
174+
DOCKER_PROTOBUF ?= otel/build-protobuf:0.23.0
175175
PROTOC := docker run --rm -u ${shell id -u} -v${PWD}:${PWD} -w${PWD}/$(PROTO_INTERMEDIATE_DIR) ${DOCKER_PROTOBUF} --proto_path=${PWD}
176176
PROTO_INCLUDES := -I/usr/include/github.com/gogo/protobuf -I./
177177

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ Objectives:
5959
- Extensible: Customizable without touching the core code.
6060
- Unified: Single codebase, deployable as an agent or collector with support for traces, metrics and logs.
6161

62+
## Supported OTLP version
63+
64+
This code base is currently built against using OTLP protocol v1.1.0,
65+
considered Stable. [See the OpenTelemetry Protocol Stability
66+
definition
67+
here.](https://github.com/open-telemetry/opentelemetry-proto?tab=readme-ov-file#stability-definition)
68+
6269
## Stability levels
6370

6471
The collector components and implementation are in different stages of stability, and usually split between

pdata/internal/cmd/pdatagen/internal/ptrace_package.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ var spanSlice = &sliceOfPtrs{
8383
element: span,
8484
}
8585

86+
var flagsField = &primitiveField{
87+
fieldName: "Flags",
88+
returnType: "uint32",
89+
defaultVal: `uint32(0)`,
90+
testVal: `uint32(0xf)`,
91+
}
92+
8693
var span = &messageValueStruct{
8794
structName: "Span",
8895
description: "// Span represents a single operation within a trace.\n" +
@@ -94,6 +101,7 @@ var span = &messageValueStruct{
94101
traceStateField,
95102
parentSpanIDField,
96103
nameField,
104+
flagsField,
97105
&primitiveTypedField{
98106
fieldName: "Kind",
99107
returnType: &primitiveType{
@@ -167,6 +175,7 @@ var spanLink = &messageValueStruct{
167175
traceIDField,
168176
spanIDField,
169177
traceStateField,
178+
flagsField,
170179
attributes,
171180
droppedAttributesCount,
172181
},

pdata/internal/data/protogen/logs/v1/logs.pb.go

Lines changed: 11 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pdata/internal/data/protogen/metrics/v1/metrics.pb.go

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)