elastic-apm 3.10.0 → 3.12.1
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/CHANGELOG.asciidoc +55 -0
- data/Gemfile +0 -3
- data/docs/api.asciidoc +2 -1
- data/docs/configuration.asciidoc +1 -0
- data/lib/elastic_apm.rb +14 -2
- data/lib/elastic_apm/config.rb +24 -6
- data/lib/elastic_apm/config/options.rb +2 -1
- data/lib/elastic_apm/config/round_float.rb +31 -0
- data/lib/elastic_apm/config/wildcard_pattern_list.rb +2 -0
- data/lib/elastic_apm/instrumenter.rb +10 -3
- data/lib/elastic_apm/metadata.rb +3 -1
- data/lib/elastic_apm/metadata/cloud_info.rb +128 -0
- data/lib/elastic_apm/middleware.rb +8 -3
- data/lib/elastic_apm/span.rb +16 -1
- data/lib/elastic_apm/spies/delayed_job.rb +6 -2
- data/lib/elastic_apm/spies/elasticsearch.rb +8 -2
- data/lib/elastic_apm/spies/faraday.rb +1 -0
- data/lib/elastic_apm/spies/http.rb +1 -0
- data/lib/elastic_apm/spies/mongo.rb +6 -2
- data/lib/elastic_apm/spies/net_http.rb +1 -0
- data/lib/elastic_apm/spies/rake.rb +4 -2
- data/lib/elastic_apm/spies/resque.rb +4 -2
- data/lib/elastic_apm/spies/sequel.rb +10 -1
- data/lib/elastic_apm/spies/shoryuken.rb +2 -0
- data/lib/elastic_apm/spies/sidekiq.rb +2 -0
- data/lib/elastic_apm/spies/sneakers.rb +2 -0
- data/lib/elastic_apm/spies/sucker_punch.rb +2 -0
- data/lib/elastic_apm/trace_context.rb +1 -1
- data/lib/elastic_apm/trace_context/traceparent.rb +2 -4
- data/lib/elastic_apm/trace_context/tracestate.rb +112 -9
- data/lib/elastic_apm/transaction.rb +39 -6
- data/lib/elastic_apm/transport/connection.rb +1 -0
- data/lib/elastic_apm/transport/filters/hash_sanitizer.rb +14 -15
- data/lib/elastic_apm/transport/filters/secrets_filter.rb +10 -6
- data/lib/elastic_apm/transport/serializers.rb +8 -6
- data/lib/elastic_apm/transport/serializers/metadata_serializer.rb +43 -3
- data/lib/elastic_apm/transport/serializers/span_serializer.rb +3 -1
- data/lib/elastic_apm/transport/serializers/transaction_serializer.rb +2 -0
- data/lib/elastic_apm/transport/user_agent.rb +3 -3
- data/lib/elastic_apm/transport/worker.rb +1 -0
- data/lib/elastic_apm/util.rb +2 -0
- data/lib/elastic_apm/util/deep_dup.rb +66 -0
- data/lib/elastic_apm/util/precision_validator.rb +46 -0
- data/lib/elastic_apm/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de9bb2ac6873a987cb7c7d0cdf51f8c11908d0d3ada729bd21bb4bc24d3aa3dc
|
4
|
+
data.tar.gz: 571507faa100bb620c116dbe11bdcad1b958c718c89a7f8572732ef3939ad70f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 916cfb05143133cf1c0680d2495f2877997d607cac710063d3862acf62105d256434f0e3f9170599fa5d6c2a59c80ff39dace42584a0cce493b5f476ad6e8e5e
|
7
|
+
data.tar.gz: af7f87595e02ec5996c7a1ecf5aac7e7deb376ae4a32d30c250ad6293be3ce086a8a64074e88b79f6dcb2ce52b1c9861e7d7031119da58026bfff9e2ca841eb4
|
data/CHANGELOG.asciidoc
CHANGED
@@ -35,6 +35,61 @@ endif::[]
|
|
35
35
|
[[release-notes-3.x]]
|
36
36
|
=== Ruby Agent version 3.x
|
37
37
|
|
38
|
+
[[release-notes-3.12.1]]
|
39
|
+
==== 3.12.1 (2020-11-16)
|
40
|
+
|
41
|
+
[float]
|
42
|
+
===== Fixed
|
43
|
+
|
44
|
+
- `capture_elasticsearch_queries` no longer modifies the original query {pull}894[#894]
|
45
|
+
|
46
|
+
[[release-notes-3.12.0]]
|
47
|
+
==== 3.12.0 (2020-11-10)
|
48
|
+
|
49
|
+
[float]
|
50
|
+
===== Added
|
51
|
+
|
52
|
+
- Add outcome to transactions and spans {pull}883[#883]
|
53
|
+
|
54
|
+
[[release-notes-3.11.1]]
|
55
|
+
==== 3.11.1 (2020-11-05)
|
56
|
+
|
57
|
+
[float]
|
58
|
+
===== Fixed
|
59
|
+
|
60
|
+
- Fix reporting from Kubernetes based deploys to APM Server 7.9.x {pull}885[#885]
|
61
|
+
|
62
|
+
[[release-notes-3.11.0]]
|
63
|
+
==== 3.11.0 (2020-10-27)
|
64
|
+
|
65
|
+
[float]
|
66
|
+
===== Added
|
67
|
+
|
68
|
+
- Add and read sampling info from Tracestate headers {pull}858[#858]
|
69
|
+
- Add information about cloud hosting environment if available {pull}871[#871]
|
70
|
+
|
71
|
+
[float]
|
72
|
+
===== Changed
|
73
|
+
|
74
|
+
- Align the default value of `sanitize_field_names` with other agents {pull}867[#867]
|
75
|
+
- Ensure max 4 digits of precision for `sample_rate` as per agent spec {pull}880[#880]
|
76
|
+
|
77
|
+
[float]
|
78
|
+
===== Fixed
|
79
|
+
|
80
|
+
- Fix Delayed::Job class names when used through ActiveJob {pull}869[#869]
|
81
|
+
- Fix Delayed::Job when run without the agent running {pull}874[#874]
|
82
|
+
- Fix Kubernetes related metadata {pull}882[#882]
|
83
|
+
|
84
|
+
[[release-notes-3.10.1]]
|
85
|
+
==== 3.10.1 (2020-08-26)
|
86
|
+
|
87
|
+
[float]
|
88
|
+
===== Fixed
|
89
|
+
|
90
|
+
- Remove secrets from cookies in errors {pull}863[#863]
|
91
|
+
- Silence deprecation warning when setting `ignore_url_patterns` to default {pull}865[#865]
|
92
|
+
|
38
93
|
[[release-notes-3.10.0]]
|
39
94
|
==== 3.10.0 (2020-08-26)
|
40
95
|
|
data/Gemfile
CHANGED
@@ -22,14 +22,11 @@ source 'https://rubygems.org'
|
|
22
22
|
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
23
23
|
|
24
24
|
# Tools
|
25
|
-
gem 'bootsnap', require: false
|
26
25
|
gem 'cucumber', require: false
|
27
26
|
gem 'pry'
|
28
27
|
gem 'rack-test'
|
29
28
|
gem 'rspec', '~> 3'
|
30
29
|
gem 'rspec-its'
|
31
|
-
gem 'rubocop', require: nil
|
32
|
-
gem 'rubocop-performance', require: nil
|
33
30
|
gem 'timecop'
|
34
31
|
gem 'webmock'
|
35
32
|
|
data/docs/api.asciidoc
CHANGED
@@ -433,6 +433,7 @@ end
|
|
433
433
|
- `name`: String
|
434
434
|
- `type`: String
|
435
435
|
- `result`: String
|
436
|
+
- `outcome`: String ('unknown', 'success', 'failure', nil)
|
436
437
|
- `trace_id`: String (readonly)
|
437
438
|
|
438
439
|
[float]
|
@@ -457,7 +458,7 @@ If your service generates the HTML page dynamically, initializing the
|
|
457
458
|
JavaScript RUM agent with the value of this method allows analyzing the time
|
458
459
|
spent in the browser vs in the backend services.
|
459
460
|
|
460
|
-
To enable the JavaScript RUM agent,
|
461
|
+
To enable the JavaScript RUM agent, initialize the RUM agent with the Ruby
|
461
462
|
agent's current transaction:
|
462
463
|
|
463
464
|
[source,html]
|
data/docs/configuration.asciidoc
CHANGED
@@ -853,6 +853,7 @@ To reduce overhead and storage requirements, you can set the sample rate to a va
|
|
853
853
|
between `0.0` and `1.0`.
|
854
854
|
We still record overall time and the result for unsampled transactions, but no
|
855
855
|
context information, tags, or spans.
|
856
|
+
Note that the sample rate will be rounded to 4 digits of precision.
|
856
857
|
|
857
858
|
[float]
|
858
859
|
[[config-use-experimental-sql-parser]]
|
data/lib/elastic_apm.rb
CHANGED
@@ -183,7 +183,12 @@ module ElasticAPM
|
|
183
183
|
context: context,
|
184
184
|
trace_context: trace_context
|
185
185
|
)
|
186
|
-
yield transaction
|
186
|
+
result = yield transaction
|
187
|
+
transaction&.outcome ||= Transaction::Outcome::SUCCESS
|
188
|
+
result
|
189
|
+
rescue
|
190
|
+
transaction&.outcome ||= Transaction::Outcome::FAILURE
|
191
|
+
raise
|
187
192
|
ensure
|
188
193
|
end_transaction
|
189
194
|
end
|
@@ -287,7 +292,14 @@ module ElasticAPM
|
|
287
292
|
parent: parent,
|
288
293
|
sync: sync
|
289
294
|
)
|
290
|
-
yield span
|
295
|
+
result = yield span
|
296
|
+
span&.outcome =
|
297
|
+
Span::Outcome::SUCCESS unless span&.outcome
|
298
|
+
result
|
299
|
+
rescue
|
300
|
+
span&.outcome =
|
301
|
+
Span::Outcome::FAILURE unless span&.outcome
|
302
|
+
raise
|
291
303
|
ensure
|
292
304
|
end_span
|
293
305
|
end
|
data/lib/elastic_apm/config.rb
CHANGED
@@ -17,9 +17,10 @@
|
|
17
17
|
|
18
18
|
# frozen_string_literal: true
|
19
19
|
|
20
|
-
require 'elastic_apm/config/options'
|
21
|
-
require 'elastic_apm/config/duration'
|
22
20
|
require 'elastic_apm/config/bytes'
|
21
|
+
require 'elastic_apm/config/duration'
|
22
|
+
require 'elastic_apm/config/options'
|
23
|
+
require 'elastic_apm/config/round_float'
|
23
24
|
require 'elastic_apm/config/regexp_list'
|
24
25
|
require 'elastic_apm/config/wildcard_pattern_list'
|
25
26
|
|
@@ -30,6 +31,11 @@ module ElasticAPM
|
|
30
31
|
|
31
32
|
DEPRECATED_OPTIONS = %i[].freeze
|
32
33
|
|
34
|
+
# DEPRECATED: To align with other agents, change on next major bump to:
|
35
|
+
# "password, passwd, pwd, secret, *key, *token*, *session*, *credit*, *card*, authorization, set-cookie"
|
36
|
+
SANITIZE_FIELD_NAMES_DEFAULT =
|
37
|
+
%w[*password* *passwd* *pwd* *secret* *key* *token* *session* *credit* *card* *authorization* *set-cookie*]
|
38
|
+
|
33
39
|
# rubocop:disable Metrics/LineLength, Layout/ExtraSpacing
|
34
40
|
option :config_file, type: :string, default: 'config/elastic_apm.yml'
|
35
41
|
option :server_url, type: :url, default: 'http://localhost:8200'
|
@@ -45,6 +51,7 @@ module ElasticAPM
|
|
45
51
|
option :capture_elasticsearch_queries, type: :bool, default: false
|
46
52
|
option :capture_env, type: :bool, default: true
|
47
53
|
option :central_config, type: :bool, default: true
|
54
|
+
option :cloud_provider, type: :string, default: 'auto'
|
48
55
|
option :current_user_email_method, type: :string, default: 'email'
|
49
56
|
option :current_user_id_method, type: :string, default: 'id'
|
50
57
|
option :current_user_username_method, type: :string, default: 'username'
|
@@ -76,7 +83,8 @@ module ElasticAPM
|
|
76
83
|
option :proxy_port, type: :int
|
77
84
|
option :proxy_username, type: :string
|
78
85
|
option :recording, type: :bool, default: true
|
79
|
-
option :sanitize_field_names, type: :list,
|
86
|
+
option :sanitize_field_names, type: :list,
|
87
|
+
default: SANITIZE_FIELD_NAMES_DEFAULT, converter: WildcardPatternList.new
|
80
88
|
option :server_ca_cert, type: :string
|
81
89
|
option :service_name, type: :string
|
82
90
|
option :service_node_name, type: :string
|
@@ -89,7 +97,7 @@ module ElasticAPM
|
|
89
97
|
option :stack_trace_limit, type: :int, default: 999_999
|
90
98
|
option :transaction_ignore_urls, type: :list, default: [], converter: WildcardPatternList.new
|
91
99
|
option :transaction_max_spans, type: :int, default: 500
|
92
|
-
option :transaction_sample_rate, type: :float, default: 1.0
|
100
|
+
option :transaction_sample_rate, type: :float, default: 1.0, converter: RoundFloat.new
|
93
101
|
option :use_elastic_traceparent_header, type: :bool, default: true
|
94
102
|
option :use_legacy_sql_parser, type: :bool, default: false
|
95
103
|
option :verify_server_cert, type: :bool, default: true
|
@@ -189,6 +197,14 @@ module ElasticAPM
|
|
189
197
|
metrics_interval > 0
|
190
198
|
end
|
191
199
|
|
200
|
+
# DEPRECATED: Remove this in next major version
|
201
|
+
def sanitize_field_names=(value)
|
202
|
+
list = WildcardPatternList.new.call(value)
|
203
|
+
defaults = WildcardPatternList.new.call(SANITIZE_FIELD_NAMES_DEFAULT)
|
204
|
+
get(:sanitize_field_names).value =
|
205
|
+
defaults.concat(list).uniq(&:pattern) # use regex pattern for comparisons
|
206
|
+
end
|
207
|
+
|
192
208
|
def span_frames_min_duration?
|
193
209
|
span_frames_min_duration != 0
|
194
210
|
end
|
@@ -236,8 +252,10 @@ module ElasticAPM
|
|
236
252
|
end
|
237
253
|
|
238
254
|
def ignore_url_patterns=(value)
|
239
|
-
|
240
|
-
'
|
255
|
+
unless value == self.class.schema[:ignore_url_patterns][:default]
|
256
|
+
warn '[DEPRECATED] The option ignore_url_patterns is being removed. ' \
|
257
|
+
'Consider using transaction_ignore_urls instead.'
|
258
|
+
end
|
241
259
|
|
242
260
|
set(:ignore_url_patterns, value)
|
243
261
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
18
|
+
# frozen_string_literal: true
|
19
|
+
|
20
|
+
require 'elastic_apm/util/precision_validator'
|
21
|
+
|
22
|
+
module ElasticAPM
|
23
|
+
class Config
|
24
|
+
# @api private
|
25
|
+
class RoundFloat
|
26
|
+
def call(value)
|
27
|
+
Util::PrecisionValidator.validate(value, precision: 4, minimum: 0.0001)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -119,7 +119,13 @@ module ElasticAPM
|
|
119
119
|
"Already inside #{transaction.inspect}"
|
120
120
|
end
|
121
121
|
|
122
|
-
|
122
|
+
if trace_context
|
123
|
+
sampled = trace_context.recorded?
|
124
|
+
sample_rate = trace_context.tracestate.sample_rate
|
125
|
+
else
|
126
|
+
sampled = random_sample?(config)
|
127
|
+
sample_rate = config.transaction_sample_rate
|
128
|
+
end
|
123
129
|
|
124
130
|
transaction =
|
125
131
|
Transaction.new(
|
@@ -128,6 +134,7 @@ module ElasticAPM
|
|
128
134
|
context: context,
|
129
135
|
trace_context: trace_context,
|
130
136
|
sampled: sampled,
|
137
|
+
sample_rate: sample_rate,
|
131
138
|
config: config
|
132
139
|
)
|
133
140
|
|
@@ -259,7 +266,7 @@ module ElasticAPM
|
|
259
266
|
end
|
260
267
|
|
261
268
|
def update_transaction_metrics(transaction)
|
262
|
-
return unless transaction.collect_metrics
|
269
|
+
return unless transaction.collect_metrics?
|
263
270
|
|
264
271
|
tags = {
|
265
272
|
'transaction.name': transaction.name,
|
@@ -298,7 +305,7 @@ module ElasticAPM
|
|
298
305
|
end
|
299
306
|
|
300
307
|
def update_span_metrics(span)
|
301
|
-
return unless span.transaction.
|
308
|
+
return unless span.transaction.collect_metrics?
|
302
309
|
|
303
310
|
tags = {
|
304
311
|
'span.type': span.type,
|
data/lib/elastic_apm/metadata.rb
CHANGED
@@ -25,12 +25,14 @@ module ElasticAPM
|
|
25
25
|
@process = ProcessInfo.new(config)
|
26
26
|
@system = SystemInfo.new(config)
|
27
27
|
@labels = config.global_labels
|
28
|
+
@cloud = CloudInfo.new(config).fetch!
|
28
29
|
end
|
29
30
|
|
30
|
-
attr_reader :service, :process, :system, :labels
|
31
|
+
attr_reader :service, :process, :system, :cloud, :labels
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
34
35
|
require 'elastic_apm/metadata/service_info'
|
35
36
|
require 'elastic_apm/metadata/system_info'
|
36
37
|
require 'elastic_apm/metadata/process_info'
|
38
|
+
require 'elastic_apm/metadata/cloud_info'
|
@@ -0,0 +1,128 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
18
|
+
# frozen_string_literal: true
|
19
|
+
|
20
|
+
require "http"
|
21
|
+
|
22
|
+
module ElasticAPM
|
23
|
+
class Metadata
|
24
|
+
# @api private
|
25
|
+
class CloudInfo
|
26
|
+
include Logging
|
27
|
+
|
28
|
+
AWS_URI = "http://169.254.169.254/latest/dynamic/instance-identity/document"
|
29
|
+
GCP_URI = "http://metadata.google.internal/computeMetadata/v1/?recursive=true"
|
30
|
+
AZURE_URI = "http://169.254.169.254/metadata/instance/compute?api-version=2019-08-15"
|
31
|
+
|
32
|
+
def initialize(config)
|
33
|
+
@config = config
|
34
|
+
@client = HTTP.timeout(0.1)
|
35
|
+
end
|
36
|
+
|
37
|
+
attr_reader :config
|
38
|
+
|
39
|
+
attr_accessor(
|
40
|
+
:account_id,
|
41
|
+
:account_name,
|
42
|
+
:instance_id,
|
43
|
+
:instance_name,
|
44
|
+
:machine_type,
|
45
|
+
:project_id,
|
46
|
+
:project_name,
|
47
|
+
:availability_zone,
|
48
|
+
:provider,
|
49
|
+
:region
|
50
|
+
)
|
51
|
+
|
52
|
+
def fetch!
|
53
|
+
case config.cloud_provider
|
54
|
+
when "aws"
|
55
|
+
fetch_aws
|
56
|
+
when "gcp"
|
57
|
+
fetch_gcp
|
58
|
+
when "azure"
|
59
|
+
fetch_azure
|
60
|
+
when "auto"
|
61
|
+
fetch_aws || fetch_gcp || fetch_azure
|
62
|
+
when "none"
|
63
|
+
nil
|
64
|
+
else
|
65
|
+
error("Unknown setting for cloud_provider '#{config.cloud_provider}'")
|
66
|
+
end
|
67
|
+
|
68
|
+
self
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def fetch_aws
|
74
|
+
resp = @client.get(AWS_URI)
|
75
|
+
|
76
|
+
return unless resp.status == 200
|
77
|
+
return unless (metadata = JSON.parse(resp.body))
|
78
|
+
|
79
|
+
self.provider = "aws"
|
80
|
+
self.account_id = metadata["accountId"]
|
81
|
+
self.instance_id = metadata["instanceId"]
|
82
|
+
self.availability_zone = metadata["availabilityZone"]
|
83
|
+
self.machine_type = metadata["instanceType"]
|
84
|
+
self.region = metadata["region"]
|
85
|
+
rescue HTTP::TimeoutError, HTTP::ConnectionError
|
86
|
+
nil
|
87
|
+
end
|
88
|
+
|
89
|
+
def fetch_gcp
|
90
|
+
resp = @client.headers("Metadata-Flavor" => "Google").get(GCP_URI)
|
91
|
+
|
92
|
+
return unless resp.status == 200
|
93
|
+
return unless (metadata = JSON.parse(resp.body))
|
94
|
+
|
95
|
+
zone = metadata["instance"]["zone"]&.split("/")&.at(-1)
|
96
|
+
|
97
|
+
self.provider = "gcp"
|
98
|
+
self.instance_id = metadata["instance"]["id"]
|
99
|
+
self.instance_name = metadata["instance"]["name"]
|
100
|
+
self.project_id = metadata["project"]["numericProjectId"]
|
101
|
+
self.project_name = metadata["project"]["projectId"]
|
102
|
+
self.availability_zone = zone
|
103
|
+
self.region = zone.split("-")[0..-2].join("-")
|
104
|
+
self.machine_type = metadata["instance"]["machineType"]
|
105
|
+
rescue HTTP::TimeoutError, HTTP::ConnectionError
|
106
|
+
nil
|
107
|
+
end
|
108
|
+
|
109
|
+
def fetch_azure
|
110
|
+
resp = @client.headers("Metadata" => "true").get(AZURE_URI)
|
111
|
+
|
112
|
+
return unless resp.status == 200
|
113
|
+
return unless (metadata = JSON.parse(resp.body))
|
114
|
+
|
115
|
+
self.provider = 'azure'
|
116
|
+
self.account_id = metadata["subscriptionId"]
|
117
|
+
self.instance_id = metadata["vmId"]
|
118
|
+
self.instance_name = metadata["name"]
|
119
|
+
self.project_name = metadata["resourceGroupName"]
|
120
|
+
self.availability_zone = metadata["zone"]
|
121
|
+
self.machine_type = metadata["vmSize"]
|
122
|
+
self.region = metadata["location"]
|
123
|
+
rescue HTTP::TimeoutError, HTTP::ConnectionError
|
124
|
+
nil
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|