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 ofTracingOptions
protected
TracingOptions
(Class<? extends TracerProvider> tracerProvider) Creates new instance ofTracingOptions
-
Method Summary
Modifier and TypeMethodDescriptionstatic TracingOptions
fromConfiguration
(Configuration configuration) Loads metrics options from the configuration.Class<? extends TracerProvider>
Gets name of theTracerProvider
implementation that should be used to construct an instance ofTracer
.boolean
Flag 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 theTracerProvider
implementation that should be used to construct an instance ofTracer
. If the value isn't set or is an empty string the firstTracerProvider
resolved byServiceLoader
will be used to create an instance ofTracer
. If the value is set and doesn't match anyTracerProvider
resolved byServiceLoader
anIllegalStateException
will be thrown when attempting to create an instance ofTracer
.
-
-
Method Details
-
fromConfiguration
Loads metrics options from the configuration.- Parameters:
configuration
- TheConfiguration
that is used to load proxy configurations from the environment. Ifnull
is passed thenConfiguration.getGlobalConfiguration()
will be used.- Returns:
- A
TracingOptions
reflecting 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:
true
if metrics are enabled,false
otherwise.
-
setEnabled
Enables or disables metrics. By default, metrics are enabled if and only if metrics implementation is detected.- Parameters:
enabled
- passtrue
to enable metrics.- Returns:
- the updated
TracingOptions
object.
-
getTracerProvider
Gets name of theTracerProvider
implementation that should be used to construct an instance ofTracer
.- Returns:
- The
TracerProvider
implementation used to create an instance ofTracer
.
-