Skip to content

Conversation

@vladpaiu
Copy link
Member

@vladpaiu vladpaiu commented Jan 10, 2026

Summary
Add Opentelemetry module tracing the OpenSIPS routes execution and the logs they produce

Details
Opentelemetry is providing a standardized, vendor-neutral framework (APIs, SDKs, tools) to collect, process, and export telemetry data (traces, metrics, logs) from distributed systems, enabling deep insights into application performance, faster debugging, and preventing vendor lock-in by routing data to multiple observability backends.

Solution
Each new message processing produce a new root span ( with the full SIP message attached to it ), and then a new child span is added for each route execution the SIP message goes through. A new log_level parameter is introduced to the opentelemetry module, and logs will be attached to the respective child span.

The module also supports async & resume route script jumping ( maintaining the parent span and the total execution duration ) so you can get a clear view of the full script execution even when using async().

Compatibility
New module, no backwards compatibility issues

Future Notes
We can later integrate the metrics part by exporting a list of statistics as well to the otel spans ( similar to prometheus ), as well as attaching a list of AVPs to the spans, to get a better idea of the 'route code path' that the SIP messages are taking

Examples

Testing with

route {
...
        if (is_method("REGISTER")) {
                # store the registration and generate a SIP reply
                route(handle_register);
                exit;
        }
 ....
 }
 
 route[handle_register] {
        xlog("Received $rm now for $ci , sleeping now \n");
        async(sleep(1),"RESUME_SLEEP");
}

route[RESUME_SLEEP] {
        xlog("Resumed from sleep, calling save $ci \n");
        route(SAVE_REGISTER);

}

route[SAVE_REGISTER] {
        xlog("Saving $rm now for $ci \n");
        if (!save("location"))
                xlog("failed to register AoR $tu\n");
        exit;
}

an opentelemetry reader produces the following spans showing the 1s execution duration through the full script execution path ( with script lines numbers attached as tags )

Screenshot_2026-01-10_09-25-20

with the logs attached to the respective route child spans

Screenshot_2026-01-10_09-25-47

@vladpaiu vladpaiu added this to the 4.0.0 milestone Jan 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant