Skip to content
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

Metrics not collected #29

Open
Pegorino82 opened this issue May 16, 2024 · 1 comment
Open

Metrics not collected #29

Pegorino82 opened this issue May 16, 2024 · 1 comment

Comments

@Pegorino82
Copy link

Hi! I use yabeda-rb + yabeda-rails + yabeda-sidekiq

gem 'yabeda'
gem 'yabeda-rails'
gem 'yabeda-sidekiq'
gem 'yabeda-prometheus'
gem "prometheus-client" 

on /metrics i see all of rails, sidekiq and my custom metrics

# HELP sidekiq_jobs_waiting_count The number of jobs waiting to process in sidekiq.
sidekiq_jobs_waiting_count{queue="default"} 12.0
...
# TYPE rails_requests_total counter
# HELP rails_requests_total A counter of the total number of HTTP requests rails processed.
rails_requests_total{controller="...",action="...",status="200",format="json",method="post"} 2.0
...
# TYPE git_git_tag gauge
# HELP git_git_tag Current git tag of the application.
git_git_tag{tag="..."} 1.0

but when i call

Yabeda.collect!
Prometheus::Client::Push.new(job: JOB_NAME, gateway: PROMETHEUS_URL).add(Yabeda::Prometheus.registry)

it pushes only sidekiq + default metrics, for rails metrics are not collected

...
# TYPE rails_requests_total counter
# HELP rails_requests_total A counter of the total number of HTTP requests rails processed.
# TYPE rails_request_duration_seconds histogram
# HELP rails_request_duration_seconds A histogram of the response latency.
# TYPE rails_view_runtime_seconds histogram
# HELP rails_view_runtime_seconds A histogram of the view rendering time.
# TYPE rails_db_runtime_seconds histogram
# HELP rails_db_runtime_seconds A histogram of the activerecord execution time.
...

in console it looks like

pry(main)> Yabeda.collect!
Cache read: metrics ({:compress=>true, :compress_threshold=>1024, :expires_in=>15 minutes})
Cache generate: metrics ({:compress=>true, :compress_threshold=>1024, :expires_in=>15 minutes})
Cache write: metrics ({:compress=>true, :compress_threshold=>1024, :expires_in=>15 minutes})
=> [#<Proc:0x00007f9d42be01b8 /usr/local/bundle/gems/yabeda-sidekiq-0.12.0/lib/yabeda/sidekiq.rb:67>,
 #<Proc:0x00007f9d42bf68f0 .../config/initializers/yabeda_metrics.rb:11>,
 #<Proc:0x00007f9d42bf5450 .../initializers/yabeda_metrics.rb:23>]

is there way to correctly collect all metrics for pushgateway?

@zaibacu
Copy link

zaibacu commented Sep 22, 2024

While documentation says, that these metrics are installed by default, I needed to add initializer with Yabeda::Rails.install! to make it work

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

No branches or pull requests

2 participants