How to make a Ballerina function observable?

43 views Asked by At

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?

1

There are 1 answers

0
Gabil On BEST ANSWER

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
}