Skip to content

Commit

Permalink
Add cached key for active_record payloads
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoj committed May 28, 2024
1 parent 52f6d70 commit 4fae494
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/influxdb/rails/middleware/sql_subscriber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def tags
class_name: query.class_name,
name: query.name,
location: :raw,
cached: query.try(:cached) == "true",
}
end

Expand Down
9 changes: 6 additions & 3 deletions spec/requests/active_record_sql_metrics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
hook: "sql",
name: "Metric Create",
class_name: "Metric",
operation: "INSERT"
operation: "INSERT",
cached: false
),
fields: a_hash_including(
additional_field: :value,
Expand All @@ -40,7 +41,8 @@
expect_metric(
tags: a_hash_including(
location: "MetricsController#index",
hook: "sql"
hook: "sql",
cached: false
),
time: Time.at(1_514_797_200)
)
Expand All @@ -53,7 +55,8 @@

expect_no_metric(
tags: a_hash_including(
hook: "sql"
hook: "sql",
cached: false
)
)
end
Expand Down
3 changes: 2 additions & 1 deletion spec/requests/context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
expect_metric(
tags: a_hash_including(
location: "MetricsController#index",
hook: "sql"
hook: "sql",
cached: false
)
)

Expand Down

0 comments on commit 4fae494

Please sign in to comment.