### Install sentry-go SDK Source: https://docs.sentry.io/platforms/go/guides/echo/migration Install the new sentry-go SDK using go get. ```bash go get github.com/getsentry/sentry-go ``` -------------------------------- ### Install Zerolog Integration Source: https://docs.sentry.io/platforms/go/guides/echo/logs/zerolog Install the Sentry Go SDK and the Zerolog integration package using go get. ```bash go get github.com/getsentry/sentry-go go get github.com/getsentry/sentry-go/zerolog ``` -------------------------------- ### Install raven-go SDK Source: https://docs.sentry.io/platforms/go/guides/echo/migration Install the deprecated raven-go SDK using go get. ```bash go get github.com/getsentry/raven-go ``` -------------------------------- ### Install Sentry Go SDK Source: https://docs.sentry.io/platforms/go/guides/echo/metrics Install the Sentry Go SDK using the go get command. Ensure you are using version 0.42.0 or above for metrics support. ```bash go get github.com/getsentry/sentry-go ``` -------------------------------- ### Install Sentry Go SDK and Zap Integration Source: https://docs.sentry.io/platforms/go/guides/echo/logs/zap Installs the necessary Sentry Go SDK and the Zap integration package using go get. ```bash go get github.com/getsentry/sentry-go go get github.com/getsentry/sentry-go/zap ``` -------------------------------- ### Install Sentry with Nuxt Wizard Source: https://docs.sentry.io/platforms/javascript/guides/nuxt Run this command in your Nuxt project to initiate the Sentry installation wizard, which guides you through setup and feature enablement. ```bash npx @sentry/wizard@latest -i nuxt ``` ```bash npx @sentry/wizard@latest -i nuxt ``` -------------------------------- ### Custom Integration with Setup Hook Source: https://docs.sentry.io/platforms/javascript/configuration/integrations/custom Illustrates using the `setup` hook to execute code during SDK initialization, receiving the client instance. ```javascript const integration = { name: "MyAwesomeIntegration", setup(client) { setupCustomSentryListener(client); }, }; ``` -------------------------------- ### Install Sentry with React Router Wizard Source: https://docs.sentry.io/platforms/javascript/guides/react-router Use the Sentry installation wizard to automatically set up Sentry in your React Router application. The wizard guides you through enabling optional features and can create example pages. ```bash npx @sentry/wizard@latest -i reactRouter ``` -------------------------------- ### Initialize Sentry SDK with Options Source: https://docs.sentry.io/platforms/native/configuration/options Demonstrates how to initialize the Sentry SDK with essential options like DSN, release, and debug mode. ```c #include int main(void) { sentry_options_t *options = sentry_options_new(); sentry_options_set_dsn(options, "https://examplePublicKey@o0.ingest.sentry.io/0"); sentry_options_set_release(options, "my-project-name@2.3.12"); sentry_options_set_debug(options, 1); sentry_init(options); /* ... */ } ``` ```c #include int main(void) { sentry_options_t *options = sentry_options_new(); sentry_options_set_dsn(options, "___PUBLIC_DSN___"); sentry_options_set_release(options, "my-project-name@2.3.12"); sentry_options_set_debug(options, 1); sentry_init(options); /* ... */ } ``` -------------------------------- ### Custom Integration with SetupOnce Hook Source: https://docs.sentry.io/platforms/javascript/configuration/integrations/custom Explains the `setupOnce` hook, which runs only once even if the SDK is re-initialized. It's generally recommended to use `setup` instead. ```javascript const integration = { name: "MyAwesomeIntegration", setupOnce() { wrapLibrary(); }, }; ``` -------------------------------- ### Backend Media Upload Validation and Queueing (Express) Source: https://docs.sentry.io/platforms/javascript/guides/node/tracing/span-metrics/examples Instrument the backend API endpoint for receiving uploads. This example shows basic Express setup and the start of an endpoint to validate uploads and enqueue them for processing. ```typescript // Import Sentry instrumentation first (required for v10) import "./instrument"; import express from "express"; import * as Sentry from "@sentry/node"; // POST /api/upload - Receive and validate upload, then enqueue for processing app.post( "/api/upload", async (req: Request<{}, {}, UploadRequest>, res: Response) => { const { fileName, fileType, fileSize } = req.body; ``` -------------------------------- ### Example Configuration with Custom Options Source: https://docs.sentry.io/platforms/javascript/guides/astro/configuration/integrations/event-loop-block Demonstrates how to configure the `eventLoopBlockIntegration` with custom `threshold`, `maxEventsPerHour`, and `staticTags` for detailed monitoring. ```javascript import { eventLoopBlockIntegration } from "@sentry/node-native"; Sentry.init({ dsn: "__YOUR_DSN__", integrations: [ eventLoopBlockIntegration({ threshold: 500, // Trigger after 500ms of blocking (stack traces automatically captured) maxEventsPerHour: 5, // Maximum 5 events per hour staticTags: { component: "main-thread", environment: "production", }, }), ], }); ``` -------------------------------- ### Java Crons Heartbeat - Success Source: https://docs.sentry.io/platforms/java/crons Use heartbeat monitoring to notify Sentry of a job's status with a single check-in. This setup notifies you if the job didn't start as expected (missed). This example shows a successful completion. ```java import io.sentry.CheckIn; import io.sentry.CheckInStatus; import io.sentry.Sentry; import io.sentry.protocol.SentryId; // Execute your scheduled task... // 🟢 Notify Sentry your job completed successfully: CheckIn checkIn = new CheckIn( "", CheckInStatus.OK ); checkIn.setDuration(10.0); Sentry.captureCheckIn(checkIn); ``` -------------------------------- ### Setting up Sentry SDK with Transaction and Profiling Source: https://docs.sentry.io/platforms/python/troubleshooting Example of initializing the Sentry SDK with tracing and profiling enabled. Ensure your SDK version is compatible with the configuration options. ```python base_url = "https://empowerplant.io" endpoint = "/api/0/projects/ep/setup_form" parameters = { "user_id": 314159265358979323846264338327, "tracking_id": "EasyAsABC123OrSimpleAsDoReMi", "product_name": PlantToHumanTranslator, "product_id": 161803398874989484820458683436563811772030917980576, } with sentry_sdk.start_span(op="request", transaction="setup form") as span: span.set_tag("base_url", base_url) span.set_tag("endpoint", endpoint) span.set_data("parameters", parameters) make_request( "{base_url}/{endpoint}/".format( base_url=base_url, endpoint=endpoint, ), data=parameters ) # ... ``` -------------------------------- ### Run Sentry Wizard for Automatic Setup Source: https://docs.sentry.io/platforms/javascript/guides/react/sourcemaps/uploading/create-react-app Use the Sentry Wizard to automatically configure source map uploading for your Create React App project. It guides you through logging in, installing packages, and configuring build tools and CI. ```bash npx @sentry/wizard@latest -i sourcemaps ``` -------------------------------- ### SolidStart Server Entry with Dynamic Import Source: https://docs.sentry.io/platforms/javascript/guides/solidstart/install/dynamic-import Example of a SolidStart server entry file (`.output/server/index.mjs`) demonstrating how Sentry is initialized early and the Nitro runtime is loaded via dynamic import(). ```javascript // Note: The file may have some imports and code, related to debug IDs Sentry.init({ dsn: "...", }); import("./chunks/nitro/nitro.mjs").then(function (n) { return n.r; }); ``` ```javascript // Note: The file may have some imports and code, related to debug IDs Sentry.init({ dsn: "...", }); import("./chunks/nitro/nitro.mjs").then(function (n) { return n.r; }); ``` -------------------------------- ### Sampling Context Data for tracesSampler Source: https://docs.sentry.io/platforms/javascript/guides/node/sampling When a span starts, `tracesSampler` receives the span `name` and initial `attributes`. This example shows how to use this data within `tracesSampler` to make a sampling decision, specifically to avoid sampling a 'GET /search' span. ```javascript Sentry.startSpan({ name: "GET /search", op: "search", attributes: { "queryParam.animal": "dog", "queryParam.type": "very good", }, }); // Will result in `tracesSampler` receiving: function tracesSampler(samplingContext) { /* samplingContext = { name: "GET /search", attributes: { queryForAnimal: "dog", queryForType: "very good" }, } */ // Do not sample this specific span return name !== "GET /search"; } ``` -------------------------------- ### Custom Integration with AfterAllSetup Hook Source: https://docs.sentry.io/platforms/javascript/configuration/integrations/custom Illustrates the `afterAllSetup` hook, which is triggered after all other `setupOnce` and `setup` hooks have completed. It receives the client instance. ```javascript const integration = { name: "MyAwesomeIntegration", afterAllSetup(client) { // We can be sure that all other integrations // have run their `setup` and `setupOnce` hooks now startSomeThing(client); }, }; ``` -------------------------------- ### Initialize Sentry SDK (Example DSN) Source: https://docs.sentry.io/platforms/apple/guides/ios/install/swift-package-manager Initialize the Sentry SDK in your application's didFinishLaunchingWithOptions method using an example DSN. This configuration enables debug mode, sends default PII, and sets the traces sample rate. ```objc #import - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [SentryObjCSDK startWithConfigureOptions:^(SentryObjCOptions *options) { options.dsn = @"https://examplePublicKey@o0.ingest.sentry.io/0"; options.debug = YES; // Adds IP for users. // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/ options.sendDefaultPii = YES; // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. // We recommend adjusting this value in production. options.tracesSampleRate = @1.0; }]; return YES; } ``` -------------------------------- ### Make Web Request with Dio and Sentry Tracing Source: https://docs.sentry.io/platforms/dart/integrations/dio This example demonstrates making a GET request using Dio with Sentry integration. It includes starting a Sentry transaction, creating a child span for the Dio request, and handling potential exceptions by associating them with the span and capturing them with Sentry. ```dart import 'package:sentry_dio/sentry_dio.dart'; import 'package:dio/dio.dart'; import 'package:sentry_flutter/sentry.dart'; Future makeWebRequestWithDio() async { final dio = Dio(); dio.addSentry(); // If there is no active transaction, start one final transaction = Sentry.startTransaction( 'dio-web-request', 'request', bindToScope: true, ); final span = transaction.startChild( 'dio', description: 'desc', ); Response? response; try { response = await dio.get(exampleUrl); span.status = const SpanStatus.ok(); } catch (exception, stackTrace) { span.throwable = exception; span.status = const SpanStatus.internalError(); await Sentry.captureException(exception, stackTrace: stackTrace); } finally { await span.finish(); } } ``` -------------------------------- ### Initialize Sentry Go SDK with Client Options Source: https://docs.sentry.io/platforms/go/configuration/options Basic initialization of the Sentry Go SDK using `sentry.ClientOptions`. This example shows how to set the DSN, enable debug messages, and include default PII. ```go sentry.Init(sentry.ClientOptions{ Dsn: "https://examplePublicKey@o0.ingest.sentry.io/0", // Enable printing of SDK debug messages. // Useful when getting started or trying to figure something out. Debug: true, // Adds request headers and IP for users, // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info SendDefaultPII: true, // Release: "my-project-name@1.0.0", }) ``` ```go sentry.Init(sentry.ClientOptions{ Dsn: "___PUBLIC_DSN___", // Enable printing of SDK debug messages. // Useful when getting started or trying to figure something out. Debug: true, // Adds request headers and IP for users, // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info SendDefaultPII: true, // Release: "my-project-name@1.0.0", }) ``` -------------------------------- ### Install sentry-go HTTP integration Source: https://docs.sentry.io/platforms/go/guides/echo/migration Install the sentry-go HTTP integration package using go get. ```Bash go get github.com/getsentry/sentry-go/http ``` -------------------------------- ### Get the latest installable build for a project Source: https://docs.sentry.io/api/mobile-builds Retrieves the most recent installable build for a specified Sentry project. ```APIDOC ## GET /api/projects/{project_slug}/builds/latest ### Description Retrieves the latest installable build for a given project. ### Method GET ### Endpoint /api/projects/{project_slug}/builds/latest ### Parameters #### Path Parameters - **project_slug** (string) - Required - The slug of the project to retrieve the build for. ``` -------------------------------- ### Install sentry-sdk Source: https://docs.sentry.io/platforms/python/integrations/aiohttp/aiohttp-client Install the Sentry SDK using pip or uv. ```bash pip install sentry-sdk ``` ```bash uv add sentry-sdk ``` -------------------------------- ### Install sentry-sdk with uv Source: https://docs.sentry.io/platforms/python/integrations/logging Install the Sentry SDK for Python using uv. ```bash uv add "sentry-sdk" ``` -------------------------------- ### Install Sentry Wizard with NPX Source: https://docs.sentry.io/platforms/android Install the Sentry Wizard using NPX for automated Android SDK setup. ```bash npx @sentry/wizard@latest -i android ``` -------------------------------- ### Initialize Sentry with Unleash Integration (Placeholder DSN) Source: https://docs.sentry.io/platforms/javascript/guides/elysia/configuration/integrations/unleash This example demonstrates initializing the Sentry SDK with the Unleash integration using placeholder values for the DSN and SDK package. It's useful for testing or when actual values are not yet available. ```javascript import * as Sentry from "___SDK_PACKAGE___"; import { UnleashClient } from "unleash-proxy-client"; Sentry.init({ dsn: "___PUBLIC_DSN___", integrations: [ Sentry.unleashIntegration({ featureFlagClientClass: UnleashClient }), ], }); const unleash = new UnleashClient({ url: "https:///api/frontend", clientKey: "", appName: "my-webapp", }); unleash.start(); // Evaluate a flag with a default value. You may have to wait for your client to synchronize first. unleash.isEnabled("test-flag"); Sentry.captureException(new Error("Something went wrong!")); ``` -------------------------------- ### HTTP Request for Job Failure (Example) Source: https://docs.sentry.io/platforms/javascript/guides/nitro/crons This is an example HTTP GET request for notifying Sentry about a job failure. ```http GET /api/___PROJECT_ID___/cron//___PUBLIC_KEY___/?status=error HTTP/1.1 ``` -------------------------------- ### Initialize Sentry SDK with Options Source: https://docs.sentry.io/platforms/python/configuration/options Demonstrates how to initialize the Sentry SDK with common configuration options. This includes setting the DSN, breadcrumb limit, debug mode, transaction tracing sample rate, and PII sending. ```python import sentry_sdk sentry_sdk.init( dsn="https://examplePublicKey@o0.ingest.sentry.io/0", max_breadcrumbs=50, debug=True, # Set traces_sample_rate to 1.0 to capture 100% # of transactions for tracing. traces_sample_rate=1.0, # Add request headers and IP for users, # see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info send_default_pii=True, # By default the SDK will try to use the SENTRY_RELEASE # environment variable, or infer a git commit # SHA as release, however you may want to set # something more human-readable. # release="myapp@1.0.0", ) ``` -------------------------------- ### Installation Webhook Payload Example Source: https://docs.sentry.io/integrations/integration-platform/webhooks/installation This JSON payload represents a webhook triggered when an integration is installed. It includes details about the action, the actor who performed it, and specific data related to the installation, such as the organization, app, and installation UUID. ```json { "action": "created", "actor": { "id": 1, "name": "Meredith Heller", "type": "user" }, "data": { "installation": { "status": "pending", "organization": { "slug": "test-org" }, "app": { "uuid": "2ebf071f-28df-4989-aca9-c37c763b278f", "slug": "webhooks-galore" }, "code": "f3c71b491e3949b6b033ae45312a4fcb", "uuid": "a8e5d37a-696c-4c54-adb5-b3f28d64c7de" } }, "installation": { "uuid": "a8e5d37a-696c-4c54-adb5-b3f28d64c7de" } } ``` -------------------------------- ### Retrieve and Start Transaction/Span Source: https://docs.sentry.io/platforms/dotnet/guides/android/tracing/instrumentation/custom-instrumentation Use SentrySdk.GetSpan() to get the current transaction or span. If none exists, start a new transaction. Otherwise, start a child span on the existing one. ```csharp var span = SentrySdk.GetSpan(); if (span == null) { span = SentrySdk.StartTransaction("task", "op"); } else { span = span.StartChild("subtask"); } ``` -------------------------------- ### Install Sentry Wizard with Brew Source: https://docs.sentry.io/platforms/android Use this command to install the Sentry Wizard via Homebrew for automated Android SDK setup. ```bash brew install getsentry/tools/sentry-wizard && sentry-wizard -i android ```