Local Development
You can contribute both new instrumentations or update and improve the different SDKs.
Join our Slack community to chat and get help on any issues you may encounter.
The Python and Typescript are monorepos that use nx to manage the different packages.
Make sure you have node >= 18
and nx
installed globally.
Basic guide for using nx
Most commands can be run from the root of the project. For example, to lint the entire project, run:
nx run-many -t lint
Other commands you can use simiarily are test
, or build
, or lock
and install
(for Python).
To run a specific command on a specific package, run:
nx run <package>:<command>
Python
We use poetry
to manage packages, and each package is managed independently under its own directory under /packages
.
All instrumentations depends on opentelemetry-semantic-conventions-ai
,
and traceloop-sdk
depends on all the instrumentations.
If adding a new instrumentation, make sure to use it in traceloop-sdk
, and write proper tests.
Debugging
No matter if you’re working on an instrumentation or on the SDK, we recommend testing the changes by using
the SDK in the sample app (/packages/sample-app
) or the tests under the SDK.
Running tests
We record HTTP requests and then replay them in tests to avoid making actual calls to the foundation model providers. See vcr.py and pollyjs to do that, check out their documentation to understand how to use them and re-record the requests.
You can run all tests by running:
nx run-many -t test
Or run a specific test by running:
nx run <package>:test
For example, to run the tests for the openai
instrumentation package, run:
Typescript
We use npm
with workspaces to manage packages in the monorepo. Install by running npm install
in the root of the project.
Each package has its own test suite. You can use the sample app to run and test changes locally.
Was this page helpful?