60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/active_record/connection_adapters/cockroachdb_adapter.rb', line 60
def initialize(pool_config)
super(pool_config)
disable_telemetry = pool_config.db_config.configuration_hash[:disable_cockroachdb_telemetry]
adapter = pool_config.db_config.configuration_hash[:adapter]
return if disable_telemetry || adapter != "cockroachdb"
with_connection do |conn|
if conn.active?
begin
query = "SELECT crdb_internal.increment_feature_counter('ActiveRecord %d.%d')"
conn.execute(query % [ActiveRecord::VERSION::MAJOR, ActiveRecord::VERSION::MINOR])
rescue ActiveRecord::StatementInvalid
rescue StandardError => e
conn.logger.warn "Unexpected error when incrementing feature counter: #{e}"
end
end
end
end
|