cequel 1.8.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/lib/cequel/metal/new_relic_instrumentation.rb +26 -6
- data/lib/cequel/record/lazy_record_collection.rb +1 -1
- data/lib/cequel/record/railtie.rb +2 -2
- data/lib/cequel/version.rb +1 -1
- data/spec/examples/record/lazy_record_collection_spec.rb +16 -0
- data/spec/examples/spec_support/preparation_spec.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 769586127721ed091afdca815dd777b0c2f1c45b
|
4
|
+
data.tar.gz: 32ae7dab6f20e1e545e5d1c9ca82ec6a8f49a619
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b83ace65af35841571cb4420e52c2664680d40f64d04e411ab93aca11b9de7ffc0305d921d4c2e6036c09d4958349090e5ced9ff402ffebf6cf5afc2b4130286
|
7
|
+
data.tar.gz: fecc7319b72e30ded2ddf98d5760e5da6bb3c289381a682c0f3a7cb1ef7e60f36640acb621d95b1992ae16e53a170e2045dd7180b60550cbdc1d9336d477b0be
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
begin
|
3
|
-
require 'new_relic/agent/
|
3
|
+
require 'new_relic/agent/datastores'
|
4
4
|
rescue LoadError => e
|
5
5
|
fail LoadError, "Can't use NewRelic instrumentation without NewRelic gem"
|
6
6
|
end
|
@@ -13,12 +13,32 @@ module Cequel
|
|
13
13
|
module NewRelicInstrumentation
|
14
14
|
extend ActiveSupport::Concern
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
define_method :execute_with_consistency_with_newrelic do |statement, bind_vars, consistency|
|
17
|
+
callback = Proc.new do |result, scoped_metric, elapsed|
|
18
|
+
NewRelic::Agent::Datastores.notice_statement(statement, elapsed)
|
19
|
+
end
|
20
|
+
|
21
|
+
statement_words = statement.split
|
22
|
+
operation = statement_words.first.downcase
|
23
|
+
table = nil
|
24
|
+
case operation
|
25
|
+
when "begin"
|
26
|
+
operation = "batch"
|
27
|
+
when "select"
|
28
|
+
table = statement_words.at(statement_words.index("FROM") + 1)
|
29
|
+
when "insert"
|
30
|
+
table = statement_words[2]
|
31
|
+
when "update"
|
32
|
+
table = statement_words[1]
|
33
|
+
end
|
18
34
|
|
19
|
-
|
20
|
-
|
21
|
-
|
35
|
+
NewRelic::Agent::Datastores.wrap("Cassandra", operation, table, callback) do
|
36
|
+
execute_with_consistency_without_newrelic(statement, bind_vars, consistency)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
included do
|
41
|
+
alias_method_chain :execute_with_consistency, :newrelic
|
22
42
|
end
|
23
43
|
end
|
24
44
|
end
|
@@ -32,7 +32,7 @@ module Cequel
|
|
32
32
|
|
33
33
|
exploded_key_attributes = [{}].tap do |all_key_attributes|
|
34
34
|
key_columns.zip(scoped_key_values) do |column, values|
|
35
|
-
all_key_attributes.replace(
|
35
|
+
all_key_attributes.replace([values].flatten.compact.flat_map do |value|
|
36
36
|
all_key_attributes.map do |key_attributes|
|
37
37
|
key_attributes.merge(column.name => value)
|
38
38
|
end
|
@@ -22,9 +22,9 @@ module Cequel
|
|
22
22
|
end
|
23
23
|
|
24
24
|
initializer "cequel.add_new_relic" do
|
25
|
-
if configuration.fetch(:
|
25
|
+
if configuration.fetch(:newrelic, true)
|
26
26
|
begin
|
27
|
-
require 'new_relic/agent/
|
27
|
+
require 'new_relic/agent/datastores'
|
28
28
|
rescue LoadError => e
|
29
29
|
Rails.logger.debug(
|
30
30
|
"New Relic not installed; skipping New Relic integration")
|
data/lib/cequel/version.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require File.expand_path('../spec_helper', __FILE__)
|
3
|
+
|
4
|
+
describe Cequel::Record::LazyRecordCollection do
|
5
|
+
context 'handle timestamp attribute correctly (do not split it to array)' do
|
6
|
+
model :Event do
|
7
|
+
key :timestamp, :timestamp
|
8
|
+
column :value, :text
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:now) { Time.now }
|
12
|
+
let(:event) { Event[now] }
|
13
|
+
|
14
|
+
it { expect(event.attributes).to include(timestamp: now) }
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cequel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mat Brown
|
@@ -29,7 +29,7 @@ authors:
|
|
29
29
|
autorequire:
|
30
30
|
bindir: bin
|
31
31
|
cert_chain: []
|
32
|
-
date: 2016-
|
32
|
+
date: 2016-04-02 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: activemodel
|
@@ -277,6 +277,7 @@ files:
|
|
277
277
|
- spec/examples/record/callbacks_spec.rb
|
278
278
|
- spec/examples/record/dirty_spec.rb
|
279
279
|
- spec/examples/record/finders_spec.rb
|
280
|
+
- spec/examples/record/lazy_record_collection_spec.rb
|
280
281
|
- spec/examples/record/list_spec.rb
|
281
282
|
- spec/examples/record/map_spec.rb
|
282
283
|
- spec/examples/record/mass_assignment_spec.rb
|
@@ -336,6 +337,7 @@ test_files:
|
|
336
337
|
- spec/examples/record/callbacks_spec.rb
|
337
338
|
- spec/examples/record/dirty_spec.rb
|
338
339
|
- spec/examples/record/finders_spec.rb
|
340
|
+
- spec/examples/record/lazy_record_collection_spec.rb
|
339
341
|
- spec/examples/record/list_spec.rb
|
340
342
|
- spec/examples/record/map_spec.rb
|
341
343
|
- spec/examples/record/mass_assignment_spec.rb
|