### Install Yabeda Prometheus Gem Source: https://github.com/yabeda-rb/yabeda-prometheus/blob/master/README.md Add the yabeda-prometheus gem to your application's Gemfile to install the adapter. After adding the line, execute `bundle` to install the gem and its dependencies. ```ruby gem 'yabeda-prometheus' ``` -------------------------------- ### Start Standalone Metrics Server Source: https://github.com/yabeda-rb/yabeda-prometheus/blob/master/README.md Launch a separate WEBrick server thread to serve metrics on `/metrics`. Ensure 'webrick' gem is included or use `rack_app` with your preferred application server if running on Ruby 3.0+. ```ruby Yabeda::Prometheus::Exporter.start_metrics_server! ``` -------------------------------- ### Define Gauge Aggregation Policy Source: https://github.com/yabeda-rb/yabeda-prometheus/blob/master/README.md Specify the aggregation policy for gauges when declaring them. For example, use `:max` to store the maximum value observed. ```ruby group :some do gauge :tasks do comment "Number of test tasks" aggregation :max end end ``` -------------------------------- ### Configure DirectFileStore for Multi-process Source: https://github.com/yabeda-rb/yabeda-prometheus/blob/master/README.md To aggregate metrics across multiple processes (e.g., Unicorn, Puma clusters), configure the `prometheus-client` gem to use `DirectFileStore`. Specify a directory for metric storage. ```ruby Prometheus::Client.config.data_store = Prometheus::Client::DataStores::DirectFileStore.new(dir: '/tmp/prometheus_direct_file_store') ``` -------------------------------- ### Export Metrics via Rack Middleware Source: https://github.com/yabeda-rb/yabeda-prometheus/blob/master/README.md Integrate Yabeda::Prometheus::Exporter as Rack middleware in your `config.ru` file to expose metrics on a specific path (default `/metrics`). The `:path` and `:port` options can be configured. ```ruby use Yabeda::Prometheus::Exporter ``` -------------------------------- ### Push Tags and Commits Source: https://github.com/yabeda-rb/yabeda-prometheus/blob/master/README.md Pushes all local commits and tags to the remote repository. The `--follow-tags` option ensures that all associated tags are also pushed. ```Shell git push --follow-tags ``` -------------------------------- ### Create Annotated Git Tag Source: https://github.com/yabeda-rb/yabeda-prometheus/blob/master/README.md Creates an annotated Git tag for the new version. The tag message includes the version number and can be edited. The `--sign` option is used for signing the tag. ```Shell git tag v${version} --annotate --message="${version}: " --edit --sign ``` -------------------------------- ### Configure Metrics Server Logger Source: https://github.com/yabeda-rb/yabeda-prometheus/blob/master/README.md Optionally provide a logger instance, such as `Rails.application.logger`, to the `start_metrics_server!` method for logging exporter activity. ```ruby Yabeda::Prometheus::Exporter.start_metrics_server! logger: Rails.application.logger ``` -------------------------------- ### Enable Debugging Metrics Source: https://github.com/yabeda-rb/yabeda-prometheus/blob/master/README.md Debugging metrics, such as `yabeda_prometheus_render_duration`, are enabled by setting `YABEDA_DEBUG=true` in your environment variables. ```bash export YABEDA_DEBUG=true ``` -------------------------------- ### Push Metrics to Push Gateway Source: https://github.com/yabeda-rb/yabeda-prometheus/blob/master/README.md For short-lived processes like rake tasks or cron jobs, use the push gateway to send collected metrics. Configure the push gateway address via the `PROMETHEUS_PUSH_GATEWAY` environment variable. ```ruby Yabeda::Prometheus.push_gateway.add(Yabeda::Prometheus.registry) ``` -------------------------------- ### Mount Exporter in Rails Routes Source: https://github.com/yabeda-rb/yabeda-prometheus/blob/master/README.md Mount the Yabeda::Prometheus::Exporter as a standalone Rack application within your Rails application's routes. This makes metrics available at the specified mount path. ```ruby Rails.application.routes.draw do mount Yabeda::Prometheus::Exporter, at: "/metrics" end ``` -------------------------------- ### Commit Gem Version Source: https://github.com/yabeda-rb/yabeda-prometheus/blob/master/README.md Commits the updated version file and creates a commit message with the new version number. It uses Ruby to read the version from the file. ```Shell git add lib/yabeda/prometheus/version.rb CHANGELOG.md version=$(ruby -r ./lib/yabeda/prometheus/version.rb -e "puts Gem::Version.new(Yabeda::Prometheus::VERSION)") git commit --message="${version}: " --edit ``` -------------------------------- ### Check Gem Version Source: https://github.com/yabeda-rb/yabeda-prometheus/blob/master/README.md Checks the current version of the gem using Ruby's Gem::Version class. This is useful for verifying the version number before or after bumping it. ```Ruby Gem::Version.new(Yabeda::Prometheus::VERSION).to_s ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.