opentelemetry-resource_detectors 0.18.1 → 0.20.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ed054945636f4234b1064072cda6f9de6d109df3a8a77e82a39041761a65be0
|
4
|
+
data.tar.gz: cf7b92dd1015c30491d7f6b24eb6d88bb3baaaf4bd5f68728270923b85804d64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5e4213170d6449c7c7f05a3cee9bdcdbabdeb50ab48dbe14806a47bf2b9fc3e05546714f992303c0f2cba3c2a71140e89137fb0fde40eb272c60dec1ba65322
|
7
|
+
data.tar.gz: dd7e9133f474b0a3f41d52e5553a8c8731c8b7e64abdb12be3a9716e0d9b4d95c308b24bdfa26ab8f352bf8e7c54f8874be5efc7e3951c42521786af48dee804
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# Release History: opentelemetry-resource_detectors
|
2
2
|
|
3
|
+
### v0.20.0 / 2022-05-02
|
4
|
+
|
5
|
+
* ADDED: Added Google Cloud Function Resource Detection
|
6
|
+
|
7
|
+
### v0.19.1 / 2021-09-29
|
8
|
+
|
9
|
+
* (No significant changes)
|
10
|
+
|
11
|
+
### v0.19.0 / 2021-08-12
|
12
|
+
|
13
|
+
* BREAKING CHANGE: Use auto-generated resource constants in sdk and resource_detectors
|
14
|
+
|
15
|
+
* ADDED: Use auto-generated resource constants in sdk and resource_detectors
|
16
|
+
|
3
17
|
### v0.18.1 / 2021-06-23
|
4
18
|
|
5
19
|
* (No significant changes)
|
@@ -13,30 +13,39 @@ module OpenTelemetry
|
|
13
13
|
module GoogleCloudPlatform
|
14
14
|
extend self
|
15
15
|
|
16
|
-
def detect # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
16
|
+
def detect # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
17
17
|
gcp_env = Google::Cloud::Env.new
|
18
18
|
resource_attributes = {}
|
19
|
-
resource_constants = OpenTelemetry::SDK::Resources::Constants
|
20
19
|
|
21
20
|
if gcp_env.compute_engine?
|
22
|
-
resource_attributes[
|
23
|
-
resource_attributes[
|
24
|
-
resource_attributes[
|
25
|
-
resource_attributes[
|
26
|
-
|
27
|
-
resource_attributes[
|
28
|
-
resource_attributes[
|
29
|
-
|
30
|
-
|
21
|
+
resource_attributes[OpenTelemetry::SemanticConventions::Resource::CLOUD_PROVIDER] = 'gcp'
|
22
|
+
resource_attributes[OpenTelemetry::SemanticConventions::Resource::CLOUD_ACCOUNT_ID] = gcp_env.project_id
|
23
|
+
resource_attributes[OpenTelemetry::SemanticConventions::Resource::CLOUD_REGION] = gcp_env.instance_attribute('cluster-location')
|
24
|
+
resource_attributes[OpenTelemetry::SemanticConventions::Resource::CLOUD_AVAILABILITY_ZONE] = gcp_env.instance_zone
|
25
|
+
|
26
|
+
resource_attributes[OpenTelemetry::SemanticConventions::Resource::HOST_ID] = gcp_env.lookup_metadata('instance', 'id')
|
27
|
+
resource_attributes[OpenTelemetry::SemanticConventions::Resource::HOST_NAME] = ENV['HOSTNAME'] ||
|
28
|
+
gcp_env.lookup_metadata('instance', 'hostname') ||
|
29
|
+
safe_gethostname
|
31
30
|
end
|
32
31
|
|
33
32
|
if gcp_env.kubernetes_engine?
|
34
|
-
resource_attributes[
|
35
|
-
resource_attributes[
|
36
|
-
resource_attributes[
|
37
|
-
resource_attributes[
|
33
|
+
resource_attributes[OpenTelemetry::SemanticConventions::Resource::K8S_CLUSTER_NAME] = gcp_env.instance_attribute('cluster-name')
|
34
|
+
resource_attributes[OpenTelemetry::SemanticConventions::Resource::K8S_NAMESPACE_NAME] = gcp_env.kubernetes_engine_namespace_id
|
35
|
+
resource_attributes[OpenTelemetry::SemanticConventions::Resource::K8S_POD_NAME] = ENV['HOSTNAME'] || safe_gethostname
|
36
|
+
resource_attributes[OpenTelemetry::SemanticConventions::Resource::K8S_NODE_NAME] = gcp_env.lookup_metadata('instance', 'hostname')
|
37
|
+
|
38
|
+
resource_attributes[OpenTelemetry::SemanticConventions::Resource::CONTAINER_NAME] = ENV['CONTAINER_NAME']
|
39
|
+
end
|
38
40
|
|
39
|
-
|
41
|
+
if gcp_env.knative?
|
42
|
+
resource_attributes[OpenTelemetry::SemanticConventions::Resource::CLOUD_PROVIDER] = 'gcp'
|
43
|
+
resource_attributes[OpenTelemetry::SemanticConventions::Resource::CLOUD_ACCOUNT_ID] = gcp_env.project_id
|
44
|
+
resource_attributes[OpenTelemetry::SemanticConventions::Resource::FAAS_NAME] = gcp_env.knative_service_id
|
45
|
+
resource_attributes[OpenTelemetry::SemanticConventions::Resource::FAAS_VERSION] = gcp_env.knative_service_revision
|
46
|
+
zone = gcp_env.instance_zone
|
47
|
+
resource_attributes[OpenTelemetry::SemanticConventions::Resource::CLOUD_REGION] = get_region zone
|
48
|
+
resource_attributes[OpenTelemetry::SemanticConventions::Resource::CLOUD_AVAILABILITY_ZONE] = zone
|
40
49
|
end
|
41
50
|
|
42
51
|
resource_attributes.delete_if { |_key, value| value.nil? || value.empty? }
|
@@ -45,6 +54,13 @@ module OpenTelemetry
|
|
45
54
|
|
46
55
|
private
|
47
56
|
|
57
|
+
def get_region(zone)
|
58
|
+
return if zone.nil? || zone.empty?
|
59
|
+
|
60
|
+
split_arr = zone.split('-', 3)
|
61
|
+
split_arr[0].concat('-', split_arr[1])
|
62
|
+
end
|
63
|
+
|
48
64
|
def safe_gethostname
|
49
65
|
Socket.gethostname
|
50
66
|
rescue StandardError
|
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.
|
4
|
+
version: 0.20.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:
|
11
|
+
date: 2022-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-env
|
@@ -156,10 +156,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
156
156
|
licenses:
|
157
157
|
- Apache-2.0
|
158
158
|
metadata:
|
159
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-resource_detectors/v0.
|
159
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-resource_detectors/v0.20.0/file.CHANGELOG.html
|
160
160
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/resource_detectors
|
161
161
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
162
|
-
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-resource_detectors/v0.
|
162
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-resource_detectors/v0.20.0
|
163
163
|
post_install_message:
|
164
164
|
rdoc_options: []
|
165
165
|
require_paths:
|