Class ResourceHolder

java.lang.Object
io.opentelemetry.contrib.awsxray.ResourceHolder
All Implemented Interfaces:
io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider, io.opentelemetry.sdk.autoconfigure.spi.Ordered

@AutoService(io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider.class) public final class ResourceHolder extends Object implements io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider
Currently the only way to read the Resource from autoconfiguration. Best would be if the SPI could return a Function<SamplerFactoryArgs, Sampler> where SamplerFactoryArgs has SDK-constructed components like Resource and Clock.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    customize(io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizer autoConfiguration)
     
    static io.opentelemetry.sdk.resources.Resource
    Returns held resource, unless resource is null, in which case Resource.getDefault() is returned.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.opentelemetry.sdk.autoconfigure.spi.Ordered

    order
  • Constructor Details

    • ResourceHolder

      public ResourceHolder()
  • Method Details

    • customize

      public void customize(io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizer autoConfiguration)
      Specified by:
      customize in interface io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider
    • getResource

      public static io.opentelemetry.sdk.resources.Resource getResource()
      Returns held resource, unless resource is null, in which case Resource.getDefault() is returned. This should not happen in practice, as customize(io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizer) should be automatically run, populating resource.