opentelemetry-resource_detectors 0.5.1 → 0.10.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: 25c6ff9afacac86f3a66efe8e361f69bf2f79a0a7910d995eea154cf69afb6a2
4
- data.tar.gz: a3b0feffe4e6bc8473c487fa7b75e38a3639854f903e5f5e1e185370e1490a46
3
+ metadata.gz: da73964cec06ce61e82b77febff0d16298c8cc32b8624cdd7fb3d97302c05e6f
4
+ data.tar.gz: becd0e1f53c97a0d3c98db73064c10b932abf8fa12ab10f1101a12429a4bf93e
5
5
  SHA512:
6
- metadata.gz: 423eb933b8c9d6889aab9274fb4b52b0874a5712045737a2be706239eedc687439ccc902ab5c5e59df9af1a602857c007b9613c64cc982c03a40cb9d71e98d2f
7
- data.tar.gz: 050bfe67e1a741b397deb4f3421f6eae22a5aa25535b7fc66e602fccbdf6d02eed387cdf5f7e4284f70ce3a6c5d6894b4db7b98f3360ce7c5a217d7d5bcd5007
6
+ metadata.gz: 6e281670c868ddbd8f9fa3600136852f2fdbb30d2a4ba71230d681badfec2293dcc9ac7b3ed0aa0293ac0906295c6bebac43958840c6b627804e36b036079f16
7
+ data.tar.gz: bdad92a9f35999c5a33608e60cd12dffe1e0458142957809d09a6bc71bccc95e87e71bf1bc4acfd65aa00714a930e82f41619ca91ac14cb33200f27d75f0f3af
@@ -0,0 +1,9 @@
1
+ --no-private
2
+ --title=OpenTelemetry Resource Detectors
3
+ --markup=markdown
4
+ --main=README.md
5
+ ./lib/opentelemetry/resource/detectors/**/*.rb
6
+ ./lib/opentelemetry/resource/detectors.rb
7
+ -
8
+ README.md
9
+ CHANGELOG.md
@@ -0,0 +1,26 @@
1
+ # Release History: opentelemetry-resource_detectors
2
+
3
+ ### v0.10.0 / 2020-12-03
4
+
5
+ * (No significant changes)
6
+
7
+ ### v0.9.0 / 2020-11-27
8
+
9
+ * BREAKING CHANGE: Add timeout for force_flush and shutdown
10
+
11
+ * ADDED: Add timeout for force_flush and shutdown
12
+
13
+ ### v0.8.0 / 2020-10-27
14
+
15
+ * (No significant changes)
16
+
17
+ ### v0.7.0 / 2020-10-07
18
+
19
+ * DOCS: Standardize toplevel docs structure and readme
20
+
21
+ ### v0.6.0 / 2020-09-10
22
+
23
+ * BREAKING CHANGE: Rename Resource labels to attributes
24
+
25
+ * FIXED: Rename Resource labels to attributes
26
+ * ADDED: Environment variable resource detection
data/README.md CHANGED
@@ -4,13 +4,13 @@ The `opentelemetry-resource-detectors` gem provides resource detectors for OpenT
4
4
 
5
5
  ## What is OpenTelemetry?
6
6
 
7
- [OpenTelemetry][opentelemetry-home] is an open source observability framework, providing a general-purpose API, SDK, and related tools required for the instrumentation of cloud-native software, frameworks, and libraries.
7
+ OpenTelemetry is an open source observability framework, providing a general-purpose API, SDK, and related tools required for the instrumentation of cloud-native software, frameworks, and libraries.
8
8
 
9
9
  OpenTelemetry provides a single set of APIs, libraries, agents, and collector services to capture distributed traces and metrics from your application. You can analyze them using Prometheus, Jaeger, and other observability tools.
10
10
 
11
11
  ## How does this gem fit in?
12
12
 
13
- The `opentelemetry-resource-detectors` gem provides a means of retrieving a [resource](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/resource/sdk.md) for supported environments following the [resource semantic conventions](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/resource/semantic_conventions/README.md).
13
+ The `opentelemetry-resource-detectors` gem provides a means of retrieving a resource for supported environments following the resource semantic conventions.
14
14
 
15
15
  ## How do I get started?
16
16
 
@@ -21,7 +21,7 @@ gem install opentelemetry-sdk
21
21
  gem install opentelemetry-resource-detectors
22
22
  ```
23
23
 
24
- Or, if you use [bundler][bundler-home], include `opentelemetry-sdk` and `opentelemetry-resource-detectors` in your `Gemfile`.
24
+ Or, if you use Bundler, include `opentelemetry-sdk` and `opentelemetry-resource-detectors` in your `Gemfile`.
25
25
 
26
26
  ```rb
27
27
  require 'opentelemetry/sdk'
@@ -40,20 +40,10 @@ end
40
40
 
41
41
  ## How can I get involved?
42
42
 
43
- The `opentelemetry-resource-detectors` gem source is [on github][repo-github], along with related gems.
43
+ The `opentelemetry-resource-detectors` gem source is on github, along with related gems.
44
44
 
45
- The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us on our [gitter channel][ruby-gitter] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
45
+ The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us on our gitter channel or attending our weekly meeting. See the meeting calendar for dates and times. For more information on this and other language SIGs, see the OpenTelemetry community page.
46
46
 
47
47
  ## License
48
48
 
49
- The `opentelemetry-resource-detectors` gem is distributed under the Apache 2.0 license. See [LICENSE][license-github] for more information.
50
-
51
-
52
- [opentelemetry-home]: https://opentelemetry.io
53
- [bundler-home]: https://bundler.io
54
- [repo-github]: https://github.com/open-telemetry/opentelemetry-ruby
55
- [license-github]: https://github.com/open-telemetry/opentelemetry-ruby/blob/master/LICENSE
56
- [examples-github]: https://github.com/open-telemetry/opentelemetry-ruby/tree/master/examples
57
- [ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
58
- [community-meetings]: https://github.com/open-telemetry/community#community-meetings
59
- [ruby-gitter]: https://gitter.im/open-telemetry/opentelemetry-ruby
49
+ The `opentelemetry-resource-detectors` gem is distributed under the Apache 2.0 license. See LICENSE for more information.
@@ -9,6 +9,12 @@ require 'opentelemetry/resource/detectors/version'
9
9
  require 'opentelemetry/resource/detectors/google_cloud_platform'
10
10
  require 'opentelemetry/resource/detectors/auto_detector'
11
11
 
12
+ # OpenTelemetry is an open source observability framework, providing a
13
+ # general-purpose API, SDK, and related tools required for the instrumentation
14
+ # of cloud-native software, frameworks, and libraries.
15
+ #
16
+ # The OpenTelemetry module provides global accessors for telemetry objects.
17
+ # See the documentation for the `opentelemetry-api` gem for details.
12
18
  module OpenTelemetry
13
19
  module Resource
14
20
  # Detectors contains the resource detectors as well as the AutoDetector
@@ -9,42 +9,43 @@ require 'google-cloud-env'
9
9
  module OpenTelemetry
10
10
  module Resource
11
11
  module Detectors
12
- # GoogleCloudPlatform contains detect class method for determining gcp environment resource labels
12
+ # GoogleCloudPlatform contains detect class method for determining gcp environment resource attributes
13
13
  module GoogleCloudPlatform
14
14
  extend self
15
15
 
16
- def detect # rubocop:disable Metrics/AbcSize
16
+ def detect # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
17
17
  gcp_env = Google::Cloud::Env.new
18
- resource_labels = {}
18
+ resource_attributes = {}
19
19
  resource_constants = OpenTelemetry::SDK::Resources::Constants
20
20
 
21
21
  if gcp_env.compute_engine?
22
- resource_labels[resource_constants::CLOUD_RESOURCE[:provider]] = 'gcp'
23
- resource_labels[resource_constants::CLOUD_RESOURCE[:account_id]] = gcp_env.project_id
24
- resource_labels[resource_constants::CLOUD_RESOURCE[:region]] = gcp_env.instance_attribute('cluster-location')
25
- resource_labels[resource_constants::CLOUD_RESOURCE[:zone]] = gcp_env.instance_zone
26
-
27
- resource_labels[resource_constants::HOST_RESOURCE[:hostname]] = hostname
28
- resource_labels[resource_constants::HOST_RESOURCE[:id]] = gcp_env.lookup_metadata('instance', 'id')
29
- resource_labels[resource_constants::HOST_RESOURCE[:name]] = gcp_env.lookup_metadata('instance', 'hostname')
22
+ resource_attributes[resource_constants::CLOUD_RESOURCE[:provider]] = 'gcp'
23
+ resource_attributes[resource_constants::CLOUD_RESOURCE[:account_id]] = gcp_env.project_id
24
+ resource_attributes[resource_constants::CLOUD_RESOURCE[:region]] = gcp_env.instance_attribute('cluster-location')
25
+ resource_attributes[resource_constants::CLOUD_RESOURCE[:zone]] = gcp_env.instance_zone
26
+
27
+ resource_attributes[resource_constants::HOST_RESOURCE[:id]] = gcp_env.lookup_metadata('instance', 'id')
28
+ resource_attributes[resource_constants::HOST_RESOURCE[:name]] = ENV['HOSTNAME'] ||
29
+ gcp_env.lookup_metadata('instance', 'hostname') ||
30
+ safe_gethostname
30
31
  end
31
32
 
32
33
  if gcp_env.kubernetes_engine?
33
- resource_labels[resource_constants::K8S_RESOURCE[:cluster_name]] = gcp_env.instance_attribute('cluster-name')
34
- resource_labels[resource_constants::K8S_RESOURCE[:namespace_name]] = gcp_env.kubernetes_engine_namespace_id
35
- resource_labels[resource_constants::K8S_RESOURCE[:pod_name]] = hostname
34
+ resource_attributes[resource_constants::K8S_RESOURCE[:cluster_name]] = gcp_env.instance_attribute('cluster-name')
35
+ resource_attributes[resource_constants::K8S_RESOURCE[:namespace_name]] = gcp_env.kubernetes_engine_namespace_id
36
+ resource_attributes[resource_constants::K8S_RESOURCE[:pod_name]] = ENV['HOSTNAME'] || safe_gethostname
36
37
 
37
- resource_labels[resource_constants::CONTAINER_RESOURCE[:name]] = ENV['CONTAINER_NAME']
38
+ resource_attributes[resource_constants::CONTAINER_RESOURCE[:name]] = ENV['CONTAINER_NAME']
38
39
  end
39
40
 
40
- resource_labels.delete_if { |_key, value| value.nil? || value.empty? }
41
- OpenTelemetry::SDK::Resources::Resource.create(resource_labels)
41
+ resource_attributes.delete_if { |_key, value| value.nil? || value.empty? }
42
+ OpenTelemetry::SDK::Resources::Resource.create(resource_attributes)
42
43
  end
43
44
 
44
45
  private
45
46
 
46
- def hostname
47
- ENV['HOSTNAME'] || Socket.gethostname
47
+ def safe_gethostname
48
+ Socket.gethostname
48
49
  rescue StandardError
49
50
  ''
50
51
  end
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Resource
9
9
  module Detectors
10
- VERSION = '0.5.1'
10
+ VERSION = '0.10.0'
11
11
  end
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-resource_detectors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-20 00:00:00.000000000 Z
11
+ date: 2020-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-env
@@ -129,6 +129,8 @@ executables: []
129
129
  extensions: []
130
130
  extra_rdoc_files: []
131
131
  files:
132
+ - ".yardopts"
133
+ - CHANGELOG.md
132
134
  - LICENSE
133
135
  - README.md
134
136
  - lib/opentelemetry-resource_detectors.rb
@@ -139,7 +141,11 @@ files:
139
141
  homepage: https://github.com/open-telemetry/opentelemetry-ruby
140
142
  licenses:
141
143
  - Apache-2.0
142
- metadata: {}
144
+ metadata:
145
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-resource_detectors/v0.10.0/file.CHANGELOG.html
146
+ source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/master/resource_detectors
147
+ bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
148
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-resource_detectors/v0.10.0
143
149
  post_install_message:
144
150
  rdoc_options: []
145
151
  require_paths:
@@ -155,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
161
  - !ruby/object:Gem::Version
156
162
  version: '0'
157
163
  requirements: []
158
- rubygems_version: 3.0.3
164
+ rubygems_version: 3.1.4
159
165
  signing_key:
160
166
  specification_version: 4
161
167
  summary: Resource detection helpers for OpenTelemetry