Package com.azure.core.util
Class TracingOptions
java.lang.Object
com.azure.core.util.TracingOptions
Metrics configuration options for clients.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionCreates new instance ofTracingOptionsprotectedTracingOptions(Class<? extends TracerProvider> tracerProvider) Creates new instance ofTracingOptions -
Method Summary
Modifier and TypeMethodDescriptionstatic TracingOptionsfromConfiguration(Configuration configuration) Loads metrics options from the configuration.Class<? extends TracerProvider>Gets name of theTracerProviderimplementation that should be used to construct an instance ofTracer.booleanFlag indicating if metrics should be enabled.setEnabled(boolean enabled) Enables or disables metrics.
-
Constructor Details
-
TracingOptions
public TracingOptions()Creates new instance ofTracingOptions -
TracingOptions
Creates new instance ofTracingOptions- Parameters:
tracerProvider- The type of theTracerProviderimplementation that should be used to construct an instance ofTracer. If the value isn't set or is an empty string the firstTracerProviderresolved byServiceLoaderwill be used to create an instance ofTracer. If the value is set and doesn't match anyTracerProviderresolved byServiceLoaderanIllegalStateExceptionwill be thrown when attempting to create an instance ofTracer.
-
-
Method Details
-
fromConfiguration
Loads metrics options from the configuration.- Parameters:
configuration- TheConfigurationthat is used to load proxy configurations from the environment. Ifnullis passed thenConfiguration.getGlobalConfiguration()will be used.- Returns:
- A
TracingOptionsreflecting a tracing options loaded from the configuration, if no tracing options are found, default (enabled) tracing options will be returned.
-
isEnabled
public boolean isEnabled()Flag indicating if metrics should be enabled.- Returns:
trueif metrics are enabled,falseotherwise.
-
setEnabled
Enables or disables metrics. By default, metrics are enabled if and only if metrics implementation is detected.- Parameters:
enabled- passtrueto enable metrics.- Returns:
- the updated
TracingOptionsobject.
-
getTracerProvider
Gets name of theTracerProviderimplementation that should be used to construct an instance ofTracer.- Returns:
- The
TracerProviderimplementation used to create an instance ofTracer.
-