Class Resource


  • public class Resource
    extends Object
    Resource represents a resource, which capture identifying information about the entities for which signals (stats or traces) are reported.
    • Field Detail

      • DEFAULT

        public static final Resource DEFAULT
    • Method Detail

      • create

        public static Resource create​(Map<String,​Object> attributes,
                                      String schemaUrl)
        Returns a Resource.
        Parameters:
        attributes - a map of attributes that describe the resource.
        schemaUrl - The URL of the OpenTelemetry schema used to create this Resource.
        Returns:
        a Resource.
        Throws:
        NullPointerException - if attributes is null.
      • getSchemaUrl

        public String getSchemaUrl()
        Returns the URL of the OpenTelemetry schema used by this resource. May be null.
        Returns:
        An OpenTelemetry schema URL.
        Since:
        1.4.0
      • getAttributes

        public Map<String,​Object> getAttributes()
        Returns a map of attributes that describe the resource.
        Returns:
        a map of attributes.
      • merge

        public Resource merge​(Resource other)
        Returns a new, merged Resource by merging the current Resource with the other Resource. In case of a collision, the "other" Resource takes precedence.
        Parameters:
        other - the Resource that will be merged with this.
        Returns:
        the newly merged Resource.