Skip to main content

Install SDK

Prerequisite You should have Python v3.10 or higher installed.
Install the sdk via your preferred package manager
uv add navigator-sdk

Setup logger

There are two ways you can initialize the logger
Set the following environment variables, all of them are required.
ENVIRONMENT         = Environment
NAVIGATOR_API_URL   = https://api.usenavigator.co
NAIGATOR_API_KEY    = pk_live_abc..xyz
NAVIGATOR_DOMAIN    = Domain name (i.e. Data Infrastructure)
NAVIGATOR_SERVICE   = Service name (i.e. Airflow)
NAVIGATOR_TRACE_ID  = Default trace ID for correlating logs
And then initialize the logger with:
from navigator_sdk import setup_logger

logger = setup_logger()
You can also pass the configuration values at runtime
python
from navigator_sdk import setup_logger

logger = setup_logger(
    environment='production',
    api_url='https://api.usenavigator.co',
    api_key='pk_live_abc..xyz',
    domain='domain',
    service='service',
    trace_id='trace_id'
)
You could also define both. However, note that values defined at runtime will take precedence over env variables. For example, if you need dynamic trace_id for each n number of scripts, you can set a default value in .env file and override by setting the same at runtime.

Send logs

Your logger is now ready to send logs.
python
logger.info("Hello world")
Go to app.usenavigator.co to start using Navigator.

Optional Configuration

By default, the logging via sdk is synchronous and best-effort with retries. You can configure retries and delays but is optional.
Add these in addition to the required env variables
NAVIGATOR_MAX_RETRIES       = Number of retries after initial attempt (default: 3)
Add these in addition to the required env variables
NAVIGATOR_RETRY_BASE_DELAY  = Base retry delay in seconds (default: 1.0)
NAVIGATOR_RETRY_MAX_DELAY   = Max retry delay in seconds (default: 60.0)

Next Steps