Package com.azure.core.util.tracing
Class TracerProxy
- java.lang.Object
-
- com.azure.core.util.tracing.TracerProxy
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidend(int responseCode, Throwable error, Context context)For the plugged intracer, its current tracing span is marked as completed.static booleanisTracingEnabled()Returns true if tracing is enabled.static voidsetAttribute(String key, String value, Context context)For the plugged intracer, the key-value pair metadata is added to its current span.static ContextsetSpanName(String spanName, Context context)Sets the span name for eachtracerplugged into the SDK.static Contextstart(String methodName, Context context)A new tracing span with INTERNAL kind is created for eachtracerplugged into the SDK.static Contextstart(String methodName, StartSpanOptions spanOptions, Context context)A new tracing span is created for eachtracerplugged into the SDK.
-
-
-
Method Detail
-
start
public static Context start(String methodName, Context context)
A new tracing span with INTERNAL kind is created for eachtracerplugged into the SDK.The
contextwill be checked for information about a parent span. If a parent span is found, the new span will be added as a child. Otherwise, the parent span will be created and added to thecontextand any downstreamstart()calls will use the created span as the parent.- Parameters:
methodName- Name of the method triggering the span creation.context- Additional metadata that is passed through the call stack.- Returns:
- An updated
Contextobject.
-
start
public static Context start(String methodName, StartSpanOptions spanOptions, Context context)
A new tracing span is created for eachtracerplugged into the SDK.The
contextwill be checked for information about a parent span. If a parent span is found, the new span will be added as a child. Otherwise, the parent span will be created and added to thecontextand any downstreamstart()calls will use the created span as the parent.- Parameters:
methodName- Name of the method triggering the span creation.spanOptions- span creation options.context- Additional metadata that is passed through the call stack.- Returns:
- An updated
Contextobject.
-
setAttribute
public static void setAttribute(String key, String value, Context context)
For the plugged intracer, the key-value pair metadata is added to its current span. If thecontextdoes not contain a span, then no metadata is added.- Parameters:
key- Name of the metadata.value- Value of the metadata.context- Additional metadata that is passed through the call stack.
-
end
public static void end(int responseCode, Throwable error, Context context)For the plugged intracer, its current tracing span is marked as completed.- Parameters:
responseCode- Response status code if the span is in an HTTP call context.error-Throwablethat happened during the span ornullif no exception occurred.context- Additional metadata that is passed through the call stack.
-
setSpanName
public static Context setSpanName(String spanName, Context context)
Sets the span name for eachtracerplugged into the SDK.- Parameters:
spanName- Name of the span.context- Additional metadata that is passed through the call stack.- Returns:
- An updated
Contextobject.
-
isTracingEnabled
public static boolean isTracingEnabled()
Returns true if tracing is enabled.- Returns:
- true if tracing is enabled.
-
-