Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@
"e2e": "xvfb-maybe vitest run --root=./test/e2e --silent=false --disable-console-intercept"
},
"dependencies": {
"@sentry/browser": "11.0.0",
"@sentry/browser": "11.1.0",
"@sentry/conventions": "^0.23.0",
"@sentry/core": "11.0.0",
"@sentry/node": "11.0.0",
"@sentry/server-utils": "11.0.0"
"@sentry/core": "11.1.0",
"@sentry/node": "11.1.0",
"@sentry/server-utils": "11.1.0"
},
"peerDependencies": {
"@sentry/node-native": "11.0.0"
"@sentry/node-native": "11.1.0"
},
"peerDependenciesMeta": {
"@sentry/node-native": {
Expand All @@ -121,8 +121,8 @@
},
"devDependencies": {
"@rollup/plugin-typescript": "^12.1.3",
"@sentry/eslint-plugin-sdk": "11.0.0",
"@sentry/node-native": "11.0.0",
"@sentry/eslint-plugin-sdk": "11.1.0",
"@sentry/node-native": "11.1.0",
"@types/busboy": "^1.5.4",
"@types/koa": "^2.0.52",
"@types/koa-bodyparser": "^4.3.0",
Expand Down
3 changes: 3 additions & 0 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export {
instrumentOpenAiClient,
instrumentStateGraph,
instrumentStateGraphCompile,
instrumentTypeSafeClient,
instrumentSupabaseClient,
isEnabled,
isInitialized,
Expand All @@ -105,6 +106,7 @@ export {
logger,
lruMemoizerIntegration,
mastraIntegration,
mcpServerIntegration,
metrics,
mistralAIIntegration,
modulesIntegration,
Expand Down Expand Up @@ -170,6 +172,7 @@ export {
tediousIntegration,
togetherAIIntegration,
trpcMiddleware,
typesafeIntegration,
unleashIntegration,
updateSpanName,
winterCGHeadersToDict,
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ interface ElectronRendererOptions extends Partial<ElectronRendererOptionsInterna
export function init<O extends ElectronRendererOptions>(
options: ElectronRendererOptions & O = {} as ElectronRendererOptions & O,
// This parameter name ensures that TypeScript error messages contain a hint for fixing SDK version mismatches
originalInit: (if_you_get_a_typescript_error_ensure_sdks_use_version_v11_0_0: O) => void = browserInit,
originalInit: (if_you_get_a_typescript_error_ensure_sdks_use_version_v11_1_0: O) => void = browserInit,
): void {
// Ensure the browser SDK is only init'ed once.
if (window?.__SENTRY__RENDERER_INIT__) {
Expand Down
3 changes: 3 additions & 0 deletions src/utility/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export {
instrumentOpenAiClient,
instrumentStateGraph,
instrumentStateGraphCompile,
instrumentTypeSafeClient,
instrumentSupabaseClient,
isEnabled,
isInitialized,
Expand All @@ -106,6 +107,7 @@ export {
logger,
lruMemoizerIntegration,
mastraIntegration,
mcpServerIntegration,
metrics,
mistralAIIntegration,
modulesIntegration,
Expand Down Expand Up @@ -172,6 +174,7 @@ export {
tediousIntegration,
togetherAIIntegration,
trpcMiddleware,
typesafeIntegration,
unleashIntegration,
updateSpanName,
winterCGHeadersToDict,
Expand Down
10 changes: 10 additions & 0 deletions test/e2e/test-apps/other/orchestrion-graphql/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "orchestrion-graphql",
"description": "Orchestrion GraphQL",
"version": "1.0.0",
"main": "src/main.js",
"dependencies": {
"@sentry/electron": "5.6.0",
"graphql": "^16.14.2"
}
}
23 changes: 23 additions & 0 deletions test/e2e/test-apps/other/orchestrion-graphql/src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const { app } = require('electron');
const { init, startSpan, graphqlIntegration } = require('@sentry/electron/main');

init({
dsn: '__DSN__',
debug: true,
tracesSampleRate: 1,
integrations: [graphqlIntegration()],
onFatalError: () => {},
});

app.on('ready', async () => {
// Require graphql *after* Sentry.init so orchestrion's loader hook - registered when the
// NodeClient is constructed - can inject the diagnostics-channel instrumentation into it.
const { graphql, buildSchema } = require('graphql');
const schema = buildSchema('type Query { hello: String }');

await startSpan({ name: 'orchestrion-graphql' }, async () => {
await graphql({ schema, source: '{ hello }', rootValue: { hello: () => 'world' } });
});

setTimeout(() => app.quit(), 1000);
});
39 changes: 39 additions & 0 deletions test/e2e/test-apps/other/orchestrion-graphql/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { expect } from 'vitest';
import { electronTestRunner, getSpansFromEnvelope } from '../../..';

electronTestRunner(
__dirname,
{
// Keep the app as CommonJS so it can `require('graphql')` lazily, after `Sentry.init`
// has registered the orchestrion loader hook (the auto CJS->ESM transform would hoist
// the import above init).
skipEsmAutoTransform: true,
},
async (ctx) => {
await ctx
.expect({
envelope: (envelope) => {
const spans = getSpansFromEnvelope(envelope);
expect(spans).toBeDefined();

// The manually started segment span
expect(spans?.some((span) => span.is_segment && span.name === 'orchestrion-graphql')).toBe(true);

// The executed graphql query span, injected by orchestrion's diagnostics-channel
// instrumentation. The `auto.graphql.diagnostic_channel` origin is what proves the
// loader hook actually injected the instrumentation into the `graphql` module.
const executeSpan = spans?.find((span) => span.attributes?.['graphql.processing.type']?.value === 'execute');
expect(executeSpan).toBeDefined();
expect(executeSpan?.name).toBe('GraphQL query');
expect(executeSpan?.attributes?.['sentry.origin']).toEqual({
value: 'auto.graphql.diagnostic_channel',
type: 'string',
});
expect(executeSpan?.attributes?.['sentry.op']).toEqual({ value: 'graphql', type: 'string' });
expect(executeSpan?.attributes?.['graphql.document']).toEqual({ value: '{ hello }', type: 'string' });
expect(executeSpan?.attributes?.['graphql.operation.type']).toEqual({ value: 'query', type: 'string' });
},
})
.run();
},
);
Loading
Loading