ffwd-google-cloud 0.4.5 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ffwd/plugin/google_cloud/utils.rb +14 -2
- data/lib/ffwd/plugin/google_cloud/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 361e6fba065147958d18bf71cc0b48bb96f8f5bb
|
4
|
+
data.tar.gz: 8dedd6d559bc81c6542a3bdfa39d3ed8ebd7e8b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6e8bcbc321302513fb3814e3d4e9975da9640e2ebbbc552ed7e3816953a3888b68160b035064fbf995cf3c3f2b7b5572d0419a34dad5f4d43f9f7133601f640
|
7
|
+
data.tar.gz: 8682ee6cabafb38d1117279dd99f38db593dcd967c869c851e677db08b797d2bf11385e830ea21eec145bd0b94a9071f68e4c3a390ce09378c0c84d47799977d
|
@@ -13,11 +13,14 @@
|
|
13
13
|
# License for the specific language governing permissions and limitations under
|
14
14
|
# the License.
|
15
15
|
require 'set'
|
16
|
+
require 'zlib'
|
16
17
|
|
17
18
|
module FFWD::Plugin::GoogleCloud
|
18
19
|
CUSTOM_PREFIX = "custom.cloudmonitoring.googleapis.com"
|
19
20
|
|
20
21
|
module Utils
|
22
|
+
M64 = 1 << 64
|
23
|
+
|
21
24
|
def self.make_common_labels buffer
|
22
25
|
return nil if buffer.empty?
|
23
26
|
make_labels buffer.first.fixed_attr
|
@@ -33,7 +36,8 @@ module FFWD::Plugin::GoogleCloud
|
|
33
36
|
buffer.each do |m|
|
34
37
|
d = make_desc(m)
|
35
38
|
|
36
|
-
|
39
|
+
# using built-in hash OK since we are only internally de-duplicating.
|
40
|
+
seen_key = [d[:metric], d[:labels].keys.sort].hash
|
37
41
|
|
38
42
|
if seen.member?(seen_key)
|
39
43
|
dropped += 1
|
@@ -67,7 +71,9 @@ module FFWD::Plugin::GoogleCloud
|
|
67
71
|
entries << what unless what.nil?
|
68
72
|
entries = entries.join('.')
|
69
73
|
|
70
|
-
hash
|
74
|
+
# ruby Object#hash is inconsistent across runs, so we will instead
|
75
|
+
# perform a custom hashing.
|
76
|
+
hash = hash_labels(attributes).to_s(32)
|
71
77
|
|
72
78
|
unless entries.empty?
|
73
79
|
"#{CUSTOM_PREFIX}/#{m.key}/#{entries}-#{hash}"
|
@@ -76,6 +82,12 @@ module FFWD::Plugin::GoogleCloud
|
|
76
82
|
end
|
77
83
|
end
|
78
84
|
|
85
|
+
def self.hash_labels attributes
|
86
|
+
attributes.keys.sort.map{|v| Zlib::crc32(v.to_s)}.reduce(33){|k, v|
|
87
|
+
(63 * k + v).modulo(M64)
|
88
|
+
}
|
89
|
+
end
|
90
|
+
|
79
91
|
def self.make_labels attr
|
80
92
|
Hash[attr.select{|k, v| k.to_s != "what"}.map{|k, v|
|
81
93
|
["#{CUSTOM_PREFIX}/#{k}", v]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffwd-google-cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John-John Tedro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: em-http-request
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.4.
|
33
|
+
version: 0.4.6
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.4.
|
40
|
+
version: 0.4.6
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|