lib/elastic_apm/metadata/cloud_info.rb in elastic-apm-3.12.1 vs lib/elastic_apm/metadata/cloud_info.rb in elastic-apm-3.13.0

- old
+ new

@@ -29,11 +29,11 @@ GCP_URI = "http://metadata.google.internal/computeMetadata/v1/?recursive=true" AZURE_URI = "http://169.254.169.254/metadata/instance/compute?api-version=2019-08-15" def initialize(config) @config = config - @client = HTTP.timeout(0.1) + @client = HTTP.timeout(connect: 0.1, read: 0.1) end attr_reader :config attr_accessor( @@ -47,10 +47,11 @@ :availability_zone, :provider, :region ) + # rubocop:disable Metrics/CyclomaticComplexity def fetch! case config.cloud_provider when "aws" fetch_aws when "gcp" @@ -65,9 +66,10 @@ error("Unknown setting for cloud_provider '#{config.cloud_provider}'") end self end + # rubocop:enable Metrics/CyclomaticComplexity private def fetch_aws resp = @client.get(AWS_URI)