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
4 changes: 2 additions & 2 deletions indexer/src/kadena-server/plugins/instrument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ if (!SENTRY_DSN || SENTRY_DSN.trim() === '') {
environment: SENTRY_ENVIRONMENT,
release: SENTRY_RELEASE,
sendDefaultPii: true,
tracesSampleRate: 1.0,
profileSessionSampleRate: 1.0,
tracesSampleRate: 0.05,
profileSessionSampleRate: 0.05,
profileLifecycle: 'trace',
integrations: [
nodeProfilingIntegration(),
Expand Down
44 changes: 10 additions & 34 deletions indexer/src/kadena-server/plugins/sentry-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,17 @@ import { ResolverContext } from '../config/apollo-server-config';
export function createSentryPlugin(): ApolloServerPlugin<ResolverContext> {
return {
async requestDidStart({ request, contextValue }) {
Sentry.startSpan(
{
name: request.operationName || 'anonymous',
op: 'graphql.query',
attributes: {
'random-test': 'test',
'operation.type': 'graphql.query',
'operation.name': request.operationName || 'anonymous',
},
// Log incoming queries to Sentry as breadcrumbs (no manual spans or profiler here)
Sentry.addBreadcrumb({
category: 'graphql.query',
message: request.operationName || 'Anonymous GraphQL operation',
level: 'info',
data: {
query: request.query,
variables: request.variables,
operationType: request.operationName ? 'named' : 'anonymous',
},
span => {
// Set operation attributes
span.setAttributes({
'operation.details.type': 'graphql.query',
'operation.details.name': request.operationName || 'anonymous',
'operation.details.timestamp': new Date().toISOString(),
'operation.details.query': request.query,
});

// Optionally log all incoming queries to Sentry as breadcrumbs
// Breadcrumbs create a historical trail that persists (query history)
Sentry.profiler.startProfiler();
Sentry.addBreadcrumb({
category: 'graphql.query',
message: request.operationName || 'Anonymous GraphQL operation',
level: 'info',
data: {
query: request.query,
variables: request.variables,
operationType: request.operationName ? 'named' : 'anonymous',
},
});
Sentry.profiler.stopProfiler();
},
);
});
return {
async didEncounterErrors({ errors, operation, operationName, request }) {
// Skip Apollo-specific errors that are intentionally thrown
Expand Down