Skip to content

Commit 42d4950

Browse files
authored
review comment
1 parent 12fe684 commit 42d4950

File tree

1 file changed

+152
-0
lines changed

1 file changed

+152
-0
lines changed

docs/maintaining-dependencies.md

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

0 commit comments

Comments
 (0)