This document describes the steps to enable Okahu tracing in your GenAI application. With that your application will send the traces to Okahu SAS endpoint where they can be viewed and used by Okahu to maintain the application details and generate insights.
The first step is to create your tenant in Okahu. You can do this directly at www.okahu.ai. Login with email or social accounts and follow instructions on Try Okahu
Once you have tenant created, login to okahu portal and navigate to Setup
. Then click on Generate API Key
. This will provide you the API key that you should save.
To enable your application sending traces to Okahu cloud, you need two basic steps
If in local development environment like laptop, you are installing Python libraries directly using pip
tool, then install Okahu SDK library from Okahu Pypi compatible repository -
> pip install --extra-index-url=https://okahu.jfrog.io/artifactory/api/pypi/okahu-pypi/simple okahu-observability
requirements.txt
file, then add following lines at the top of your file
--extra-index-url https://okahu.jfrog.io/artifactory/api/pypi/okahu-pypi/simple
okahu-observability
pip install - requirements.txt
OKAHU_API_KEY
to the Okahu API key in your application runtimeTest and validate that application traces going to your Okahu tenant.
In local development environment like laptop, you can install Okahu SDK library releases from Okahu Pypi compatible repository
> pip install --extra-index-url=https://okahu.jfrog.io/artifactory/api/pypi/okahu-pypi/simple okahu-observability
requirements.txt
file, then add following lines at the top of your file
--extra-index-url https://okahu.jfrog.io/artifactory/api/pypi/okahu-pypi/simple
okahu-observability
pip install -r requirements.txt
OKAHU_API_KEY
to the Okahu API key in your application runtimeOKAHU_API_KEY
and value Okahu API key. For details steps about creating secrets, please refer to Github documentationTest and validate that application traces going to your Okahu tenant.
This section provides details of enabling Okahu tracing when the application code is hosted in Azure Functions.
requirements.txt
file in the source code used by your application --extra-index-url https://okahu.jfrog.io/artifactory/api/pypi/okahu-pypi/simple
okahu-observability
OKAHU_API_KEY
in the Azure Function Environment Variables setting on the Azure Portal.The AI application enabled with Okahu will send the traces to Okahu cloud. Also the Okahu python library is downloaded from Okahu’s Pypi compatible repository. If your Azure environment is behind a firewall or a virtual network, then it might have blocked the network rout to the aforementioned endpoints. For the Okahu application tracing to work, we need following -
Test and validate that application traces going to your Okahu tenant.
os.environ["OKAHU_API_KEY"]="<okahu-api-key>"
The AI application enabled with Okahu will send the traces to Okahu cloud. Also the Okahu python library is downloaded from Okahu’s Pypi compatible repository. If your Azure environment is behind a firewall or a virtual network, then it might have blocked the network rout to the aforementioned endpoints. For the Okahu application tracing to work, we need following -
Test and validate that application traces going to your Okahu tenant.
requirements.txt
file used by your applicationrequirements.txt
file
--extra-index-url https://okahu.jfrog.io/artifactory/api/pypi/okahu-pypi/simple
okahu-observability
Resource:
...
Properties:
...
Environment:
Variables:
OKAHU_API_KEY: <okahu-api-key>
The AI application enabled with Okahu will send the traces to Okahu cloud. If your AWS environment is behind a firewall or a VPC, then it might have blocked the network rout to the aforementioned endpoints. For the Okahu application tracing to work, we need following -
Test and validate that application traces going to your Okahu tenant.
When your application is deployed using the Lambda Layers, you need to create a add Okahu SDK library as a new layer to your Lambda function.
OKAHU_API_KEY
and set value to API key extracted per above instructionsThe AI application enabled with Okahu will send the traces to Okahu cloud. If your AWS environment is behind a firewall or a VPC, then it might have blocked the network rout to the aforementioned endpoints. For the Okahu application tracing to work, we need following -
Test and validate that application traces going to your Okahu tenant.
You simply add a couple of lines of code in your application to initiate the Okahu tracing. Just import the Okahu observability package and invoke the API setup_okahu_telemetry(workflow=<workflow-name>)
to enable the tracing. The workflow-name
is what you define to identify the give application workflow, for example customer-chatbot
. Okahu trace will include this name in every trace.
from okahu_apptrace.instrumentor import setup_okahu_telemetry
# Call the setup Okahu telemetry method
setup_okahu_telemetry(workflow_name = "my_chatbot_workflow")
...
Alternately, you can create a new wrapper python scrip that setups up Okahu tracing as described in previous section, and call your applications main method from this new script. In this approach, you don’t need to touch your application code.
from okahu_apptrace.instrumentor import setup_okahu_telemetry
import my_chatbot
def main():
# Call the setup Okahu telemetry method
setup_okahu_telemetry(workflow_name = "my_chatbot_workflow")
# Invoke main method of your app
my_chatbot.main()
if __name__ == "__main__":
main()
Run your application as you run normally. Make sure you at least go through 2-3 iterations. For example, if this is chatbot app then go through a few questions and answers.
To verify the tracing is working, we’ll make Okahu examine new traces and discover the new workflow. We’ll follow the steps to add a new application which will trigger this.
workflow-name
that’s set in your application as part of Okahu API should show up in the component list.Make sure that you have network path open to Okahu’s Pypi compatible repository. Verify the connectivity by running nslookup -port=443 okahu.jfrog.io
If the workflow-name
is not there in the list of components per the validation steps mentioned above, Okahu is not receiving traces from your application.
nslookup -port=443 ingest.okahu.io
. If there’s not network path, please contact your cloud/network/security admins to enable it.
Please send a email to cx@okahu.ai
For an app hosted in AWS Lambda function, in some cases the execution of Lambda function is terminated before Okahu SDK can complete sending the traces. We are working on fixing this in the upcomping version of Okahu SDK. To metigate the issue, add an extra delay at the end of your application
time.sleep(10)