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 telemetry abstraction to remove Sentry dep (round 2) #47

Merged
merged 2 commits into from
Aug 9, 2024

Conversation

rileytomasek
Copy link
Contributor

@rileytomasek rileytomasek commented Aug 8, 2024

This is a simplified version of #46. It was easier to copy the important
parts and start clean than try and delete all of the generics code.

Replace the direct dependency on Sentry with the abstract Telemetry
interface from @transitive-bullshit. This should have no impact on
users who weren't using the Sentry integration, and requires passing
Sentry as an argument when creating a model instance.

import { ChatModel } from '@dexaai/dexter'
import * as Sentry from '@sentry/node'

const model = new ChatModel({ telemetry: Sentry })

I also added an example of using Sentry for tracing.

Example Trace

screenshot-2024-08-08 -T-11-31 png

This is a simplified version of #46. It was easier to copy the important
parts and start clean than try and delete all of the generics code.

Replace the direct dependency on Sentry with the abstract `Telemetry`
interface from @transitive-bullshit. This should have no impact on
users who weren't using the Sentry integration, and requires passing
Sentry as an argument when creating a model instance.

```ts
import { ChatModel } from '@dexaai/dexter'
import * as Sentry from '@sentry/node'

const model = new ChatModel({ telemetry: Sentry })
```
Copy link

vercel bot commented Aug 8, 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 Aug 9, 2024 0:29am

@rileytomasek rileytomasek changed the title Add telemetry abstraction to remove Sentry dep Add telemetry abstraction to remove Sentry dep (round 2) Aug 8, 2024
cost: 0,
latency: Date.now() - start,
};
return this.telemetry.startSpan(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also just did s/Sentry/this.telemetry and it made this gnarly diff.

@rileytomasek
Copy link
Contributor Author

@transitive-bullshit i'll merge this when you approve and then master will be in a point where we can make a full 3.0.0 release with telemetry and openai structured responses.

Copy link
Collaborator

@transitive-bullshit transitive-bullshit 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; just one optional change. Feel free to merge and I'll get another PR ready for the updated ChatMessage types.

src/telemetry/types.ts Outdated Show resolved Hide resolved
@rileytomasek rileytomasek merged commit 123d46e into master Aug 9, 2024
6 checks passed
@rileytomasek rileytomasek deleted the telemetry-abstraction 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.

2 participants