title | description |
---|---|
Quickstart |
Start shipping traces to Langtrace Cloud under 5 minutes! |
To use the managed SaaS version of Langtrace, follow the steps below:
- Sign up by going to this link.
- Create a new Project after signing up. Projects are containers for storing traces and metrics generated by your application. If you have only one application, creating 1 project will do.
- Generate an API key. This key will be used to authenticate your application with Langtrace Cloud. You may also create new projects and generate API keys for each of them later.
- In your application, install the Langtrace SDK and initialize it with the API key you generated in the step 3. The code for installing and setting up the SDK is shown below:
// Import it into your project. Must precede any llm module imports import * as Langtrace from '@langtrase/typescript-sdk'
Langtrace.init({ api_key: '<LANGTRACE_API_KEY>'})
```python Python
# Install the SDK
pip install langtrace-python-sdk
# Import it into your project
from langtrace_python_sdk import langtrace # Must precede any llm module imports
langtrace.init(api_key = '<LANGTRACE_API_KEY>')
Congrats! You can now view your traces on Langtrace Cloud. 🚀
| Parameter | Type | Default Value | Description | | -------------------------- | ----------------------------------- | ----------------------------- | -----------------------------------------------------------------------------------------------------------------------------------------| | `batch` | `bool` | `True` | Whether to batch spans before sending them. | | `api_key` | `str` | `LANGTRACE_API_KEY`or `None` | The API key for authentication. | | `write_spans_to_console` | `bool` | `False` | Whether to write spans to the console. | | `custom_remote_exporter` | `Optional[Exporter]` | `None` | Custom remote exporter.
If `None`, a default `LangTraceExporter` will be used. | | `api_host` | `Optional[str]` | `https://langtrace.ai/` | The API host for the remote exporter. | | `disable_instrumentations` | `Optional`
`[DisableInstrumentations]` | `None` | You can pass an object to disable instrumentation for specific vendors,
e.g., `{'only': ['openai']}`
or `{'all_except': ['openai']}`. | | Parameter | Type | Default Value | Description | | -------------------------- | ----------------------------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `api_key` | `string` | `LANGTRACE_API_KEY` or `None` | The API key for authentication. | | `batch` | `boolean` | `false` | Whether to batch spans before sending them. | | `write_spans_to_console` | `boolean` | `false` | Whether to write spans to the console. | | `custom_remote_exporter` | `SpanExporter` | `undefined` | Custom remote exporter. If `undefined`, a default `LangTraceExporter` will be used. | | `api_host` | `string` | `https://langtrace.ai/` | The API host for the remote exporter. For self hosted setups the url needs to be appended with `/api/trace`. | | `instrumentations` | `{ [key in InstrumentationType]?: any }` | `undefined` | This is a required option for next.js applications. It is used to enable or disable instrumentations. ex `instrumentations: {openai: openai}` where the value is `import * as openai from 'openai'`. | | `disable_instrumentations` | `{all_except?: InstrumentationType[], only?: InstrumentationType[]}` | `{}` | You can pass an object to disable instrumentation for specific vendors, e.g., `{'only': ['openai']}` or `{'all_except': ['openai']}`. | | `disable_tracing_for_methods` | `Partial` | `undefined` | You can pass an object to disable tracing for specific methods. ex `disable_tracing_for_methods: { openai: ['openai.chat.completion'] }`. Full list of methods can be found [here]() | | `disable_latest_version_check` | `boolean` | `false` | Disable the latest version check. This disables the warning when the sdk version is outdated |
For users/organizations that want to host Langtrace on their own infrastructure, follow these steps to get started.