lib/fluent/plugin/common.rb
# Determine agent level monitored resource type.
Determine agent level monitored resource type.
Determine agent level monitored resource type .
def determine_agent_level_monitored_resource_type(
          platform, subservice_name, detect_subservice)
      case platform
      when Platform::OTHER
        return COMPUTE_CONSTANTS[:resource_type]
      when Platform::EC2
        return EC2_CONSTANTS[:resource_type]
      when Platform::GCE
        return SUBSERVICE_MAP[subservice_name] if subservice_name
        if detect_subservice
          begin
            attributes = fetch_gce_metadata(platform,
                                            'instance/attributes/').split.to_set
            SUBSERVICE_METADATA_ATTRIBUTES.each do |resource_type, expected|
              return resource_type if attributes.superset?(expected)
            end
          rescue StandardError => e
            @log.error 'Failed to detect subservice: ', error: e
          end
        end
        return COMPUTE_CONSTANTS[:resource_type]
      end
    end
def determine_agent_level_monitored_resource_type ( platform , subservice_name , detect_subservice ) case platform when Platform :: OTHER return COMPUTE_CONSTANTS [ :resource_type ] when Platform :: EC2 return EC2_CONSTANTS [ :resource_type ] when Platform :: GCE return SUBSERVICE_MAP [ subservice_name ] if subservice_name if detect_subservice begin attributes = fetch_gce_metadata ( platform , 'instance/attributes/' ) . split . to_set SUBSERVICE_METADATA_ATTRIBUTES . each do | resource_type , expected | return resource_type if attributes . superset? ( expected ) end rescue StandardError => e @log . error 'Failed to detect subservice: ' , error : e end end return COMPUTE_CONSTANTS [ :resource_type ] end end
Determine agent level monitored resource type.
Determine agent level monitored resource type .
# Unknown platform will be defaulted to GCE instance. # Resource types determined by subservice_name config. # Resource types determined by detect_subservice config. # GCE instance.
platform
<not_specific>
subservice_name
<not_specific>
detect_subservice
<not_specific>