Client Configuration
HeimdallClient Options
These options are passed when initializing theHeimdallClient:
| Option | Python | JavaScript | Type | Default | Description |
|---|---|---|---|---|---|
| Endpoint | endpoint | endpoint | string | http://localhost:4318 | Heimdall backend URL |
| Organization ID | org_id | orgId | string | default | Your organization ID |
| Project ID | project_id | projectId | string | default | Your project ID |
| Service Name | service_name | serviceName | string | mcp-server | Name of your service |
| Environment | environment | environment | string | development | Deployment environment |
| API Key | api_key | apiKey | string | - | Optional API key |
| Debug | debug | debug | boolean | false | Enable debug logging |
| Enabled | enabled | enabled | boolean | true | Enable/disable tracing |
| Batch Size | batch_size | batchSize | number | 100 | Spans to batch |
| Flush Interval | flush_interval_ms | flushIntervalMs | number | 5000 | Flush interval (ms) |
Python Example
JavaScript Example
Tracing Decorator Options
trace_mcp_tool / traceMCPTool
Options for the MCP tool tracing decorator:| Option | Python | JavaScript | Type | Default | Description |
|---|---|---|---|---|---|
| Name | name (positional) | name | string | function name | Custom span name |
| Parameter Names | N/A | paramNames | string[] | - | Names for positional args |
| Capture Input | N/A | captureInput | boolean | true | Whether to capture inputs |
| Capture Output | N/A | captureOutput | boolean | true | Whether to capture outputs |
Python SDK automatically captures parameter names using introspection, so
paramNames is not needed.Python Examples
JavaScript Examples
observe Options
Options for the general-purpose tracing decorator:| Option | Python | JavaScript | Type | Default | Description |
|---|---|---|---|---|---|
| Name | name | name | string | function name | Custom span name |
| Capture Input | capture_input | captureInput | boolean | true | Whether to capture inputs |
| Capture Output | capture_output | captureOutput | boolean | true | Whether to capture outputs |
Python Examples
JavaScript Examples
Client Methods
flush / flushAsync
Force send all pending spans to the backend:shutdown
Gracefully shutdown the client:Advanced Configuration
Batching Behavior
Spans are batched for efficient transmission:- Spans are collected until
batch_sizeis reached ORflush_interval_mselapses - Call
flush()to immediately send all pending spans - Call
shutdown()to flush and close the client
Debug Mode
Enable debug mode to see detailed logging:- Span creation events
- Batch transmission attempts
- Errors and retries
Disabling Tracing
Setenabled=False to completely disable tracing:
- All decorators become no-ops
- No data is sent to the backend
- Minimal performance overhead
Next Steps
Environment Variables
Configure using environment variables.
Tracing Overview
Learn how tracing works.