### Install Legacy Go SDK using go get Source: https://docs.sentry.io/platforms/go/legacy-sdk This command installs the legacy raven-go SDK, a Sentry client implementation for the Go programming language, using the go get command. It is a prerequisite for using the SDK. ```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 go get. This is a prerequisite for using Sentry features, including metrics. ```bash go get github.com/getsentry/sentry-go ``` -------------------------------- ### Install Zerolog Integration Source: https://docs.sentry.io/platforms/go/guides/http/logs/zerolog Install the Sentry Go SDK and the Zerolog integration using go get. ```APIDOC ## Install Zerolog Integration ### Description Install the Sentry Go SDK and the Zerolog integration using go get. ### Command ```bash go get github.com/getsentry/sentry-go go get github.com/getsentry/sentry-go/zerolog ``` ``` -------------------------------- ### Install Sentry SDK for Gin Source: https://docs.sentry.io/platforms/go/guides/gin Installs the Sentry Go SDK and the Gin integration package using go get. ```bash go get github.com/getsentry/sentry-go go get github.com/getsentry/sentry-go/gin ``` -------------------------------- ### Install Raven SDK Source: https://docs.sentry.io/platforms/go/guides/grpc/migration Install the deprecated raven-go SDK using go get. ```bash go get github.com/getsentry/raven-go ``` -------------------------------- ### Install Strawberry GraphQL Source: https://docs.sentry.io/platforms/python/integrations/strawberry Install the Strawberry GraphQL library with debug server support. This is a prerequisite for running the verification example. ```bash pip install 'strawberry-graphql[debug-server]' ``` -------------------------------- ### Install Sentry SDK for net/http Source: https://docs.sentry.io/platforms/go/guides/http Install the Sentry Go SDK and the HTTP integration package using go get. ```bash go get github.com/getsentry/sentry-go go get github.com/getsentry/sentry-go/http ``` -------------------------------- ### Install Negroni and Sentry Go SDK Source: https://docs.sentry.io/platforms/go/guides/negroni Install the necessary Negroni and Sentry Go packages using go get. ```bash go get github.com/getsentry/sentry-go go get github.com/getsentry/sentry-go/negroni ``` -------------------------------- ### Install Sentry SDK for Fiber Source: https://docs.sentry.io/platforms/go/guides/fiber Install the Sentry Go SDK and the Fiber integration package using go get. ```bash go get github.com/getsentry/sentry-go go get github.com/getsentry/sentry-go/fiber ``` -------------------------------- ### Install Sentry with Nuxt Wizard Source: https://docs.sentry.io/platforms/javascript/guides/nuxt Run this command to initiate the Sentry installation wizard for your Nuxt project. The wizard will guide you through setup and optional feature enablement. ```bash npx @sentry/wizard@latest -i nuxt ``` -------------------------------- ### Implement Zerolog Sentry Writer Source: https://docs.sentry.io/platforms/go/guides/fiber/logs/zerolog Full example demonstrating how to initialize Sentry, configure the Zerolog writer, and output logs to both console and Sentry. ```go import ( "errors" "time" "os" "github.com/getsentry/sentry-go" sentryzerolog "github.com/getsentry/sentry-go/zerolog" "github.com/rs/zerolog" "github.com/rs/zerolog/log" ) func main() { err := sentry.Init(sentry.ClientOptions{Dsn: "___PUBLIC_DSN___"}) if err != nil { log.Fatal().Err(err).Msg("sentry initialization failed") } defer sentry.Flush(2 * time.Second) sentryWriter, err := sentryzerolog.New(sentryzerolog.Config{ Options: sentryzerolog.Options{ Levels: []zerolog.Level{zerolog.ErrorLevel, zerolog.FatalLevel, zerolog.PanicLevel}, WithBreadcrumbs: false, FlushTimeout: 3 * time.Second, }, }) if err != nil { log.Fatal().Err(err).Msg("failed to create sentry writer") } defer sentryWriter.Close() log.Logger = log.Output(zerolog.MultiLevelWriter(zerolog.ConsoleWriter{Out: os.Stderr}, sentryWriter)) log.Error().Msg("This is an error event, not a structured log") } ``` -------------------------------- ### Install Sentry using the Angular Wizard Source: https://docs.sentry.io/platforms/javascript/guides/angular Run this command in your Angular project to automatically configure Sentry. The wizard will guide you through setup and optional feature enablement. ```bash npx @sentry/wizard@latest -i angular ``` -------------------------------- ### SDK Initialization with Options Source: https://docs.sentry.io/platforms/dotnet/guides/entityframework/configuration/options Example of initializing the Sentry SDK with various configuration options in a Program.cs file. ```APIDOC ## POST /api/users ### Description Creates a new user in the system. ### Method POST ### Endpoint /api/users ### Parameters #### Request Body - **username** (string) - Required - The desired username for the new user. - **email** (string) - Required - The email address of the new user. - **password** (string) - Required - The password for the new user. ### Request Example { "username": "johndoe", "email": "john.doe@example.com", "password": "securepassword123" } ### Response #### Success Response (201) - **userId** (string) - The unique identifier for the newly created user. - **message** (string) - A confirmation message. #### Response Example { "userId": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "message": "User created successfully." } ``` -------------------------------- ### Installation and Client Instantiation Source: https://docs.sentry.io/platforms/dotnet/guides/android/legacy-sdk Instructions on how to install the SharpRaven NuGet package and instantiate the RavenClient with your DSN. ```APIDOC ## Installation A [NuGet Package](https://www.nuget.org/packages/SharpRaven) is available for SharpRaven if you don’t want to compile it yourself. Instantiate the client with your DSN: ```csharp var ravenClient = new RavenClient("___PUBLIC_DSN___"); ``` ``` -------------------------------- ### SentrySdk.Init Configuration Example Source: https://docs.sentry.io/platforms/dotnet/guides/blazor-webassembly/configuration/options Example of initializing the Sentry SDK with various configuration options in Program.cs for a Blazor WebAssembly application. ```APIDOC ## POST /api/users ### Description Initializes the Sentry SDK with specified options. ### Method POST ### Endpoint /api/users ### Parameters #### Path Parameters - **userId** (string) - Required - The ID of the user to retrieve. #### Query Parameters - **includeDetails** (boolean) - Optional - Whether to include detailed user information. #### Request Body - **username** (string) - Required - The username for the new user. - **email** (string) - Required - The email address for the new user. ### Request Example ```json { "username": "johndoe", "email": "john.doe@example.com" } ``` ### Response #### Success Response (200) - **userId** (string) - The ID of the newly created user. - **status** (string) - The status of the user creation. #### Response Example ```json { "userId": "123e4567-e89b-12d3-a456-426614174000", "status": "created" } ``` ``` -------------------------------- ### Example of File I/O Tracing with Sentry Source: https://docs.sentry.io/platforms/dart/guides/flutter/integrations/file This example demonstrates initializing Sentry, wrapping a file with sentryTrace, performing file operations (create, write, read, delete), and viewing the recorded transaction on Sentry.io. Ensure Sentry is initialized and tracing is set up before executing. ```dart import 'package:sentry/sentry.dart'; import 'package:sentry_file/sentry_file.dart'; import 'dart:io'; Future main() async { await Sentry.init( (options) { options.dsn = 'https://example@sentry.io/example'; // To set a uniform sample rate options.tracesSampleRate = 1.0; }, appRunner: runApp, // Init your App. ); } Future runApp() async { final file = File('my_file.txt'); // Call the Sentry extension method to wrap up the File final sentryFile = file.sentryTrace(); // Start a transaction if there's no active transaction final transaction = Sentry.startTransaction( 'MyFileExample', 'file', bindToScope: true, ); // create the File await sentryFile.create(); // Write some content await sentryFile.writeAsString('Hello World'); // Read the content final text = await sentryFile.readAsString(); print(text); // Delete the file await sentryFile.delete(); // Finish the transaction await transaction.finish(status: SpanStatus.ok()); await Sentry.close(); } ``` -------------------------------- ### Falcon Application Setup Source: https://docs.sentry.io/platforms/python/integrations/falcon Example of a basic Falcon application setup with a route. This is used to demonstrate transaction_style options. ```python class MessageResource: def on_get(self, req, resp, message_id): msg = database.get_message(message_id) resp.media = msg.as_json() app = falcon.API() app.add_route("/message/{message_id}", MessageResource()) ``` -------------------------------- ### Initialize Unreal SDK Repository (Windows) Source: https://docs.sentry.io/platforms/unreal/install Run this script on Windows to initialize the Unreal SDK repository. It requires GitHub CLI to be installed. Check PowerShell version if errors occur. ```powershell ./scripts/init-win.ps1 ``` -------------------------------- ### Build and Install Excimer from Source Source: https://docs.sentry.io/platforms/php/guides/laravel/profiling Clone the Excimer repository, compile, and install the extension from source. ```bash git clone https://github.com/wikimedia/mediawiki-php-excimer.git cd excimer/ phpize && ./configure && make && sudo make install ``` -------------------------------- ### Initialize Unreal SDK Repository (macOS/Linux) Source: https://docs.sentry.io/platforms/unreal/install Run this script on macOS or Linux to initialize the Unreal SDK repository. It requires GitHub CLI to be installed. ```bash ./scripts/init.sh ``` -------------------------------- ### init Source: https://docs.sentry.io/platforms/javascript/guides/node/configuration/apis Initialize the SDK with the given options. See Options for the options you can pass to init. ```APIDOC ## init ### Description Initialize the SDK with the given options. ### Signature ```typescript function init(options: InitOptions): Client | undefined ``` ``` -------------------------------- ### Example Source Bundle Structure (Multi-module Project) Source: https://docs.sentry.io/platforms/android/source-context Illustrates the typical directory structure of a source bundle for a multi-module Java project like `sentry-java`. Note how module and source-set paths are stripped, and file extensions are normalized. ```bash bundle/ └── files └── _ └── ~ └── io └── sentry └── android ├── core │ ├── ANRWatchDog.jvm │ ├── ActivityLifecycleIntegration.jvm │ ├── AppLifecycleIntegration.jvm │ └── ... ├── distribution │ ├── DistributionHttpClient.jvm │ ├── DistributionIntegration.jvm │ └── UpdateResponseParser.jvm ├── fragment │ ├── FragmentLifecycleIntegration.jvm │ ├── FragmentLifecycleState.jvm │ └── SentryFragmentLifecycleCallbacks.jvm ├── navigation │ └── SentryNavigationListener.jvm └── ... ``` -------------------------------- ### Install Sentry SDK for Echo Source: https://docs.sentry.io/platforms/go/guides/echo Install the Sentry Go SDK and the Echo integration package using go get. ```bash go get github.com/getsentry/sentry-go go get github.com/getsentry/sentry-go/echo ``` -------------------------------- ### 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. Ensure you replace '___PUBLIC_DSN___' with your actual DSN. ```python import sentry_sdk sentry_sdk.init( dsn="___PUBLIC_DSN___", 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", ) ``` -------------------------------- ### Install Sentry with Next.js Wizard Source: https://docs.sentry.io/platforms/javascript/guides/nextjs/session-replay Use the Sentry wizard to install the SDK in your Next.js project. This command automates the initial setup. ```bash npx @sentry/wizard@latest -i nextjs ``` -------------------------------- ### Configure Zerolog with Sentry for Error Events and PII (Go) Source: https://docs.sentry.io/platforms/go/guides/fasthttp/logs/zerolog This example shows how to initialize Sentry with additional options like SendDefaultPII and Debug, and then configure Zerolog to use Sentry as a writer. It demonstrates logging different levels, with error and fatal events being sent to Sentry. It also includes a BeforeSend hook for event modification. ```go import ( "errors" "time" "os" "github.com/getsentry/sentry-go" sentryzerolog "github.com/getsentry/sentry-go/zerolog" "github.com/rs/zerolog" "github.com/rs/zerolog/log" ) func main() { // Initialize Sentry err := sentry.Init(sentry.ClientOptions{ Dsn: "___PUBLIC_DSN___", // Adds request headers and IP for users, // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info SendDefaultPII: true, BeforeSend: func(event *sentry.Event, hint *sentry.EventHint) *sentry.Event { // Modify or filter events before sending them to Sentry return event }, Debug: true, AttachStacktrace: true, }) if err != nil { log.Fatal().Err(err).Msg("sentry initialization failed") } defer sentry.Flush(2 * time.Second) // Configure Zerolog to use Sentry as a writer, // reusing the already existing client. sentryWriter, err := sentryzerolog.NewWithHub(sentry.CurrentHub(), sentryzerolog.Options{ Levels: []zerolog.Level{zerolog.ErrorLevel, zerolog.FatalLevel, zerolog.PanicLevel}, WithBreadcrumbs: true, FlushTimeout: 3 * time.Second, }) if err != nil { log.Fatal().Err(err).Msg("failed to create sentry writer") } defer sentryWriter.Close() // Use Sentry writer in Zerolog log.Logger = log.Output(zerolog.MultiLevelWriter(zerolog.ConsoleWriter{Out: os.Stderr}, sentryWriter)) // Log an InfoLevel entry to STDERR (not sent to Sentry) log.Info().Msg("Application has started") // Log an ErrorLevel entry to STDERR and send as error event to Sentry log.Error().Msg("oh no!") // Log a FatalLevel entry to STDERR, send as error event to Sentry, and terminate the application log.Fatal().Err(errors.New("can't continue")).Msg("fatal error occurred") } ``` -------------------------------- ### Install Sentry React Native SDK Source: https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup Install the Sentry React Native SDK using npm. This is the first step for manual setup. ```bash npm install @sentry/react-native --save ``` -------------------------------- ### Legacy SDK Installation Source: https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker/legacy-sdk Instantiate the RavenClient with your DSN to initialize the legacy SDK. ```APIDOC ## Legacy SDK Installation ### Description Instantiate the client with your DSN to initialize the legacy Sentry SDK for .NET. ### Method Not applicable (Code Example) ### Endpoint Not applicable ### Parameters Not applicable ### Request Example ```csharp var ravenClient = new RavenClient("___PUBLIC_DSN___"); ``` ### Response Not applicable ### Response Example Not applicable ``` -------------------------------- ### Sentry PHP SDK Initialization with Options Source: https://docs.sentry.io/platforms/php/configuration/options Demonstrates how to initialize the Sentry SDK in PHP by passing an array of configuration options to the init() function. ```APIDOC ## POST /api/users ### Description Initializes the Sentry SDK with provided configuration options. ### Method POST ### Endpoint /api/users ### Parameters #### Request Body - **dsn** (string) - Required - The DSN tells the SDK where to send the events. - **max_breadcrumbs** (int) - Optional - Controls the total amount of breadcrumbs that should be captured. Defaults to 100. - **logger** (\Psr\Log\LoggerInterface) - Optional - If enabled, the SDK prints out debug information. Not recommended for production. Defaults to null. - **release** (string) - Optional - Sets the release version for events. Can also be read from SENTRY_RELEASE environment variable. - **environment** (string) - Optional - Sets the environment for events. Defaults to 'production'. Can also be read from SENTRY_ENVIRONMENT environment variable. - **attach_stacktrace** (bool) - Optional - When enabled, stack traces are automatically attached to all messages logged. Defaults to false. ### Request Example ```json { "dsn": "___PUBLIC_DSN___", "max_breadcrumbs": 50, "release": "my-app@1.0.0", "environment": "staging", "attach_stacktrace": true } ``` ### Response #### Success Response (200) - **message** (string) - Indicates successful initialization. #### Response Example ```json { "message": "Sentry SDK initialized successfully." } ``` ``` -------------------------------- ### Start Development Server Source: https://docs.sentry.io/platforms/javascript/guides/nextjs Run this command to start your Next.js development server. This is necessary to visit the example page and test Sentry integration. ```bash npm run dev ```