stackdriver 0.6.0 → 0.7.0
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/README.md +3 -2
- data/lib/stackdriver.rb +8 -6
- data/lib/stackdriver/version.rb +1 -1
- metadata +23 -10
- data/lib/legacy_stackdriver.rb +0 -106
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca123e1fda77f302e2a8bfeaba680a958b4a07c5
|
4
|
+
data.tar.gz: 3a847dcce91db56da0a6961bdbea5d5f5ed35e82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b9b086c1fd1ba37cdfb876cbe76ed7639a4b30b691b9c1ef0e9f191dd586eb45857757eae2bd77b569ad9a15e3fec2f3c80b42d9f3f2d82ac742c4e23b7b97a
|
7
|
+
data.tar.gz: bc2384880a2bf44f3f6aec2c8456c3a134aef78e63f9c2a8ab162322dafc99ecd3946f5129f17adb24c7cb299869788842f83592cf696fd2bed95f4f1d3f0bfb
|
data/README.md
CHANGED
@@ -3,8 +3,9 @@
|
|
3
3
|
This gem instruments a Ruby web application for Stackdriver diagnostics. When loaded, it integrates with Rails, Sinatra, or other Rack-based web frameworks to collect application diagnostic and monitoring information for your application.
|
4
4
|
|
5
5
|
Specifically, this gem is a convenience package that loads and automatically activates the instrumentation features of the following gems:
|
6
|
-
- [google-cloud-
|
6
|
+
- [google-cloud-debugger](../google-cloud-debugger)
|
7
7
|
- [google-cloud-error_reporting](../google-cloud-error_reporting)
|
8
|
+
- [google-cloud-logging](../google-cloud-logging)
|
8
9
|
- [google-cloud-trace](../google-cloud-trace)
|
9
10
|
|
10
11
|
Please see the top-level project [README](../README.md) for more information about the individual Stackdriver google-cloud-ruby gems.
|
@@ -23,7 +24,7 @@ require "stackdriver"
|
|
23
24
|
|
24
25
|
## Supported Ruby Versions
|
25
26
|
|
26
|
-
This library is supported on Ruby 2.
|
27
|
+
This library is supported on Ruby 2.2+.
|
27
28
|
|
28
29
|
## Versioning
|
29
30
|
|
data/lib/stackdriver.rb
CHANGED
@@ -13,23 +13,23 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
|
16
|
+
gem "google-cloud-debugger"
|
16
17
|
gem "google-cloud-error_reporting"
|
17
18
|
gem "google-cloud-logging"
|
18
19
|
gem "google-cloud-trace"
|
19
20
|
|
21
|
+
require "google/cloud/debugger"
|
22
|
+
require "google/cloud/error_reporting"
|
20
23
|
require "google/cloud/logging"
|
21
24
|
require "google/cloud/trace"
|
22
|
-
require "google/cloud/error_reporting"
|
23
25
|
|
24
26
|
if defined? ::Rails::Railtie
|
27
|
+
require "google/cloud/debugger/rails"
|
25
28
|
require "google/cloud/error_reporting/rails"
|
26
29
|
require "google/cloud/logging/rails"
|
27
30
|
require "google/cloud/trace/rails"
|
28
31
|
end
|
29
32
|
|
30
|
-
# Backward compatibility with legacy stackdriver gem
|
31
|
-
require "legacy_stackdriver"
|
32
|
-
|
33
33
|
##
|
34
34
|
# # Stackdriver
|
35
35
|
#
|
@@ -39,14 +39,16 @@ require "legacy_stackdriver"
|
|
39
39
|
# information for your application.
|
40
40
|
#
|
41
41
|
# Specifically, this gem is a convenience package that loads the following gems:
|
42
|
-
# - [google-cloud-
|
42
|
+
# - [google-cloud-debugger](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-debugger)
|
43
43
|
# - [google-cloud-error_reporting](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-error_reporting)
|
44
|
+
# - [google-cloud-logging](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging)
|
44
45
|
# - [google-cloud-trace](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-trace)
|
45
46
|
#
|
46
47
|
# On top of that, stackdriver gem automatically activates the following
|
47
48
|
# instrumentation features:
|
48
|
-
# - [google-cloud-
|
49
|
+
# - [google-cloud-debugger instrumentation](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/stackdriver/guides/debugger_instrumentation)
|
49
50
|
# - [google-cloud-error_reporting instrumentation](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/stackdriver/guides/error_reporting_instrumentation)
|
51
|
+
# - [google-cloud-logging instrumentation](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/stackdriver/guides/logging_instrumentation)
|
50
52
|
# - [google-cloud-trace instrumentation](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/stackdriver/guides/trace_instrumentation)
|
51
53
|
#
|
52
54
|
#
|
data/lib/stackdriver/version.rb
CHANGED
metadata
CHANGED
@@ -1,57 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stackdriver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Heng Xiong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: google-cloud-debugger
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.26.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.26.0
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: google-cloud-error_reporting
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - "~>"
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
33
|
+
version: 0.26.0
|
20
34
|
type: :runtime
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
38
|
- - "~>"
|
25
39
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
40
|
+
version: 0.26.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: google-cloud-logging
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
47
|
+
version: '1.2'
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
54
|
+
version: '1.2'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: google-cloud-trace
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
61
|
+
version: 0.26.0
|
48
62
|
type: :runtime
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
68
|
+
version: 0.26.0
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: minitest
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -202,7 +216,6 @@ files:
|
|
202
216
|
- ".yardopts"
|
203
217
|
- LICENSE
|
204
218
|
- README.md
|
205
|
-
- lib/legacy_stackdriver.rb
|
206
219
|
- lib/stackdriver.rb
|
207
220
|
- lib/stackdriver/version.rb
|
208
221
|
homepage: https://github.com/GoogleCloudPlatform/google-cloud-ruby/tree/master/stackdriver
|
@@ -217,7 +230,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
217
230
|
requirements:
|
218
231
|
- - ">="
|
219
232
|
- !ruby/object:Gem::Version
|
220
|
-
version: 2.
|
233
|
+
version: 2.2.0
|
221
234
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
222
235
|
requirements:
|
223
236
|
- - ">="
|
data/lib/legacy_stackdriver.rb
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
# Copyright (c) 2013 Grant T. Olson
|
2
|
-
# All rights reserved.
|
3
|
-
#
|
4
|
-
# Redistribution and use in source and binary forms, with or without
|
5
|
-
# modification, are permitted provided that the following conditions are
|
6
|
-
# met:
|
7
|
-
#
|
8
|
-
# * Redistributions of source code must retain the above copyright
|
9
|
-
# notice, this list of conditions and the following disclaimer.
|
10
|
-
#
|
11
|
-
# * Redistributions in binary form must reproduce the above
|
12
|
-
# copyright notice, this list of conditions and the following
|
13
|
-
# disclaimer in the documentation and/or other materials provided
|
14
|
-
# with the distribution.
|
15
|
-
#
|
16
|
-
# * Neither the name of the Grant T. Olson nor the names of
|
17
|
-
# additional contributors may be used to endorse or promote
|
18
|
-
# products derived from this software without specific prior
|
19
|
-
# written permission.
|
20
|
-
#
|
21
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
22
|
-
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
23
|
-
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
24
|
-
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
25
|
-
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
26
|
-
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
27
|
-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
28
|
-
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
29
|
-
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
30
|
-
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
31
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
-
|
33
|
-
|
34
|
-
#
|
35
|
-
# This file provides backward compatibility with legacy stackdriver v0.2.2 gem.
|
36
|
-
# Original code can be found at https://github.com/sammarx/stackdriver-ruby
|
37
|
-
#
|
38
|
-
require 'multi_json'
|
39
|
-
|
40
|
-
module StackDriver
|
41
|
-
POST_URI = "https://custom-gateway.stackdriver.com/v1/custom"
|
42
|
-
DELETE_URI = "https://custom-gateway.stackdriver.com/v1/delete_custom"
|
43
|
-
|
44
|
-
def self.init *args
|
45
|
-
# Deprecation message
|
46
|
-
puts "This usage is specific to the legacy Stackdriver service. It is " \
|
47
|
-
"deprecated and will be removed at some point in the future. Please " \
|
48
|
-
"migrate to the Google Stackdriver API documented at " \
|
49
|
-
"https://googlecloudplatform.github.io/google-cloud-ruby/"
|
50
|
-
|
51
|
-
if args.count > 1
|
52
|
-
puts "Customer ID is no longer needed, and will be deprecated"
|
53
|
-
args.shift
|
54
|
-
end
|
55
|
-
@api_key = args[0]
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.send_metric name, value, time, instance=''
|
59
|
-
msg = build_message name, value, time, instance
|
60
|
-
post MultiJson.dump(msg), StackDriver::POST_URI
|
61
|
-
end
|
62
|
-
|
63
|
-
def self.send_multi_metrics data
|
64
|
-
msg = build_multi_message data
|
65
|
-
post MultiJson.dump(msg), StackDriver::POST_URI
|
66
|
-
end
|
67
|
-
|
68
|
-
def self.delete_metric name, time
|
69
|
-
msg = build_message name, nil, time
|
70
|
-
post MultiJson.dump(msg), StackDriver::DELETE_URI
|
71
|
-
end
|
72
|
-
|
73
|
-
private
|
74
|
-
|
75
|
-
def self.post msg, uri
|
76
|
-
headers = {'content-type' => 'application/json',
|
77
|
-
'x-stackdriver-apikey' => @api_key}
|
78
|
-
|
79
|
-
uri = URI(uri)
|
80
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
81
|
-
http.use_ssl = true
|
82
|
-
|
83
|
-
http.start do |http|
|
84
|
-
response = http.post(uri.path, msg, headers)
|
85
|
-
if response.code != "201"
|
86
|
-
raise RuntimeError, "#{response.code} - #{response.body}"
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
def self.build_message name, value, time, instance=''
|
92
|
-
data_point = {'name' => name, 'value' => value, 'collected_at' => time}
|
93
|
-
data_point.merge!('value' => value) unless value.nil?
|
94
|
-
data_point.merge!('instance' => instance) unless instance.empty?
|
95
|
-
{'timestamp' => Time.now.to_i, 'proto_version' => '1', 'data' => data_point}
|
96
|
-
end
|
97
|
-
|
98
|
-
def self.build_multi_message data
|
99
|
-
data_point = data
|
100
|
-
{
|
101
|
-
'timestamp' => Time.now.to_i,
|
102
|
-
'proto_version' => '1',
|
103
|
-
'data' => data_point
|
104
|
-
}
|
105
|
-
end
|
106
|
-
end
|