Skip to content

Initial setup#1

Merged
michael-hhai merged 1 commit intomainfrom
initial-setup
Nov 16, 2023
Merged

Initial setup#1
michael-hhai merged 1 commit intomainfrom
initial-setup

Conversation

@michael-hhai
Copy link
Contributor

No description provided.

@michael-hhai michael-hhai merged commit 8b3a267 into main Nov 16, 2023
@michael-hhai michael-hhai deleted the initial-setup branch November 16, 2023 17:45
@sweep-ai-deprecated
Copy link

Apply Sweep Rules to your PR?

  • Apply: All new business logic should have corresponding unit tests.
  • Apply: Refactor large functions to be more modular.
  • Apply: Add docstrings to all functions and file headers.

josh-hhai added a commit that referenced this pull request Nov 6, 2025
Addresses #1 user question: 'Where should I initialize the tracer?'

New guide at docs/how-to/deployment/tracer-initialization-patterns.rst

Covers 5 key scenarios with complete examples:

1. **Local Development / Single Trace**
   - Global module-level initialization
   - Simple, efficient for debugging

2. **evaluate() Experiments**
   - Automatic per-datapoint isolation
   - SDK manages tracer lifecycle
   - No global tracer needed

3. **Serverless (AWS Lambda / Cloud Functions)**
   - Per-request with lazy initialization
   - Reuses tracer on warm starts
   - New session per invocation

4. **Long-Running Server (FastAPI / Flask)**
   - Global tracer + per-request sessions
   - Middleware-based session management
   - Distributed tracing support

5. **Testing / Multi-Session**
   - Multiple tracer instances
   - Explicit isolation control

Features:
- Decision matrix for choosing the right pattern
- Complete code examples for each scenario
- FastAPI middleware implementation
- AWS Lambda cold start optimization
- Distributed tracing with OpenTelemetry baggage
- Troubleshooting section for common issues

Addresses confusion from multi-instance architecture where
users don't know whether to use global vs per-request
initialization patterns.

Requested by: Dhruv (addresses recurring support question)
@devin-ai-integration
Copy link
Contributor

test

1 similar comment
@devin-ai-integration
Copy link
Contributor

test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant