@@ -442,3 +442,160 @@ Last, in some special case like name collisions for a given symbol,
442442the template itself may need to be adjusted for special logic.
443443
444444See 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 ` .
0 commit comments