public class ObservabilityUtils extends Object
| Constructor and Description |
|---|
ObservabilityUtils() |
public static boolean isObservabilityEnabled()
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 Optional<ObserverContext> startServerObservation(String connectorName, String serviceName, String resourceName, WorkerExecutionContext parentContext)
connectorName - The server connector name.serviceName - The service name.resourceName - The resource name.parentContext - The WorkerExecutionContext instance. If this is null when starting the
observation, the
continueServerObservation(ObserverContext, WorkerExecutionContext)
method must be called later with relevant ObserverContextOptional ObserverContext instance.public static Optional<ObserverContext> startClientObservation(String connectorName, String actionName, WorkerExecutionContext parentCtx)
connectorName - The connector name.actionName - The action name.parentCtx - The WorkerExecutionContext instance. If this is null when starting the
observation, the
continueClientObservation(ObserverContext, WorkerExecutionContext)
method must be called later with relevant ObserverContextOptional of ObserverContext instance.public static void continueServerObservation(ObserverContext observerContext, WorkerExecutionContext parentCtx)
startServerObservation(String, String, String, WorkerExecutionContext) was called
without WorkerExecutionContext.observerContext - The ObserverContext instance.parentCtx - The parent WorkerExecutionContext instance.public static void continueClientObservation(ObserverContext observerContext, WorkerExecutionContext parentCtx)
startClientObservation(String, String, WorkerExecutionContext) was
called without WorkerExecutionContext.observerContext - The ObserverContext instance.parentCtx - The WorkerExecutionContext instance.public static void stopObservation(ObserverContext observerContext)
observerContext - The ObserverContext instance.public static Optional<ObserverContext> getParentContext(Context context)
context - The Context instance.ObserverContext or a new ObserverContext depending on whether observability
is enabled or not.public static Map<String,String> getContextProperties(ObserverContext observerContext)
public static void setObserverContextToWorkerExecutionContext(WorkerExecutionContext workerExecutionContext, ObserverContext observerContext)
Copyright © 2018 WSO2. All rights reserved.