Class EC2Plugin

java.lang.Object
com.amazonaws.xray.plugins.EC2Plugin
All Implemented Interfaces:
Plugin

public class EC2Plugin extends Object implements Plugin
A plugin, for use with the AWSXRayRecorderBuilder class, which will add EC2 instance information to segments generated by the built AWSXRayRecorder instance.
See Also:
  • Field Details

  • Constructor Details

    • EC2Plugin

      public EC2Plugin()
    • EC2Plugin

      public EC2Plugin(FileSystem fs, com.amazonaws.xray.plugins.EC2MetadataFetcher metadataFetcher)
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Specified by:
      isEnabled in interface Plugin
      Returns:
      true if an environment inspection determines X-Ray is operating in the correct environment for this plugin OR if X-Ray cannot accurately determine if it's in this plugin's environment
    • getServiceName

      public String getServiceName()
      Specified by:
      getServiceName in interface Plugin
    • populateRuntimeContext

      public void populateRuntimeContext()
      Reads EC2 provided metadata to include it in trace document
    • getRuntimeContext

      public Map<String,@Nullable Object> getRuntimeContext()
      Specified by:
      getRuntimeContext in interface Plugin
    • populateLogReferences

      public void populateLogReferences()
      Reads the log group configuration file generated by the CloudWatch Agent to discover all log groups being used on this instance and populates log reference set with them to be included in trace documents.
    • getLogReferences

      public Set<AWSLogReference> getLogReferences()
      Specified by:
      getLogReferences in interface Plugin
      Returns:
      Set of AWS log references used by CloudWatch agent. The ARN of these log references is not available at this time.
    • getOrigin

      public String getOrigin()
      Description copied from interface: Plugin
      Returns the name of the origin associated with this plugin. The AWSXRayRecorder contains a prioritized list of origins from least to most specific.
      Specified by:
      getOrigin in interface Plugin
      Returns:
      the name of the origin associated with this plugin.
    • equals

      public boolean equals(@Nullable Object o)
      Determine equality of plugins using origin to uniquely identify them
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Hash plugin object using origin to uniquely identify them
      Overrides:
      hashCode in class Object