Skip to content

Commit 281ee2b

Browse files
authored
Merge pull request #225 from eduardoj/feature/add_cached_to_active_record
Add `cached` key for active_record payloads
2 parents 52f6d70 + 4fae494 commit 281ee2b

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

lib/influxdb/rails/middleware/sql_subscriber.rb

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def tags
2121
class_name: query.class_name,
2222
name: query.name,
2323
location: :raw,
24+
cached: query.try(:cached) == "true",
2425
}
2526
end
2627

spec/requests/active_record_sql_metrics_spec.rb

+6-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
hook: "sql",
2222
name: "Metric Create",
2323
class_name: "Metric",
24-
operation: "INSERT"
24+
operation: "INSERT",
25+
cached: false
2526
),
2627
fields: a_hash_including(
2728
additional_field: :value,
@@ -40,7 +41,8 @@
4041
expect_metric(
4142
tags: a_hash_including(
4243
location: "MetricsController#index",
43-
hook: "sql"
44+
hook: "sql",
45+
cached: false
4446
),
4547
time: Time.at(1_514_797_200)
4648
)
@@ -53,7 +55,8 @@
5355

5456
expect_no_metric(
5557
tags: a_hash_including(
56-
hook: "sql"
58+
hook: "sql",
59+
cached: false
5760
)
5861
)
5962
end

spec/requests/context_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
expect_metric(
88
tags: a_hash_including(
99
location: "MetricsController#index",
10-
hook: "sql"
10+
hook: "sql",
11+
cached: false
1112
)
1213
)
1314

0 commit comments

Comments
 (0)