Skip to content

Commit 0a43c1f

Browse files
authored
[BUILD] Upgrade to opentelemetry-proto 1.3.2 (#2991)
1 parent aac2b77 commit 0a43c1f

File tree

6 files changed

+328
-7
lines changed

6 files changed

+328
-7
lines changed

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ bazel_dep(name = "bazel_skylib", version = "1.5.0")
1313
bazel_dep(name = "curl", version = "8.8.0")
1414
bazel_dep(name = "grpc", version = "1.63.1.bcr.1", repo_name = "com_github_grpc_grpc")
1515
bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "github_nlohmann_json")
16-
bazel_dep(name = "opentelemetry-proto", version = "1.3.1", repo_name = "com_github_opentelemetry_proto")
16+
bazel_dep(name = "opentelemetry-proto", version = "1.3.2", repo_name = "com_github_opentelemetry_proto")
1717
bazel_dep(name = "opentracing-cpp", version = "1.6.0", repo_name = "com_github_opentracing")
1818
bazel_dep(name = "platforms", version = "0.0.8")
1919
bazel_dep(name = "prometheus-cpp", version = "1.2.4", repo_name = "com_github_jupp0r_prometheus_cpp")

bazel/repository.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ def opentelemetry_cpp_deps():
8888
http_archive,
8989
name = "com_github_opentelemetry_proto",
9090
build_file = "@io_opentelemetry_cpp//bazel:opentelemetry_proto.BUILD",
91-
sha256 = "bed250ceec8e4a83aa5604d7d5595a61945059dc662edd058a9da082283f7a00",
92-
strip_prefix = "opentelemetry-proto-1.3.1",
91+
sha256 = "c069c0d96137cf005d34411fa67dd3b6f1f8c64af1e7fb2fe0089a41c425acd7",
92+
strip_prefix = "opentelemetry-proto-1.3.2",
9393
urls = [
94-
"https://github.com/open-telemetry/opentelemetry-proto/archive/v1.3.1.tar.gz",
94+
"https://github.com/open-telemetry/opentelemetry-proto/archive/v1.3.2.tar.gz",
9595
],
9696
)
9797

cmake/opentelemetry-proto.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ else()
4949
"opentelemetry-proto=[ \\t]*([A-Za-z0-9_\\.\\-]+)")
5050
set(opentelemetry-proto "${CMAKE_MATCH_1}")
5151
else()
52-
set(opentelemetry-proto "v1.3.1")
52+
set(opentelemetry-proto "v1.3.2")
5353
endif()
5454
unset(OTELCPP_THIRD_PARTY_RELEASE_CONTENT)
5555
endif()

docs/maintaining-dependencies.md

Lines changed: 321 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,321 @@
1+
2+
# Maintaining dependencies
3+
4+
In general, several places in the code base need to be adjusted when
5+
upgrading a dependency to a new version.
6+
7+
This documentation contains notes about which place to fix,
8+
to make maintenance easier and less error prone.
9+
10+
This doc is only useful when up to date,
11+
so make sure to add details about missing parts if any.
12+
13+
Also, another good place to start when upgrading something to N+1
14+
is to find the commit that upgraded to version N (use `git blame`),
15+
and inspect the commit for the last upgrade.
16+
17+
## opentelemetry-proto
18+
19+
### Comments
20+
21+
Unlike other opentelemetry SIGs, opentelemetry-cpp generates code
22+
from opentelemetry-proto as part of the opentelemetry-cpp build.
23+
24+
Only the source code of opentelemetry-proto is required,
25+
which is why this repository is used as a git submodule under third_party.
26+
27+
Code is generated by the protobuf compiler during the build,
28+
so that generated code is never checked in.
29+
30+
This allows more flexibility, should the compiler (protobuf) be
31+
upgraded even when the source code (opentelemetry-proto) is unchanged.
32+
33+
### Origin
34+
35+
The repository for opentelemetry-proto is:
36+
37+
* [repository](https://github.com/open-telemetry/opentelemetry-proto)
38+
39+
Check release notes at:
40+
41+
* [release-notes](https://github.com/open-telemetry/opentelemetry-proto/releases)
42+
43+
### Upgrade
44+
45+
When upgrading opentelemetry-proto to a newer release,
46+
a few places in the code need adjustment.
47+
48+
In this example, we upgrade from 1.3.1 to 1.3.2
49+
50+
#### directory third_party/opentelemetry-proto
51+
52+
This is a `git submodule`, it needs to point to the new tag.
53+
54+
```shell
55+
cd third_party/opentelemetry-proto
56+
git log -1
57+
```
58+
59+
The current submodule show something like:
60+
61+
```shell
62+
commit b3060d2104df364136d75a35779e6bd48bac449a (HEAD, tag: v1.3.1)
63+
Author: Damien Mathieu <[email protected]>
64+
Date: Thu Apr 25 17:55:35 2024 +0200
65+
66+
generate profiles proto for CI (#552)
67+
```
68+
69+
Pull new tags:
70+
71+
```shell
72+
git pull --tag origin
73+
```
74+
75+
Upgrade to a new tag:
76+
77+
```shell
78+
git pull origin v1.3.2
79+
```
80+
81+
Check the new state:
82+
83+
```shell
84+
git log -1
85+
```
86+
87+
```shell
88+
commit 40b3c1b746767cbc13c2e39da3eaf1a23e54ffdd (HEAD, tag: v1.3.2)
89+
Author: jack-berg <[email protected]>
90+
Date: Fri Jun 28 08:19:11 2024 -0500
91+
92+
Prepare changelog for 1.3.2 release (#563)
93+
94+
Co-authored-by: Armin Ruech <[email protected]>
95+
```
96+
97+
Go back to the root of opentelemetry-cpp
98+
99+
```shell
100+
cd ../..
101+
git status
102+
```
103+
104+
```shell
105+
On branch upgrade_proto_1.3.2
106+
Changes not staged for commit:
107+
(use "git add <file>..." to update what will be committed)
108+
(use "git restore <file>..." to discard changes in working directory)
109+
modified: third_party/opentelemetry-proto (new commits)
110+
```
111+
112+
Add the upgraded submodule:
113+
114+
```shell
115+
git add third_party/opentelemetry-proto
116+
```
117+
118+
#### file third_party_release
119+
120+
Update the line pointing to the opentelemetry-proto tag.
121+
122+
```text
123+
opentelemetry-proto=v1.3.2
124+
```
125+
126+
Typical change:
127+
128+
```shell
129+
[malff@malff-desktop opentelemetry-cpp]$ git diff third_party_release
130+
diff --git a/third_party_release b/third_party_release
131+
index 0bbf67f3..7362473f 100644
132+
--- a/third_party_release
133+
+++ b/third_party_release
134+
@@ -19,7 +19,7 @@ benchmark=v1.8.3
135+
googletest=1.14.0
136+
ms-gsl=v3.1.0-67-g6f45293
137+
nlohmann-json=v3.11.3
138+
-opentelemetry-proto=v1.3.1
139+
+opentelemetry-proto=v1.3.2
140+
opentracing-cpp=v1.6.0
141+
prometheus-cpp=v1.2.4
142+
vcpkg=2024.02.14
143+
```
144+
145+
#### file bazel/repository.bzl
146+
147+
Locate the entry for opentelemetry-proto:
148+
149+
```text
150+
# OTLP Protocol definition
151+
maybe(
152+
http_archive,
153+
name = "com_github_opentelemetry_proto",
154+
build_file = "@io_opentelemetry_cpp//bazel:opentelemetry_proto.BUILD",
155+
sha256 = "bed250ceec8e4a83aa5604d7d5595a61945059dc662edd058a9da082283f7a00",
156+
strip_prefix = "opentelemetry-proto-1.3.1",
157+
urls = [
158+
"https://github.com/open-telemetry/opentelemetry-proto/archive/v1.3.1.tar.gz",
159+
],
160+
)
161+
```
162+
163+
Update the URL to the new tag:
164+
165+
```text
166+
urls = [
167+
"https://github.com/open-telemetry/opentelemetry-proto/archive/v1.3.2.tar.gz",
168+
],
169+
```
170+
171+
Update strip_prefix to the new tag:
172+
173+
```text
174+
strip_prefix = "opentelemetry-proto-1.3.2",
175+
```
176+
177+
Download the new URL:
178+
179+
```shell
180+
wget https://github.com/open-telemetry/opentelemetry-proto/archive/v1.3.2.tar.gz
181+
```
182+
183+
Run a checksum on the new file:
184+
185+
```shell
186+
sha256sum v1.3.2.tar.gz
187+
```
188+
189+
```shell
190+
c069c0d96137cf005d34411fa67dd3b6f1f8c64af1e7fb2fe0089a41c425acd7 v1.3.2.tar.gz
191+
```
192+
193+
Update the checksum in file bazel/repository.bzl:
194+
195+
```text
196+
sha256 = "c069c0d96137cf005d34411fa67dd3b6f1f8c64af1e7fb2fe0089a41c425acd7",
197+
```
198+
199+
Typical change:
200+
201+
```shell
202+
[malff@malff-desktop opentelemetry-cpp]$ git diff bazel/repository.bzl
203+
diff --git a/bazel/repository.bzl b/bazel/repository.bzl
204+
index bac1e45b..508b95a3 100644
205+
--- a/bazel/repository.bzl
206+
+++ b/bazel/repository.bzl
207+
@@ -88,10 +88,10 @@ def opentelemetry_cpp_deps():
208+
http_archive,
209+
name = "com_github_opentelemetry_proto",
210+
build_file = "@io_opentelemetry_cpp//bazel:opentelemetry_proto.BUILD",
211+
- sha256 = "bed250ceec8e4a83aa5604d7d5595a61945059dc662edd058a9da082283f7a00",
212+
- strip_prefix = "opentelemetry-proto-1.3.1",
213+
+ sha256 = "c069c0d96137cf005d34411fa67dd3b6f1f8c64af1e7fb2fe0089a41c425acd7",
214+
+ strip_prefix = "opentelemetry-proto-1.3.2",
215+
urls = [
216+
- "https://github.com/open-telemetry/opentelemetry-proto/archive/v1.3.1.tar.gz",
217+
+ "https://github.com/open-telemetry/opentelemetry-proto/archive/v1.3.2.tar.gz",
218+
],
219+
)
220+
```
221+
222+
#### file cmake/opentelemetry-proto.cmake
223+
224+
Update the tag in the CMake logic:
225+
226+
```cmake
227+
set(opentelemetry-proto "v1.3.2")
228+
```
229+
230+
Typical change:
231+
232+
```shell
233+
[malff@malff-desktop opentelemetry-cpp]$ git diff cmake/opentelemetry-proto.cmake
234+
diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake
235+
index 19516c3b..dd6213c1 100644
236+
--- a/cmake/opentelemetry-proto.cmake
237+
+++ b/cmake/opentelemetry-proto.cmake
238+
@@ -49,7 +49,7 @@ else()
239+
"opentelemetry-proto=[ \\t]*([A-Za-z0-9_\\.\\-]+)")
240+
set(opentelemetry-proto "${CMAKE_MATCH_1}")
241+
else()
242+
- set(opentelemetry-proto "v1.3.1")
243+
+ set(opentelemetry-proto "v1.3.2")
244+
endif()
245+
unset(OTELCPP_THIRD_PARTY_RELEASE_CONTENT)
246+
endif()
247+
```
248+
249+
If opentelemetry-proto contains new files,
250+
the makefile needs to be adjusted to build the new code.
251+
252+
Depending on the actual changes in the opentelemetry-proto files,
253+
the C++ code in opentelemetry-cpp may need adjustments.
254+
255+
Typically, when opentelemetry-proto:
256+
257+
* defines a new message (for example, for profiling)
258+
* adds new optional fields to an existing message (for example, trace flags)
259+
260+
the existing C++ code should work as is with the new opentelemetry-proto
261+
format.
262+
263+
In this case, it is better to:
264+
265+
* upgrade the opentelemetry-proto version independently with one PR.
266+
* upgrade the C++ code later (to use the new message, of provide new fields)
267+
in a different PR.
268+
269+
When the C++ code requires a newer minimum version of opentelemetry-proto,
270+
make sure to document this, including in the release notes.
271+
272+
#### file MODULE.bazel
273+
274+
Make sure the new tag is available in bazel central:
275+
276+
* [bazel-central](https://registry.bazel.build/modules/opentelemetry-proto)
277+
278+
If missing, file a PR to add it, or contact the maintainer:
279+
280+
* [repository](https://github.com/bazelbuild/bazel-central-registry/tree/main/modules/opentelemetry-proto)
281+
282+
Update the opentelemetry-proto version to the new tag:
283+
284+
```text
285+
bazel_dep(name = "opentelemetry-proto", version = "1.3.2", repo_name = "com_github_opentelemetry_proto")
286+
```
287+
288+
File `MODULE.bazel` is used in the github CI for repository
289+
opentelemetry-cpp, so using a tag that does not exist (yet) in bazel central
290+
will break the CI build.
291+
292+
See the known issues section.
293+
294+
Typical change:
295+
296+
```shell
297+
[malff@malff-desktop opentelemetry-cpp]$ git diff MODULE.bazel
298+
diff --git a/MODULE.bazel b/MODULE.bazel
299+
index 7b84c2b7..3161ffb1 100644
300+
--- a/MODULE.bazel
301+
+++ b/MODULE.bazel
302+
@@ -13,7 +13,7 @@ bazel_dep(name = "bazel_skylib", version = "1.5.0")
303+
bazel_dep(name = "curl", version = "8.4.0")
304+
bazel_dep(name = "grpc", version = "1.62.1", repo_name = "com_github_grpc_grpc")
305+
bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "github_nlohmann_json")
306+
-bazel_dep(name = "opentelemetry-proto", version = "1.3.1", repo_name = "com_github_opentelemetry_proto")
307+
+bazel_dep(name = "opentelemetry-proto", version = "1.3.2", repo_name = "com_github_opentelemetry_proto")
308+
bazel_dep(name = "opentracing-cpp", version = "1.6.0", repo_name = "com_github_opentracing")
309+
bazel_dep(name = "platforms", version = "0.0.8")
310+
bazel_dep(name = "prometheus-cpp", version = "1.2.4", repo_name = "com_github_jupp0r_prometheus_cpp")
311+
```
312+
313+
### Known issues
314+
315+
For bazel, two different methods to build exists.
316+
317+
First, the code can build using file `bazel/repository.bzl`.
318+
This option does not depend on bazel central.
319+
320+
Secondly, there is also a build using modules, with file `MODULE.bazel`.
321+
This option does depend on bazel central, and CI depends on it.

third_party_release

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ benchmark=v1.8.3
1919
googletest=1.14.0
2020
ms-gsl=v3.1.0-67-g6f45293
2121
nlohmann-json=v3.11.3
22-
opentelemetry-proto=v1.3.1
22+
opentelemetry-proto=v1.3.2
2323
opentracing-cpp=v1.6.0
2424
prometheus-cpp=v1.2.4
2525
vcpkg=2024.02.14

0 commit comments

Comments
 (0)