public class ObservabilityUtils extends Object
| Constructor and Description |
|---|
ObservabilityUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addObserver(BallerinaObserver observer)
Adds a
BallerinaObserver to a collection of observers that will be notified on
events. |
static void |
continueClientObservation(ObserverContext observerContext,
String connectorName,
String actionName,
WorkerExecutionContext executionContext)
Continue client observation if the
startClientObservation(String, String, WorkerExecutionContext) was
called without WorkerExecutionContext. |
static void |
continueServerObservation(ObserverContext observerContext,
String serviceName,
String resourceName,
WorkerExecutionContext executionContext)
Continue server observation if the
startServerObservation(String, String, String, WorkerExecutionContext) was called without
WorkerExecutionContext. |
static ObserverContext |
getCurrentContext(WorkerExecutionContext executionContext)
Get an
ObserverContext for current WorkerExecutionContext. |
static Map<String,String> |
getTraceContext()
Get the get the trace context of the parent span.
|
static void |
removeObserver(BallerinaObserver observer)
Removes a
BallerinaObserver from the collection of observers. |
static ObserverContext |
startClientObservation(String connectorName,
String actionName,
WorkerExecutionContext executionContext)
Start a client observation.
|
static ObserverContext |
startServerObservation(String connectorName,
String serviceName,
String resourceName,
WorkerExecutionContext executionContext)
Start a server observation.
|
static void |
stopObservation(WorkerExecutionContext executionContext)
Stop server or client observation.
|
public static void addObserver(BallerinaObserver observer)
BallerinaObserver to a collection of observers that will be notified on
events.observer - the observer that will be notifiedpublic static void removeObserver(BallerinaObserver observer)
BallerinaObserver from the collection of observers.observer - the observer that will be removedpublic static ObserverContext startServerObservation(String connectorName, String serviceName, String resourceName, WorkerExecutionContext executionContext)
connectorName - The server connector name.serviceName - The service name.resourceName - The resource name.executionContext - The WorkerExecutionContext instance. If this is null when starting the
observation, the continueServerObservation(ObserverContext, String, String,
WorkerExecutionContext) method must be called later with relevant
ObserverContextObserverContext instance.public static ObserverContext startClientObservation(String connectorName, String actionName, WorkerExecutionContext executionContext)
connectorName - The connector name.actionName - The action name.executionContext - The WorkerExecutionContext instance. If this is null when starting the
observation, the continueClientObservation(ObserverContext, String, String,
WorkerExecutionContext) method must be called later with relevant
ObserverContextObserverContext instance.public static void continueServerObservation(ObserverContext observerContext, String serviceName, String resourceName, WorkerExecutionContext executionContext)
startServerObservation(String, String, String, WorkerExecutionContext) was called without
WorkerExecutionContext.observerContext - The ObserverContext instance.serviceName - The service name.resourceName - The resource name.executionContext - The WorkerExecutionContext instance.public static void continueClientObservation(ObserverContext observerContext, String connectorName, String actionName, WorkerExecutionContext executionContext)
startClientObservation(String, String, WorkerExecutionContext) was
called without WorkerExecutionContext.observerContext - The ObserverContext instance.connectorName - The connector name.actionName - The resource name.executionContext - The WorkerExecutionContext instance.public static void stopObservation(WorkerExecutionContext executionContext)
executionContext - The WorkerExecutionContext instance.public static ObserverContext getCurrentContext(WorkerExecutionContext executionContext)
ObserverContext for current WorkerExecutionContext.executionContext - The WorkerExecutionContext instance.ObserverContext instance or a new one created for current
WorkerExecutionContext.Copyright © 2018 WSO2. All rights reserved.