Skip to content

Is Queries and Performance Monitoring supported on .NET Framework 4.7.2 and Entity Framework 6.4.0? #3836

@edgariscoding

Description

@edgariscoding

I can't seem to get this to work, I thought it was automatically configured.

Using packages Sentry, Sentry.AspNet, Sentry.DiagnosticSource, and Sentry.EntityFramework v4.13.0

This is my Global.asax.cs file:

using System;
using System.Web.Http;

using Sentry;
using Sentry.AspNet;
using Sentry.Extensibility;

using Picsoft.Common;

namespace MyApp.API
{
    public class WebApiApplication : System.Web.HttpApplication
    {
        private IDisposable _sentry;

        protected void Application_Start()
        {
            // Initialize Sentry to capture AppDomain unhandled exceptions and more.
            _sentry = SentrySdk.Init(o =>
            {
                // DSN for CiraNet API Sentry project
                o.Dsn = ConfigurationHelper.SentryDsn;

                // Sets the release version in Sentry, for local developments this will default to 0.0.0.0
                o.Release = ConfigurationHelper.ReleaseVersion;

                // Sets the current environment in Sentry
                o.Environment = Platform.IsWebServer() ? ConfigurationHelper.Environment : "Local";

                // Automatically captures HTTP client errors, like bad response codes, as error events and reports them to Sentry
                o.CaptureFailedRequests = true;

                // Opt-in to send things like UserId and UserName if a user is logged-in
                o.SendDefaultPii = true;

                // Sample rate for your traced transactions: Captures 100% of transactions if not defined in appSettings
                o.TracesSampleRate = ConfigurationHelper.SentryTracesSampleRate;

                // If you also installed the Sentry.EntityFramework package
                o.AddEntityFramework();

                // RequestSize.Always sends the request body to Sentry
                o.AddAspNet(RequestSize.Always);
            });

            GlobalConfiguration.Configure(WebApiConfig.Register);
        }

        // Global error catcher
        protected void Application_Error()
        {
            Server.CaptureLastError();
        }

        protected void Application_BeginRequest()
        {
            Context.StartOrContinueTrace();
        }

        protected void Application_EndRequest()
        {
            Context.FinishSentryTransaction();
        }

        protected void Application_End()
        {
            // Flushes out events before shutting down.
            _sentry?.Dispose();
        }
    }
}

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    Status

    Done

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions