Skip to content

Commit b0e8d7a

Browse files
authored
[EXPORTER] bump prometheus to v1.3.0 (#3122)
1 parent be1f43c commit b0e8d7a

File tree

5 files changed

+165
-5
lines changed

5 files changed

+165
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ Important changes:
3232
as the Jaeger propagator can be used without the (now removed)
3333
Jaeger exporter.
3434

35+
* Upgrade to prometheus 1.3.0
36+
[#3122](https://github.com/open-telemetry/opentelemetry-cpp/pull/3122)
37+
3538
## [1.17 2024-10-07]
3639

3740
* [CI] Add a clang-tidy build

bazel/repository.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ def opentelemetry_cpp_deps():
110110
maybe(
111111
http_archive,
112112
name = "com_github_jupp0r_prometheus_cpp",
113-
sha256 = "48dbad454d314b836cc667ec4def93ec4a6e4255fc8387c20cacb3b8b6faee30",
114-
strip_prefix = "prometheus-cpp-1.2.4",
113+
sha256 = "ac6e958405a29fbbea9db70b00fa3c420e16ad32e1baf941ab233ba031dd72ee",
114+
strip_prefix = "prometheus-cpp-1.3.0",
115115
urls = [
116-
"https://github.com/jupp0r/prometheus-cpp/archive/refs/tags/v1.2.4.tar.gz",
116+
"https://github.com/jupp0r/prometheus-cpp/archive/refs/tags/v1.3.0.tar.gz",
117117
],
118118
)
119119

docs/maintaining-dependencies.md

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,3 +442,160 @@ Last, in some special case like name collisions for a given symbol,
442442
the template itself may need to be adjusted for special logic.
443443

444444
See for example how `messaging.client_id` is treated.
445+
446+
## prometheus-cpp
447+
448+
### Comments (prometheus-cpp)
449+
450+
The `prometheus-cpp` library provides a C++ client for Prometheus,
451+
facilitating the creation and registration of metrics that Prometheus scrapes.
452+
`prometheus-cpp` is used as a git submodule under the `third_party` directory
453+
for ease of inclusion in build system.
454+
455+
### Origin (prometheus-cpp)
456+
457+
The repository for `prometheus-cpp` can be found here:
458+
459+
* [repository](https://github.com/jupp0r/prometheus-cpp)
460+
461+
Check release notes at:
462+
463+
* [release-notes](https://github.com/jupp0r/prometheus-cpp/releases)
464+
465+
### Upgrade (prometheus-cpp)
466+
467+
When upgrading `prometheus-cpp` to a newer release,
468+
you’ll need to update a few key files in the codebase to reflect the new version.
469+
470+
In this example, we upgrade from `v1.2.3` to `v1.2.4`.
471+
472+
#### Directory `third_party/prometheus-cpp`
473+
474+
`prometheus-cpp` is a `git submodule`,
475+
so it needs to be pointed to the new release tag.
476+
477+
```shell
478+
cd third_party/prometheus-cpp
479+
git log -1
480+
```
481+
482+
The current submodule should show something like:
483+
484+
```shell
485+
commit abcdef1234567890abcdef1234567890abcdef12 (HEAD, tag: v1.2.3)
486+
Author: John Doe <[email protected]>
487+
Date: Fri Apr 25 17:55:35 2024 +0200
488+
489+
Minor fixes for performance and compatibility
490+
```
491+
492+
Pull new tags:
493+
494+
```shell
495+
git pull --tag origin
496+
```
497+
498+
Upgrade to the new tag:
499+
500+
```shell
501+
git pull origin v1.2.4
502+
```
503+
504+
Verify the new commit:
505+
506+
```shell
507+
git log -1
508+
commit 1234567890abcdef1234567890abcdef12345678 (HEAD, tag: v1.2.4)
509+
Author: Jane Doe <[email protected]>
510+
Date: Thu Jun 28 08:19:11 2024 -0500
511+
512+
Improved metrics handling for high concurrency
513+
```
514+
515+
Return to the root directory:
516+
517+
```shell
518+
cd ../..
519+
git status
520+
```
521+
522+
The status should display:
523+
524+
```shell
525+
On branch upgrade_prometheus_1.2.4
526+
Changes not staged for commit:
527+
(use "git add <file>..." to update what will be committed)
528+
(use "git restore <file>..." to discard changes in working directory)
529+
modified: third_party/prometheus-cpp (new commits)
530+
```
531+
532+
Add the upgraded submodule:
533+
534+
```shell
535+
git add third_party/prometheus-cpp
536+
```
537+
538+
File third_party_release
539+
Update the line referencing the prometheus-cpp version.
540+
541+
```shell
542+
prometheus-cpp=v1.2.4
543+
```
544+
545+
Example change:
546+
547+
```shell
548+
$ git diff third_party_release
549+
diff --git a/third_party_release b/third_party_release
550+
index abc1234..def5678 100644
551+
--- a/third_party_release
552+
+++ b/third_party_release
553+
@@ -19,7 +19,7 @@ some-dependency=v0.8.3
554+
another-dependency=1.14.0
555+
prometheus-cpp=v1.2.3
556+
+prometheus-cpp=v1.2.4
557+
```
558+
559+
In file bazel/repository.bzl locate the entry for prometheus-cpp:
560+
561+
```shell
562+
# C++ Prometheus Client library.
563+
maybe(
564+
http_archive,
565+
name = "com_github_jupp0r_prometheus_cpp",
566+
sha256 = "ac6e958405a29fbbea9db70b00fa3c420e16ad32e1baf941ab233ba031dd72ee",
567+
strip_prefix = "prometheus-cpp-1.2.3",
568+
urls = [
569+
"https://github.com/jupp0r/prometheus-cpp/archive/refs/tags/v1.2.3.tar.gz",
570+
],
571+
)
572+
```
573+
574+
Update the URL to the new tag:
575+
576+
```shell
577+
urls = [
578+
"https://github.com/jupp0r/prometheus-cpp/archive/v1.2.4.tar.gz",
579+
],
580+
```
581+
582+
Update strip_prefix to match the new version:
583+
584+
```shell
585+
strip_prefix = "prometheus-cpp-1.2.4",
586+
```
587+
588+
Download the new URL:
589+
590+
```shell
591+
wget https://github.com/jupp0r/prometheus-cpp/archive/v1.2.4.tar.gz
592+
```
593+
594+
Calculate the checksum:
595+
596+
```shell
597+
sha256sum v1.2.4.tar.gz
598+
abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234 v1.2.4.tar.gz
599+
```
600+
601+
Update the `sha256`.

third_party_release

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ ms-gsl=v3.1.0-67-g6f45293
2121
nlohmann-json=v3.11.3
2222
opentelemetry-proto=v1.3.2
2323
opentracing-cpp=v1.6.0
24-
prometheus-cpp=v1.2.4
24+
prometheus-cpp=v1.3.0
2525
vcpkg=2024.02.14

0 commit comments

Comments
 (0)