-
Notifications
You must be signed in to change notification settings - Fork 13
feat: Upgrade JS SDK to 9.16.1
and add durable objects instrumentation
#165
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
Conversation
8a76040
to
d033bdf
Compare
@@ -25,8 +34,27 @@ export default class SentryMCP extends McpAgent<Env, unknown, WorkerProps> { | |||
userId: this.props.id, | |||
}, | |||
onToolComplete: () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we actually n eed this flush at this point? still no idea why it didnt do anything before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't need this flush now that we have durable objects instrumentation. We can keep it around for now, let me test quickly to make sure everything is okay - I'll open another PR in a sec.
_experiments: { | ||
enableLogs: true, | ||
}, | ||
integrations: [Sentry.consoleLoggingIntegration()], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this make console.error go to sentry as a new issue? if so prob gonna remove it as i prefer the more explicit abstraction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this make console.error go to sentry as a new issue
Right now it only records it as a error
level log.
Once the SDK is not experimental, we'll merge consoleLoggingIntegration
with the regular console instrumentation (which is enabled by default), which give users the option to create issues from console errors. For now it will stay separate, and only create logs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah thats what i want (I dont ever want console to create issues, generally speaking)
maybe sometimes id want things showing up as logs to be issues, but by default logger integrations are noisey
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe sometimes id want things showing up as logs to be issues, but by default logger integrations are noisey
yeah we're debating between just a boolean option to forward everything, or some callback that allows you to create issues on log message. We'll have this implemented by GA.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id just have the server handle it - no reason we cant have a thing that says "turn logs that look like X into issues"
packages/mcp-server/src/logging.ts
Outdated
@@ -1,4 +1,4 @@ | |||
import { captureException, captureMessage, withScope } from "@sentry/core"; | |||
import { captureException, captureMessage, withScope } from "@sentry/node"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mcp-server is used on multi-env which is why im not binding this to node
Gonna ship and address comments async. I reverted the |
Durable objects instrumentation support was added in 9.16.0 of the JS SDK. This PR upgrades
sentry-mcp
to get instrumented with durable objects.Docs PR for durable objects is here: getsentry/sentry-docs#13626.
In
packages/mcp-cloudflare/src/server/lib/mcp-transport.ts
I had to comment out thewrapMcpServerWithSentry
usage, because this breaks locally with miniflare. We're following up with the cloudflare team about this (more details here in linear: https://linear.app/getsentry/issue/JS-398/9150-breaks-cloudflare-sdk-usage-in-sentry-mcp#comment-7ce26edb). When we fix this, we'll come back and re-enable it.9.16.0
also added support for logs in the Cloudflare SDK, so I enabled that, and added theconsoleLoggingIntegration
(integration is optional while logs is experimental in the SDK) to flush logs fromconsole.X
calls to Sentry.