In Ballerina, the main, resource, and remote functions come inherently equipped with observability to enable metrics and tracing monitoring. However, I wish to extend this observability to some of the other functions within my Ballerina application. Does Ballerina provide a way to make functions selectively observable?
Yes, You can make any Ballerina function observable by adding the @observe:Observable
annotation to the required functions as follows.
import ballerina/observe;
@observe:Observable
function yourFunctionName() {
// Your function logic here
}