Skip to content

Instantly share code, notes, and snippets.

@efueyo
Last active April 24, 2021 01:32
Show Gist options
  • Save efueyo/b021e938804f89a56739649ed1a02007 to your computer and use it in GitHub Desktop.
Save efueyo/b021e938804f89a56739649ed1a02007 to your computer and use it in GitHub Desktop.
Apollo-Sentry-Context
import { Transaction } from "@sentry/types"
export interface Context {
// ... other context fields for your context
transaction: Transaction
}
export async function createContext(): Promise<Context> { {
// ... create other context fields
const transaction = Sentry.startTransaction({
op: "gql",
name: "GraphQLTransaction", // this will be the default name, unless the gql query has a name
})
return { transaction };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment