-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
The following pull-link said the feature would be implemented, but it doesn't seem to be supported yet.
Would you be willing to merge the code similar to the pull request author's suggestion?
The part I want to fix is the following record method.
def record(transaction)
payload = transaction.payload
pool, conn = get_pool_n_conn(payload[:connection_id])
return if IGNORE_OPS.include?(payload[:name]) || pool.nil? || conn.nil?
# The spec notation is Rails < 6.1, later this can be found in the db_config
db_config = if pool.respond_to?(:spec)
pool.spec.config
else
pool.db_config.configuration_hash
end
name, sql = build_name_sql_meta config: db_config, conn: conn
subsegment = XRay.recorder.begin_subsegment name, namespace: 'remote'
# subsegment is nil in case of context missing
return if subsegment.nil?
subsegment.start_time = transaction.time.to_f
subsegment.sql = sql
XRay.recorder.end_subsegment end_time: transaction.end.to_f
end
I would like to add sql[:sanitized_query] = payload[:sql] to the above code as follows.
def record(transaction)
payload = transaction.payload
pool, conn = get_pool_n_conn(payload[:connection_id])
return if IGNORE_OPS.include?(payload[:name]) || pool.nil? || conn.nil?
# The spec notation is Rails < 6.1, later this can be found in the db_config
db_config = if pool.respond_to?(:spec)
pool.spec.config
else
pool.db_config.configuration_hash
end
name, sql = build_name_sql_meta config: db_config, conn: conn
sql[:sanitized_query] = payload[:sql]
subsegment = XRay.recorder.begin_subsegment name, namespace: 'remote'
# subsegment is nil in case of context missing
return if subsegment.nil?
subsegment.start_time = transaction.time.to_f
subsegment.sql = sql
XRay.recorder.end_subsegment end_time: transaction.end.to_f
end
If it is too difficult, put SQL in the metadata.
Metadata
Metadata
Assignees
Labels
No labels