-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
basic prototype for prometheus logging #146
Conversation
@@ -0,0 +1,28 @@ | |||
// Copyright (c) Meta Platforms, Inc. and affiliates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are Metrics specific to Prometheus? If so, should the naming reflect that?
@@ -57,6 +64,11 @@ DEFINE_bool(enable_perf_monitor, false, "Enable heartbeat perf monitoring."); | |||
|
|||
std::unique_ptr<Logger> getLogger(const std::string& scribe_category = "") { | |||
std::vector<std::unique_ptr<Logger>> loggers; | |||
#ifdef USE_PROMETHEUS | |||
if (FLAGS_use_prometheus) { | |||
loggers.push_back(std::make_unique<PrometheusLogger>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Have the Prometheus server port/ip binding parameterized
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes added that :)
@briancoutinho has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: # Prometheus support Enable logging to prometheus- this will be used in environments with their prometheus logging set up already. We leverage the library https://github.com/jupp0r/prometheus-cpp/ for this work. ## Parts 1. Add a Metrics list registry in the code. 2. Use Prometheus-cpp to set up an HTTP endpoint for prometheus. ## Output Ran on my laptop using a docker container. ### How to Run Please install Docker desktop. 1. Download this docker file in a directory https://gist.github.com/briancoutinho/d90e1c5d3fca59274fcd14f8863d6409 2. Build using `docker build . -t prometheus:v1` 3. Run docker container forwarding port and mounting dynolog open source repo `docker run -p 9090:9090 -it -v ~/Work/dynolog_oss/dynolog:/workspace/dynolog prometheus:v1 /bin/bash` 5. Build dynolog `./scripts/build.sh` To get the logging setup add the following in prometheus.yml ``` - job_name: "dynolog" static_configs: - targets: ["localhost:8080"] ``` Then run prometheus and dynolog. ``` cd /workspace/prometheus/prometheus-2.44.0.linux-amd64; ./prometheus --config.file prometheus.yml & cd - ./build/bin/dynolog -kernel_monitor_reporting_interval_s 10 -use_JSON -use_prometheus & ``` Open [https://localhost:9090](http://localhost:9090/metrics)/ ![Screenshot 2023-06-09 at 4 26 52 PM](https://github.com/facebookincubator/dynolog/assets/6922212/4015bb3e-9751-4167-88d1-7865b1efd8b6) ![Screenshot 2023-06-09 at 4 26 59 PM](https://github.com/facebookincubator/dynolog/assets/6922212/74186161-c2c1-4649-b560-8fbb58fc7664) Pull Request resolved: #146 Differential Revision: D46710501 Pulled By: briancoutinho fbshipit-source-id: 77083bfe56e76780d13e4e90395261012ef4bf28
db02323
to
82e7f64
Compare
This pull request was exported from Phabricator. Differential Revision: D46710501 |
Summary: # Prometheus support Enable logging to prometheus- this will be used in environments with their prometheus logging set up already. We leverage the library https://github.com/jupp0r/prometheus-cpp/ for this work. ## Parts 1. Add a Metrics list registry in the code. 2. Use Prometheus-cpp to set up an HTTP endpoint for prometheus. ## Output Ran on my laptop using a docker container. ### How to Run Please install Docker desktop. 1. Download this docker file in a directory https://gist.github.com/briancoutinho/d90e1c5d3fca59274fcd14f8863d6409 2. Build using `docker build . -t prometheus:v1` 3. Run docker container forwarding port and mounting dynolog open source repo `docker run -p 9090:9090 -it -v ~/Work/dynolog_oss/dynolog:/workspace/dynolog prometheus:v1 /bin/bash` 5. Build dynolog `./scripts/build.sh` To get the logging setup add the following in prometheus.yml ``` - job_name: "dynolog" static_configs: - targets: ["localhost:8080"] ``` Then run prometheus and dynolog. ``` cd /workspace/prometheus/prometheus-2.44.0.linux-amd64; ./prometheus --config.file prometheus.yml & cd - ./build/bin/dynolog -kernel_monitor_reporting_interval_s 10 -use_JSON -use_prometheus & ``` Open [https://localhost:9090](http://localhost:9090/metrics)/ ![Screenshot 2023-06-09 at 4 26 52 PM](https://github.com/facebookincubator/dynolog/assets/6922212/4015bb3e-9751-4167-88d1-7865b1efd8b6) ![Screenshot 2023-06-09 at 4 26 59 PM](https://github.com/facebookincubator/dynolog/assets/6922212/74186161-c2c1-4649-b560-8fbb58fc7664) Pull Request resolved: #146 Reviewed By: jj10306 Differential Revision: D46710501 Pulled By: briancoutinho fbshipit-source-id: fd5f74326446b7daa4d9d93a7891cb6ac89f85a1
82e7f64
to
7844589
Compare
This pull request was exported from Phabricator. Differential Revision: D46710501 |
@briancoutinho merged this pull request in 1fa5af7. |
Prometheus support
#148
Enable logging to prometheus- this will be used in environments with their prometheus logging set up already.
We leverage the library https://github.com/jupp0r/prometheus-cpp/ for this work.
Parts
Output
Ran on my laptop using a docker container.
How to Run
Please install Docker desktop.
docker build . -t prometheus:v1
docker run -p 9090:9090 -it -v ~/Work/dynolog_oss/dynolog:/workspace/dynolog prometheus:v1 /bin/bash
./scripts/build.sh
To get the logging setup add the following in prometheus.yml
Then run prometheus and dynolog.
Open https://localhost:9090/