Lytix supports sending log events without being on the critical path. We use Traceloop to power this feature.

Prerequisite Please see here to get and set your API Key environment variable.

Install the SDK

To get started first download the relevant SDK for your language of choice.

Initialize the Logger

Now you can initialize the logger with your API key.

Note: If you are in the EU you have to update the baseURL on the LytixAsyncLogger to https://eu.api.lytix.co/v2/metrics/async.

Start Collecting Logs ๐Ÿš€

Now you can call OpenAI as you normally would, and logs will automatically get sent to the Lytix platform.

Optional Metadata

You can also add metadata to your logs. This can be useful for tracking things like user idโ€™s, session idโ€™s, or other metadata.

To do this, you just need to first set the parameters on the logger:

Metadata Options

You can set the following metadata fields:

  • userId: The user id of the user making the request
  • sessionId: The session id of the user making the request
  • workflowName: The name of the workflow the request was made in
  • lytix-metadata-*: Any additional metadata you would like to track, e.g. lytix-metadata-env: dev will add the metadata key env with the value dev