Comments (3)
Add below to your initializer to skip printing primary/replica
for queries returned from cache
module MakaraLoggingSubscriber
# See https://github.com/instacart/makara/blob/e45ba090fce998dad9e9a2759426f4695009cfae/lib/makara/logging/subscriber.rb#L23
def current_wrapper_name(event)
return nil if event.payload[:cached]
super(event)
end
end
ActiveRecord::LogSubscriber.log_subscribers.each do |subscriber|
subscriber.extend ::MakaraLoggingSubscriber
end
from makara.
I've a same question.
from makara.
Hello,
I have problem related to query log. They're not showing value from adapter._makara_name
.
versions:
- rails api 6.1.6
- ruby 2.7.4
- makara 0.5.1
database.yml
default: &default
adapter: postgresql_makara
encoding: unicode
# For details on connection pooling, see Rails configuration guide
# https://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
<<: *default
database: super_awesome_api_development
makara:
id: postgresql
# list your connections with the override values (they're merged into the top-level config)
# be sure to provide the role if primary, role is assumed to be a replica if not provided
connections:
- role: master
name: primary
blacklist_duration: 0
host: localhost
- role: replica
name: replica
host: localhost
development.log
Started GET "/attendance_office_hours" for ::1 at 2022-05-20 14:02:37 +0700
Processing by AttendanceOfficeHoursController#index as */*
AttendanceOfficeHour Load (0.8ms) SELECT "attendance_office_hours".* FROM "attendance_office_hours" WHERE "attendance_office_hours"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
↳ app/controllers/attendance_office_hours_controller.rb:5:in `index'
Completed 200 OK in 30ms (Views: 0.8ms | ActiveRecord: 11.4ms | Allocations: 7800)
I don't know if this query hit primary or replica. Is there any config I should add?
from makara.
Related Issues (20)
- wrong number of arguments error with Ruby 3 HOT 3
- Ruby 3.0 release only HOT 4
- Blacklist is an exclusionary term
- SSL on mysql2_makara adapter
- Assets precompilation fails when unable to connect with database HOT 1
- Best approach for handling master-slave replication? HOT 1
- In development: makara hides the query logs references HOT 1
- ActiveRecord::Base.connection.select raises TypeError with makara-0.5.1 HOT 1
- No CHANGELOG entry for 0.5.1 HOT 5
- rake db:migrate not running HOT 1
- How to send a read query to master explicitly?
- How to send a read query to master explicitly? HOT 1
- Override master db selection method not working HOT 2
- Deprecation warning for Ruby 3 HOT 3
- Proxied control methods generated do not respect arity HOT 7
- It should be `:replica` instead of `:primary` HOT 2
- Deprecation warning for Ruby3 HOT 2
- Registering Types not working?
- Choosing Primary instead of Replica when using 'with' (because of newlines)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from makara.