Class: ElasticAPM::Metadata::CloudInfo Private
- Inherits:
-
Object
- Object
- ElasticAPM::Metadata::CloudInfo
- Includes:
- Logging
- Defined in:
- lib/elastic_apm/metadata/cloud_info.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- AWS_URI =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"http://169.254.169.254/latest/dynamic/instance-identity/document"
- GCP_URI =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"http://metadata.google.internal/computeMetadata/v1/?recursive=true"
- AZURE_URI =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"http://169.254.169.254/metadata/instance/compute?api-version=2019-08-15"
Constants included from Logging
Logging::LEVELS, Logging::PREFIX
Instance Attribute Summary collapse
- #account_id ⇒ Object private
- #account_name ⇒ Object private
- #availability_zone ⇒ Object private
- #config ⇒ Object readonly private
- #instance_id ⇒ Object private
- #instance_name ⇒ Object private
- #machine_type ⇒ Object private
- #project_id ⇒ Object private
- #project_name ⇒ Object private
- #provider ⇒ Object private
- #region ⇒ Object private
Instance Method Summary collapse
-
#fetch! ⇒ Object
private
rubocop:disable Metrics/CyclomaticComplexity.
-
#initialize(config) ⇒ CloudInfo
constructor
private
A new instance of CloudInfo.
Methods included from Logging
#debug, #error, #fatal, #info, #warn
Constructor Details
#initialize(config) ⇒ CloudInfo
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of CloudInfo.
32 33 34 35 |
# File 'lib/elastic_apm/metadata/cloud_info.rb', line 32 def initialize(config) @config = config @client = HTTP.timeout(connect: 0.1, read: 0.1) end |
Instance Attribute Details
#account_id ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/elastic_apm/metadata/cloud_info.rb', line 39 def account_id @account_id end |
#account_name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/elastic_apm/metadata/cloud_info.rb', line 39 def account_name @account_name end |
#availability_zone ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/elastic_apm/metadata/cloud_info.rb', line 39 def availability_zone @availability_zone end |
#config ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 |
# File 'lib/elastic_apm/metadata/cloud_info.rb', line 37 def config @config end |
#instance_id ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/elastic_apm/metadata/cloud_info.rb', line 39 def instance_id @instance_id end |
#instance_name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/elastic_apm/metadata/cloud_info.rb', line 39 def instance_name @instance_name end |
#machine_type ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/elastic_apm/metadata/cloud_info.rb', line 39 def machine_type @machine_type end |
#project_id ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/elastic_apm/metadata/cloud_info.rb', line 39 def project_id @project_id end |
#project_name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/elastic_apm/metadata/cloud_info.rb', line 39 def project_name @project_name end |
#provider ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/elastic_apm/metadata/cloud_info.rb', line 39 def provider @provider end |
#region ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/elastic_apm/metadata/cloud_info.rb', line 39 def region @region end |
Instance Method Details
#fetch! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
rubocop:disable Metrics/CyclomaticComplexity
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/elastic_apm/metadata/cloud_info.rb', line 53 def fetch! case config.cloud_provider when "aws" fetch_aws when "gcp" fetch_gcp when "azure" fetch_azure || read_azure_app_services when "auto" fetch_aws || fetch_gcp || fetch_azure || read_azure_app_services when "none" nil else error("Unknown setting for cloud_provider '#{config.cloud_provider}'") end self end |