elastic-apm 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1714ce04cac580fae85d1db089aad12a44e6ae719ae4c077c695ed19331d1862
4
- data.tar.gz: 2d2dc08bec25deca316844d1d4f8e878bf552ea473b27447f4476a82cf03872d
3
+ metadata.gz: b9c57d8f754de9ab6d024f95f2822b0eae82f17a00cd3edae13d290c9b850393
4
+ data.tar.gz: 4d32a175d46dac86cabdf97de023a49e7e5eb155a21be11eb227bf61afdb8ffc
5
5
  SHA512:
6
- metadata.gz: b1fba467b1fffb405b354511485b373d3e25bf141b6ab4404d80f4b9e431b4defc640b2f4c3edbc5e9253914844b09949ad6d617e3a5f0efe0c9f496ea7444ee
7
- data.tar.gz: dd749fc5782ab61ae5fe489fbe1d69dec7a33fac44a0a26fbd1c8b95b03f2f372c1e9350987e266f4098ec18cc3d409712a23ac92edfe0a1f25cef5760f64ebb
6
+ metadata.gz: '09cddb89d0d5265c7c12e8838702cde336754e197d8f4e6647f3885ccde3f6fc806f91b22ab054cf8c5c465373e34bf0f46580a2ab01513da5246d9ea443bb2c'
7
+ data.tar.gz: 10732912f09d131204363dd0191e59f689d9560935af8df0b195cd4a145e9402c4a5f3cc3ed136399471f1a406efd7202a7d8384772bc6356b4a64752333cd03
@@ -0,0 +1,16 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ open-pull-requests-limit: 10
8
+ ignore:
9
+ - dependency-name: sucker_punch
10
+ versions:
11
+ - "> 2.0"
12
+ - dependency-name: i18n
13
+ versions:
14
+ - 1.8.10
15
+ - 1.8.8
16
+ - 1.8.9
data/CHANGELOG.asciidoc CHANGED
@@ -35,6 +35,26 @@ endif::[]
35
35
  [[release-notes-4.x]]
36
36
  === Ruby Agent version 4.x
37
37
 
38
+ [[release-notes-4.1.0]]
39
+ ==== 4.1.0
40
+
41
+ [float]
42
+ ===== Added
43
+
44
+ - Azure App Services instance metadata {pull}1007[#1007]
45
+
46
+ [float]
47
+ ===== Changed
48
+
49
+ - `hostname` is now reported split by `configured_hostname` and `detected_hostname` {pull}1009[#1009]
50
+
51
+ [float]
52
+ ===== Fixed
53
+ - `service_node_name` is now correctly reported as `service.node.configured_name` {pull}1009[#1009]
54
+ - Fix JSON parsing when using yajl-ruby {pull}1012[#1012]
55
+ - Fix SpanHelpers when methods take blocks {pull}1013[#1013]
56
+ - Fix missing `environment` param when fetching from Central Config {pull}1014[#1014]
57
+
38
58
  [[release-notes-4.0.0]]
39
59
  ==== 4.0.0
40
60
 
@@ -164,7 +164,8 @@ module ElasticAPM
164
164
  @server_url ||=
165
165
  config.server_url +
166
166
  '/config/v1/agents' \
167
- "?service.name=#{CGI.escape(config.service_name)}"
167
+ "?service.name=#{CGI.escape(config.service_name)}" \
168
+ "&service.environment=#{CGI.escape(config.environment || '')}"
168
169
  end
169
170
 
170
171
  def headers
@@ -57,9 +57,9 @@ module ElasticAPM
57
57
  when "gcp"
58
58
  fetch_gcp
59
59
  when "azure"
60
- fetch_azure
60
+ fetch_azure || read_azure_app_services
61
61
  when "auto"
62
- fetch_aws || fetch_gcp || fetch_azure
62
+ fetch_aws || fetch_gcp || fetch_azure || read_azure_app_services
63
63
  when "none"
64
64
  nil
65
65
  else
@@ -76,7 +76,7 @@ module ElasticAPM
76
76
  resp = @client.get(AWS_URI)
77
77
 
78
78
  return unless resp.status == 200
79
- return unless (metadata = JSON.parse(resp.body))
79
+ return unless (metadata = JSON.parse(resp.body.to_s))
80
80
 
81
81
  self.provider = "aws"
82
82
  self.account_id = metadata["accountId"]
@@ -92,7 +92,7 @@ module ElasticAPM
92
92
  resp = @client.headers("Metadata-Flavor" => "Google").get(GCP_URI)
93
93
 
94
94
  return unless resp.status == 200
95
- return unless (metadata = JSON.parse(resp.body))
95
+ return unless (metadata = JSON.parse(resp.body.to_s))
96
96
 
97
97
  zone = metadata["instance"]["zone"]&.split("/")&.at(-1)
98
98
 
@@ -112,7 +112,7 @@ module ElasticAPM
112
112
  resp = @client.headers("Metadata" => "true").get(AZURE_URI)
113
113
 
114
114
  return unless resp.status == 200
115
- return unless (metadata = JSON.parse(resp.body))
115
+ return unless (metadata = JSON.parse(resp.body.to_s))
116
116
 
117
117
  self.provider = 'azure'
118
118
  self.account_id = metadata["subscriptionId"]
@@ -125,6 +125,33 @@ module ElasticAPM
125
125
  rescue HTTP::TimeoutError, HTTP::ConnectionError
126
126
  nil
127
127
  end
128
+
129
+ def read_azure_app_services
130
+ owner_name, instance_id, site_name, resource_group =
131
+ ENV.values_at(
132
+ 'WEBSITE_OWNER_NAME',
133
+ 'WEBSITE_INSTANCE_ID',
134
+ 'WEBSITE_SITE_NAME',
135
+ 'WEBSITE_RESOURCE_GROUP'
136
+ )
137
+
138
+ return unless owner_name && instance_id && site_name && resource_group
139
+
140
+ self.provider = 'azure'
141
+ self.instance_id = instance_id
142
+ self.instance_name = site_name
143
+ self.project_name = resource_group
144
+ self.account_id, self.region = parse_azure_app_services_owner_name(owner_name)
145
+ end
146
+
147
+ private
148
+
149
+ def parse_azure_app_services_owner_name(owner_name)
150
+ id, rest = owner_name.split('+')
151
+ *_, region = rest.split('-')
152
+ region.gsub!(/webspace.*$/, '')
153
+ [id, region]
154
+ end
128
155
  end
129
156
  end
130
157
  end
@@ -24,7 +24,8 @@ module ElasticAPM
24
24
  def initialize(config)
25
25
  @config = config
26
26
 
27
- @hostname = @config.hostname || self.class.system_hostname
27
+ @configured_hostname = @config.hostname
28
+ @detected_hostname = detect_hostname
28
29
  @architecture = gem_platform.cpu
29
30
  @platform = gem_platform.os
30
31
 
@@ -33,14 +34,23 @@ module ElasticAPM
33
34
  @kubernetes = container_info.kubernetes
34
35
  end
35
36
 
36
- attr_reader :hostname, :architecture, :platform, :container, :kubernetes
37
+ attr_reader(
38
+ :detected_hostname,
39
+ :configured_hostname,
40
+ :architecture,
41
+ :platform,
42
+ :container,
43
+ :kubernetes
44
+ )
37
45
 
38
46
  def gem_platform
39
47
  @gem_platform ||= Gem::Platform.local
40
48
  end
41
49
 
42
- def self.system_hostname
43
- @system_hostname ||= `hostname`.chomp
50
+ private
51
+
52
+ def detect_hostname
53
+ `hostname`.chomp
44
54
  end
45
55
  end
46
56
  end
@@ -37,13 +37,13 @@ module ElasticAPM
37
37
  type ||= Span::DEFAULT_TYPE
38
38
 
39
39
  klass.prepend(Module.new do
40
- define_method(method) do |*args|
40
+ define_method(method) do |*args, &block|
41
41
  unless ElasticAPM.current_transaction
42
- return super(*args)
42
+ return super(*args, &block)
43
43
  end
44
44
 
45
45
  ElasticAPM.with_span name.to_s, type.to_s do
46
- super(*args)
46
+ super(*args, &block)
47
47
  end
48
48
  end
49
49
  end)
@@ -65,7 +65,7 @@ module ElasticAPM
65
65
  }
66
66
 
67
67
  if (node_name = service.node_name)
68
- base[:node] = { name: keyword_field(node_name) }
68
+ base[:node] = { configured_name: keyword_field(node_name) }
69
69
  end
70
70
 
71
71
  base
@@ -81,7 +81,8 @@ module ElasticAPM
81
81
 
82
82
  def build_system(system)
83
83
  {
84
- hostname: keyword_field(system.hostname),
84
+ detected_hostname: keyword_field(system.detected_hostname),
85
+ configured_hostname: keyword_field(system.configured_hostname),
85
86
  architecture: keyword_field(system.architecture),
86
87
  platform: keyword_field(system.platform),
87
88
  kubernetes: keyword_object(system.kubernetes),
@@ -18,5 +18,5 @@
18
18
  # frozen_string_literal: true
19
19
 
20
20
  module ElasticAPM
21
- VERSION = '4.0.0'
21
+ VERSION = '4.1.0'
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic-apm
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikkel Malmberg
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-27 00:00:00.000000000 Z
11
+ date: 2021-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.0'
41
- description:
41
+ description:
42
42
  email:
43
43
  - mikkel@elastic.co
44
44
  executables: []
@@ -69,6 +69,7 @@ files:
69
69
  - ".github/ISSUE_TEMPLATE/Bug_report.md"
70
70
  - ".github/ISSUE_TEMPLATE/Feature_request.md"
71
71
  - ".github/PULL_REQUEST_TEMPLATE.md"
72
+ - ".github/dependabot.yml"
72
73
  - ".github/labeler-config.yml"
73
74
  - ".github/workflows/addToProject.yml"
74
75
  - ".github/workflows/labeler.yml"
@@ -253,7 +254,7 @@ licenses:
253
254
  - Apache-2.0
254
255
  metadata:
255
256
  source_code_uri: https://github.com/elastic/apm-agent-ruby
256
- post_install_message:
257
+ post_install_message:
257
258
  rdoc_options: []
258
259
  require_paths:
259
260
  - lib
@@ -268,8 +269,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
269
  - !ruby/object:Gem::Version
269
270
  version: '0'
270
271
  requirements: []
271
- rubygems_version: 3.0.3.1
272
- signing_key:
272
+ rubygems_version: 3.1.6
273
+ signing_key:
273
274
  specification_version: 4
274
275
  summary: The official Elastic APM agent for Ruby
275
276
  test_files: []