Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OpenTelemetry tracing via Sentry #38

Merged
merged 4 commits into from
Jun 3, 2024
Merged

Add OpenTelemetry tracing via Sentry #38

merged 4 commits into from
Jun 3, 2024

Conversation

rileytomasek
Copy link
Contributor

@rileytomasek rileytomasek commented Jun 2, 2024

This adds OpenTelemetry tracing via Sentry to the base model class,
which applies it to all models.

It currently makes Sentry a peer dependency, which means we either need
to do a major version bump and force all users into Sentry, or find a
way to conditionally import Sentry and handle the case where it's not
installed.

Example trace from Sentry:
screenshot-2024-06-02 -T-10-21 png

Copy link

vercel bot commented Jun 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dexter ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 2, 2024 2:21pm

This adds OpenTelemetry tracing via Sentry to the base model class,
which applies it to all models.

It currently makes Sentry a peer dependency, which means we either need
to do a major version bump and force all users into Sentry, or find a
way to conditionally import Sentry and handle the case where it's not
installed.
...mergedContext,
});

return Sentry.startSpan({ name: spanName, op: 'llm' }, async (span) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I bet we could pas this in as an optional function in the constructor (telemetryWrapper or something) so that we don't need the sentry dependency in the library. (Or pass it as an argument to run).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i think that is the correct approach. however, we could use this asap, so i'm going to release it as a major version bump with a warning and we will make it optional in a future major release.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brianbegy @cfortuner i released it as v3 but as a prerelase with the next tag so we can use it, but it won't be used for anyone that does npm install @dexaai/dexter.

Copy link
Contributor

@cfortuner cfortuner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I'm ok with major version bump to keep things simple for us.

@rileytomasek rileytomasek merged commit 8a5d839 into master Jun 3, 2024
6 checks passed
@rileytomasek rileytomasek deleted the tracing branch October 13, 2024 12:29
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.

3 participants