Module amp
ballerinax/amp Ballerina library
1.1.0
Package Overview
The Amp Observability Extension is one of the tracing extensions of the Ballerina language.
It provides an implementation for tracing and publishing traces to a WSO2 AI Agent Platform using OpenTelemetry Protobuf HTTP endpoint.
Enabling Amp Extension
To enable the AMP extension in a Ballerina program, follow the below steps.
-
Create a program with an AI agent eg: https://ballerina.io/learn/by-example/chat-agents/
-
Add the following import to your program.
import ballerinax/amp as _;
- Add the following to the
Ballerina.tomlwhen building your program.
[package] org = "my_org" name = "my_package" version = "1.0.0" [build-options] observabilityIncluded=true
- Add the following to the
Config.tomlwhen running your program.
[ballerina.observe] tracingEnabled=true tracingProvider="amp" [ballerinax.amp] # OpenTelemetry endpoint for Amp otelEndpoint="http://localhost:22893/otel" # Optional. Default: http://localhost:22893/otel # Amp authentication and identification (optional) # If passed empty string (default value) these will not be added. apiKey="" # API key for authentication send via Authorization header orgUid="" # Organization UID send as a resource attribute projectUid="" # Project UID send as a resource attribute componentUid="" # Component UID send as a resource attribute environmentUid="" # Environment UID send as a resource attribute
- Use
Try Itfeature in Ballerina plugin or AI Chat view inBIplugin to send a message to the agent. This will result in a trace being published to the WSO2 AI Agent Platform.