{"id":13720397,"url":"https://github.com/mustafaabdullahk/zephyrus","last_synced_at":"2025-05-07T12:31:20.448Z","repository":{"id":237070731,"uuid":"783801430","full_name":"mustafaabdullahk/zephyrus","owner":"mustafaabdullahk","description":"zephyr prometheus client library","archived":false,"fork":false,"pushed_at":"2024-05-12T15:51:11.000Z","size":43,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-14T09:39:11.946Z","etag":null,"topics":["metrics","module","prometheus","prometheus-client","prometheus-client-library","zephyr","zephyr-module","zephyr-modules","zephyrproject-rtos"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mustafaabdullahk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-08T15:43:29.000Z","updated_at":"2024-05-12T15:51:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"eb88dffb-5a23-4ce3-94bc-3fe0682b3c82","html_url":"https://github.com/mustafaabdullahk/zephyrus","commit_stats":null,"previous_names":["mustafaabdullahk/zephyrus"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustafaabdullahk%2Fzephyrus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustafaabdullahk%2Fzephyrus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustafaabdullahk%2Fzephyrus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustafaabdullahk%2Fzephyrus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mustafaabdullahk","download_url":"https://codeload.github.com/mustafaabdullahk/zephyrus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252876388,"owners_count":21818173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["metrics","module","prometheus","prometheus-client","prometheus-client-library","zephyr","zephyr-module","zephyr-modules","zephyrproject-rtos"],"created_at":"2024-08-03T01:01:03.305Z","updated_at":"2025-05-07T12:31:17.513Z","avatar_url":"https://github.com/mustafaabdullahk.png","language":"C","funding_links":[],"categories":["Libraries"],"sub_categories":["IoT \u0026 Cloud"],"readme":"# Prometheus C Library (Zephyr Module)\n\nA lightweight C library for exposing Prometheus metrics in Zephyr applications. This library allows Zephyr developers to easily integrate Prometheus metrics into their applications, enabling monitoring and observability in Zephyr-based systems.\n\n## Description\nPrometheus Exposer for Zephyr provides a simple and efficient way to expose metrics from Zephyr applications in the Prometheus format. It includes functionality to create various types of metrics such as counters, gauges, histograms, and summaries, register them with a collector, and expose them over HTTP for scraping by a Prometheus server.\n\n## Getting Started\nTo get started with Prometheus C Library, follow these steps:\n\n1. Clone the repository to your local machine.\n2. Navigate to the project directory.\n3. Build the library using the provided build system.\n4. Integrate the library into your C project.\n\n## Building and Running\nTo build the library and run the example applications, follow these steps:\n\n1. Ensure that you have a C compiler (e.g., GCC) installed on your system.\n2. Navigate to the project directory.\n3. Run the build command following:\n```bash\nmkdir build \u0026\u0026 cd build\ncmake ..\nmake all\n```\n4. After successful compilation, you can run the example applications to see the library in action.\n\n## Usage\nTo use Prometheus C Library in your C project, follow these steps:\n1. Include the necessary header files in your source files.\n2. Initialize a collector to store your metrics.\n3. Create various types of metrics (e.g., counters, gauges, histograms, summaries) and register them with the collector.\n4. Expose the metrics via an HTTP endpoint using the provided exposer component.\n5. Configure your Prometheus server to scrape the metrics from the endpoint.\n\n\n```c\n#include \u003cprometheus.h\u003e\n\n// Initialize a counter metric\npm_counter_t *http_requests_total = pm_counter_create(\"http_requests_total\", \"Total HTTP requests\", \"method\", \"GET\");\n\n// Increment the counter\npm_counter_inc(http_requests_total);\n\n// Register the metric with the collector\npm_collector_register_metric(collector, (pm_metric_t *)http_requests_total);\n```\n\n## Zephyr Module Usage\n\nRepository create by taking advantage of following documents:\n\n- [manifest](https://docs.zephyrproject.org/latest/develop/west/manifest.html#)\n- [modules](https://docs.zephyrproject.org/latest/develop/modules.html#)\n\nI suggest to read following zephyr issues:\n\n- [add http server support pr](https://github.com/zephyrproject-rtos/zephyr/pull/64465)\n- [replacement for civetweb](https://github.com/zephyrproject-rtos/zephyr/issues/46758)\n\n### west.yml\n\n- first one add mongoose module into main manifest(west.yaml) following way:\n\n```yaml\n  remotes:\n    - name: zephyrproject-rtos\n      url-base: https://github.com/zephyrproject-rtos\n    - name: zephyrus\n      url-base: https://github.com/mustafaabdullahk/zephyrus\n\n  projects:\n    - name: zephyr\n      remote: zephyrproject-rtos\n      revision: main\n      import:\n        # By using name-allowlist we can clone only the modules that are\n        # strictly needed by the application.\n        name-allowlist:\n          - cmsis      # required by the ARM port\n          - hal_nordic # required by the custom_plank board (Nordic based)\n          - hal_stm32  # required by the nucleo_f302r8 board (STM32 based)\n          - mbedtls\n\n    - name: prometheus\n      remote: zephyrus # referred from remotes can change other forks or main\n      submodules: true # prometheus add as submodule\n      revision: main # can select different branch\n      repo-path: .\n      path: modules/lib/prometheus\n```\n\n- second one run `west update` and initialized mongoose module\n\n- third one can add your prj.conf for using mongoose library.\n\n```\nCONFIG_PROMETHEUS=y\nCONFIG_POSIX_API=y\n\nCONFIG_NETWORKING=y\nCONFIG_NET_IPV4=y\nCONFIG_NET_IPV6=n\nCONFIG_NET_TCP=y\nCONFIG_NET_UDP=y\nCONFIG_NET_DHCPV4=y\nCONFIG_NET_SOCKETS=y\nCONFIG_NET_SOCKETS_POLL_MAX=32\nCONFIG_POSIX_MAX_FDS=32\nCONFIG_NET_MAX_CONN=10\nCONFIG_NET_MAX_CONTEXTS=10\nCONFIG_NET_CONFIG_SETTINGS=y\nCONFIG_NET_CONNECTION_MANAGER=y\nCONFIG_NET_LOG=y\nCONFIG_INIT_STACKS=y\n\nCONFIG_LOG=y\nCONFIG_ISR_STACK_SIZE=2048\nCONFIG_MAIN_STACK_SIZE=8192\nCONFIG_IDLE_STACK_SIZE=1024\n\nCONFIG_REQUIRES_FULL_LIBC=y\nCONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=8194\n```\n\n- add library and ready to start coding:\n\n```c\n#include \u003cprometheus/counter.h\u003e\n```\n\n## Zephyr Example Application\n\n[Zephyr Prometheus Example Application](https://github.com/mustafaabdullahk/zephyr-prometheus-example)\n\n```bash\n# initialize my-workspace for the example-application (main branch)\nwest init -m https://github.com/mustafaabdullahk/zephyr-prometheus-example.git --mr main prom-workspace\n# update Zephyr modules\ncd my-workspace\nwest update\n# build for stm32h747disco\nwest build -b stm32h747i_disco/stm32h747xx/m7 app/ -p\n```\n\n\n## Features\n- Lightweight and efficient C library for instrumenting C-based applications.\n- Supports various types of metrics, including counters, gauges, histograms, and summaries.\n- Exposes metrics in the Prometheus exposition format via an HTTP endpoint.\n- Easy to integrate into existing C projects.\n- Well-documented API and example applications for reference.\n\n## Contributing\nContributions to Prometheus C Library are welcome! If you would like to contribute, please follow these guidelines:\n1. Fork the repository and create a new branch for your feature or bug fix.\n2. Implement your changes and ensure that all tests pass.\n3. Submit a pull request with a detailed description of your changes and the problem they solve.\n4. Participate in code reviews and address any feedback from the maintainers.\n\n## License\nThis project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmustafaabdullahk%2Fzephyrus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmustafaabdullahk%2Fzephyrus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmustafaabdullahk%2Fzephyrus/lists"}