Skip to Content
TracingGetting Started

Setup

Configure tracing in your application to start capturing traces.

Installation

Tracing is included in the Rhesis SDK (v0.6.0+):

terminal
pip install rhesis-sdk

Initialization

Initialize the RhesisClient to set up the tracing infrastructure:

app.py
from rhesis.sdk import RhesisClient

client = RhesisClient(
    api_key="your-api-key",
    project_id="your-project-id",
    environment="development",  # development, staging, production
)

Note: The @observe decorator requires RhesisClient to be initialized. Without initialization, a RuntimeError is raised.

Environment Variables

Configure via environment variables:

terminal
export RHESIS_API_KEY="your-api-key"
export RHESIS_PROJECT_ID="your-project-id"
export RHESIS_ENVIRONMENT="development"

Then initialize without explicit parameters:

app.py
from rhesis.sdk import RhesisClient

client = RhesisClient()  # Uses environment variables

Disabling Tracing

To disable all tracing and connector functionality (useful for CI/CD or testing), set:

terminal
export RHESIS_CONNECTOR_DISABLE=true

Accepted values: true, 1, yes, on (case-insensitive)

When disabled:

  • @endpoint and @observe decorators return functions unmodified
  • No telemetry initialization occurs
  • No network requests are made to Rhesis
  • All method calls become no-ops

Batch Configuration

Traces are batched for efficient export:

SettingDefaultDescription
Queue Size2048Maximum spans buffered in memory
Batch Size512Spans per HTTP request
Export Interval5sTime between batch exports

Verify Setup

Test that tracing is working:

verify.py
from rhesis.sdk import RhesisClient, observe

client = RhesisClient(
    api_key="your-api-key",
    project_id="your-project-id",
    environment="development",
)

@observe()
def test_function():
    return "Hello, tracing!"

# Call the function - trace will be sent after 5 seconds
result = test_function()
print(f"Result: {result}")
print("Check your Rhesis dashboard for the trace.")

Next: Learn about the decorators available for tracing your functions.