Okahu

How to enable Okahu monitoring for your genAI application

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.

Supported app configurations

Programming language

GenAI Application frameworks

Application hosting platforms

Getting Started

Create Okahu tenant

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

Obtain Okahu API key

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.

How to enable Okahu tracing in your AI application

To enable your application sending traces to Okahu cloud, you need two basic steps

App running on Laptop/local dev environment

Direclty install Okahu python SDK

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

Add Okahu python SDK to dependency list

Provide Okahu API Key

Enable Okahu tracing in your python application code

Test the changes

Test and validate that application traces going to your Okahu tenant.

App running on Cloud VM or Github code spaces

Direclty install Okahu python SDK

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

Add Okahu python SDK to dependency list

Provide Okahu API Key

Enable Okahu tracing in your python application code

Test the changes

Test and validate that application traces going to your Okahu tenant.

App hosted in Azure Function

This section provides details of enabling Okahu tracing when the application code is hosted in Azure Functions.

Add Okahu python SDK to runtime environment

Provide Okahu API Key

Enable Okahu tracing in your python application code

Network considerations

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 -

Redeploy code

Test the changes

Test and validate that application traces going to your Okahu tenant.

App hosted in Azure ML

Add Okahu python SDK to runtime environment

Network considerations

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 -

Redeploy code

Test the changes

Test and validate that application traces going to your Okahu tenant.

App hosted in AWS Lambda Function using SAM deployment

Add Okahu python SDK to runtime environment

Enable Okahu tracing in your python application code

Provide Okahu API Key

Resource:
    ...
    Properties:
        ...
        Environment:
            Variables:
                OKAHU_API_KEY: <okahu-api-key>

Network considerations

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 -

Redeploy code

Test the changes

Test and validate that application traces going to your Okahu tenant.

App hosted in AWS Lambda Function using layer deployment

Add Okahu python SDK to runtime environment

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.

Provide Okahu API Key

Enable Okahu tracing in your python application code

Network considerations

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 -

Redeploy code

Test the changes

Test and validate that application traces going to your Okahu tenant.

How to enable Okahu tracing in Python Apps

Instrument app code

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.

Example - Add Okahu tracing in your application

from okahu_apptrace.instrumentor import setup_okahu_telemetry

# Call the setup Okahu telemetry method
setup_okahu_telemetry(workflow_name = "my_chatbot_workflow")
...

Wrap app code

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.

Example - Wrap Okahu tracing over your application

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()

Test and verify Okahu tracing

Test the new deployment

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.

Verify that application is sending traces to Okahu cloud

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.

Troubleshooting

Error in installing the Okahu SDK library

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

The verification steps didn’t show the configured workflow name

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.

Know issues

Issues in sending traces from AWS Lambda functions

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)