Then use the AWS Lambda integration for the Python SDK like this:
import sentry_sdksentry_sdk.init( dsn="https://<key>@sentry.io/<project>", integrations=[AwsLambdaIntegration()], traces_sample_rate=1.0, # adjust the sample rate in production as needed)def my_function(event, context): # ...
Add @sentry/serverless as a dependency to package.json:
"@sentry/serverless": "*"
Then set up Sentry error logging for a GCP Cloud Function:
Then use the GCP Functions integration for the Python SDK like this:
import sentry_sdkfrom sentry_sdk.integrations.gcp import GcpIntegrationsentry_sdk.init( dsn="https://<key>@sentry.io/<project>", integrations=[GcpIntegration()], traces_sample_rate=1.0, # adjust the sample rate in production as needed)def http_function_entrypoint(request): # ...
Add @sentry/node as a dependency:
npm install --save @sentry/node
Then set up Sentry error logging for an Azure Function:
Then add the Sentry middleware to your Cloudflare Pages functions:
import * as Sentry from "@sentry/cloudflare";export const onRequest = [ // Make sure Sentry is the first middleware Sentry.sentryPagesPlugin((context) => ({ dsn: 'https://<key>@sentry.io/<project>', tracesSampleRate: 1.0, })), // Add more middlewares here];
Add @sentry/cloudflare as a dependency:
npm install --save @sentry/cloudflare
Configure the nodejs_compat compatibility flag in your wrangler.json:
Then wrap your handler with the withSentry function:
import * as Sentry from "@sentry/cloudflare";export default Sentry.withSentry( (env) => ({ dsn: 'https://<key>@sentry.io/<project>', tracesSampleRate: 1.0, enableLogs: true, }), { async fetch(request, env, ctx) { return new Response('Hello World!'); }, });
Add @sentry/node as a dependency:
npm install --save @sentry/node
Create an initialization file (e.g., init.ts) that runs before your functions:
import * as Sentry from '@sentry/node';Sentry.init({ dsn: 'https://<key>@sentry.io/<project>', tracesSampleRate: 1.0,});
Import the initialization file at the top of your functions entry point:
import './init'; // Import Sentry initialization firstimport { onRequest } from 'firebase-functions/https';import { onDocumentCreated } from 'firebase-functions/firestore';import * as admin from 'firebase-admin';admin.initializeApp();const db = admin.firestore();// HTTP function - automatically instrumentedexport const helloWorld = onRequest(async (request, response) => { response.send('Hello from Firebase!');});// Firestore trigger - automatically instrumentedexport const onUserCreated = onDocumentCreated('users/{userId}', async (event) => { const userId = event.params.userId; // Your logic here});
More than 150K Organizations Trust Sentry with Their Application Monitoring
Code-Level Visibility
View stack traces on issues, user-agent information, and all the metadata around an issue for all the context needed to resolve the issue.
Quickly Identify Function Latencies
Trace those ten-second page loads to poor-performing API calls and slow database queries. The event detail waterfall visually highlights what calls are giving your customers a poor experience.
Fill in the Gaps
See what happened leading up to the issue. Get function execution details including function metadata, execution time, Amazon Resource Name, and function identity.
FAQs
Sentry uses run-time instrumentation to capture errors. This allows users to get to the root of the problems using stack traces, breadcrumbs, function context and environment context.
CloudWatch/Stackdriver logs and metrics are hard to use to debug issues. The information is limited to some log statements and usually don't have the context needed to debug issues.
Sentry uses run-time instrumentation to get real time visibility into execution environment and report all relevant info to be able to quickly debug issues. For example source code visibility when issues occur.
CloudWatch or Stackdriver log forwarding requires parsing through logs and usually are limited to details that already exist in logs.
Sentry supports distributed tracing in addition to error monitoring for serverless functions.
You can get started for free. Pricing depends on the number of monthly events, transactions, and attachments that you send Sentry. For more details, visit our pricing page.