OpenTelemetry usage with OpenFGA's Python SDK

June 28, 2024 ยท View on GitHub

This example demonstrates how you can use OpenTelemetry with OpenFGA's Python SDK.

Prerequisites

If you do not already have an OpenFGA instance running, you can start one using the following command:

docker run -d -p 8080:8080 openfga/openfga

You need to have an OpenTelemetry collector running to receive data. A pre-configured collector is available using Docker:

git clone https://github.com/ewanharris/opentelemetry-collector-dev-setup.git
cd opentelemetry-collector-dev-setup
docker-compose up -d

Configure the example

You need to configure the example for your environment:

cp .env.example .env

Now edit the .env file and set the values as appropriate.

Running the example

Begin by installing the required dependencies:

pip install -r requirements.txt

Next, run the example:

python main.py