Skip to content

Refactor: Centralize Prometheus logic into utils module#4

Merged
kris927b merged 6 commits into
mainfrom
refactor-prometheus-utils
Jun 10, 2025
Merged

Refactor: Centralize Prometheus logic into utils module#4
kris927b merged 6 commits into
mainfrom
refactor-prometheus-utils

Conversation

@kris927b

@kris927b kris927b commented Jun 9, 2025

Copy link
Copy Markdown
Owner

I've moved Prometheus-related functionality from producer.rs and worker.rs into the src/utils module to improve code sharing and reduce duplication.

Specific changes:

  • The setup_prometheus_metrics function, responsible for initializing the Axum server for the /metrics endpoint, has been moved to src/utils/utils.rs. Both producer and I now call this shared function.
  • The associated metrics_handler function for Axum has also been moved to src/utils/utils.rs and is used by the shared setup_prometheus_metrics.
  • All static Prometheus metric declarations (Counters, Gauges, Histograms) from both producer and my own operations have been consolidated into a new file: src/utils/prometheus_metrics.rs.
  • Producer and I now import these metrics from TextBlaster::utils::prometheus_metrics::*.
  • I've updated src/utils/mod.rs to include and export the new prometheus_metrics module.

This refactoring centralizes Prometheus setup and metric definitions, making them easier to manage and maintain.

google-labs-jules Bot and others added 6 commits June 9, 2025 13:07
I've moved Prometheus-related functionality from `producer.rs` and `worker.rs` into the `src/utils` module to improve code sharing and reduce duplication.

Specific changes:

- The `setup_prometheus_metrics` function, responsible for initializing the Axum server for the /metrics endpoint, has been moved to `src/utils/utils.rs`. Both producer and I now call this shared function.
- The associated `metrics_handler` function for Axum has also been moved to `src/utils/utils.rs` and is used by the shared `setup_prometheus_metrics`.
- All static Prometheus metric declarations (Counters, Gauges, Histograms) from both producer and my own operations have been consolidated into a new file: `src/utils/prometheus_metrics.rs`.
- Producer and I now import these metrics from `TextBlaster::utils::prometheus_metrics::*`.
- I've updated `src/utils/mod.rs` to include and export the new `prometheus_metrics` module.

This refactoring centralizes Prometheus setup and metric definitions, making them easier to manage and maintain.
@kris927b kris927b merged commit 5cf8a68 into main Jun 10, 2025
1 check passed
@kris927b kris927b deleted the refactor-prometheus-utils branch June 13, 2025 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant