Skip to content

Commit

Permalink
Merge branch 'main' into fix/sqlclient-firstspan-lost
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-zimerman committed Sep 8, 2021
2 parents bdd03cd + 38bd5e2 commit af93c89
Show file tree
Hide file tree
Showing 91 changed files with 142 additions and 204 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
using Sentry.Protocol;

namespace Sentry.Benchmarks
{
Expand Down
2 changes: 1 addition & 1 deletion samples/Sentry.Samples.AspNetCore.Blazor.Wasm/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static async Task Main(string[] args)
// Captures logError and higher as events
builder.Logging.AddSentry(o => o.InitializeSdk = false);

builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddScoped(_ => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });

await builder.Build().RunAsync();
}
Expand Down
1 change: 0 additions & 1 deletion samples/Sentry.Samples.AspNetCore.Grpc/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Extensions.DependencyInjection;
using Sentry.AspNetCore;
using Sentry.AspNetCore.Grpc;

Expand Down
1 change: 0 additions & 1 deletion samples/Sentry.Samples.AspNetCore.Mvc/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Net;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Sentry;

namespace Samples.AspNetCore.Mvc
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Sentry;
using Sentry.Extensibility;
using Sentry.Protocol;

namespace Samples.AspNetCore.Mvc
{
Expand Down
2 changes: 1 addition & 1 deletion samples/Sentry.Samples.AspNetCore.Serilog/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class Program
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)

.UseSerilog((h, c) =>
.UseSerilog((_, c) =>
c.Enrich.FromLogContext()
.MinimumLevel.Debug()
.WriteTo.Console()
Expand Down
3 changes: 1 addition & 2 deletions samples/Sentry.Samples.Console.Customized/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Xml.Xsl;
using Sentry;
using Sentry.Extensibility;
using Sentry.Protocol;

// One of the ways to set your DSN is via an attribute:
// It could be set via AssemblyInfo.cs and patched via CI.
Expand Down Expand Up @@ -98,7 +97,7 @@ await SentrySdk.ConfigureScopeAsync(async scope =>
// Example customizing the HttpClientHandlers created
o.CreateHttpClientHandler = () => new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (sender, certificate, chain, sslPolicyErrors) =>
ServerCertificateCustomValidationCallback = (_, certificate, _, _) =>
!certificate.Archived
};
Expand Down
2 changes: 0 additions & 2 deletions samples/Sentry.Samples.EntityFramework/Program.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.Configuration;
using System.Data.Common;
using System.Data.Entity;
using Sentry;
using Sentry.EntityFramework;

var _ = SentrySdk.Init(o =>
{
Expand Down
2 changes: 1 addition & 1 deletion samples/Sentry.Samples.GenericHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static Task Main()
c.SetBasePath(Directory.GetCurrentDirectory());
c.AddJsonFile("appsettings.json", optional: false);
})
.ConfigureServices((c, s) => { s.AddHostedService<SampleHostedService>(); })
.ConfigureServices((_, s) => { s.AddHostedService<SampleHostedService>(); })
.ConfigureLogging((c, l) =>
{
l.AddConfiguration(c.Configuration);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Security.Claims;
using System.Web;
using Sentry.Extensibility;
Expand Down
1 change: 0 additions & 1 deletion src/Sentry.AspNet/SentryAspNetOptionsExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Web;
using Sentry.AspNet.Internal;
using Sentry.Extensibility;
Expand Down
1 change: 0 additions & 1 deletion src/Sentry.AspNetCore.Grpc/SentryBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using Sentry.Extensibility;
using Sentry.Protocol;
using Sentry.Reflection;

namespace Sentry.AspNetCore.Grpc
Expand Down
1 change: 0 additions & 1 deletion src/Sentry.AspNetCore/DefaultUserFactory.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Security.Claims;
using Microsoft.AspNetCore.Http;
using Sentry.Protocol;

namespace Sentry.AspNetCore
{
Expand Down
1 change: 0 additions & 1 deletion src/Sentry.AspNetCore/IUserFactory.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Http;
using Sentry.Protocol;

namespace Sentry.AspNetCore
{
Expand Down
1 change: 0 additions & 1 deletion src/Sentry.AspNetCore/ScopeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using Microsoft.Net.Http.Headers;
using Sentry.AspNetCore.Extensions;
using Sentry.Extensibility;
using Sentry.Protocol;

namespace Sentry.AspNetCore
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void OnNext(KeyValuePair<string, object?> value)
/// </summary>
/// <example>
/// Compiling query model:
/// EF intialize...\r\nEF Query...
/// EF initialize...\r\nEF Query...
/// becomes:
/// EF Query...
/// </example>
Expand Down
1 change: 0 additions & 1 deletion src/Sentry.Extensions.Logging/LogLevelExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.Extensions.Logging;
using Sentry.Protocol;

namespace Sentry.Extensions.Logging
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Sentry.Extensibility;
using Sentry.Extensions.Logging;
using Sentry.Infrastructure;
using Sentry.Internal;

// ReSharper disable once CheckNamespace
// Ensures 'AddSentry' can be found without: 'using Sentry;'
Expand Down
1 change: 0 additions & 1 deletion src/Sentry.Extensions.Logging/SentryLoggerProvider.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Diagnostics;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Sentry.Infrastructure;
Expand Down
1 change: 0 additions & 1 deletion src/Sentry.Extensions.Logging/SentryLoggingOptions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Linq;
using Microsoft.Extensions.Logging;
using Sentry.Protocol;

namespace Sentry.Extensions.Logging
{
Expand Down
1 change: 0 additions & 1 deletion src/Sentry.Log4Net/SentryAppender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using log4net.Appender;
using log4net.Core;
using Sentry.Extensibility;
using Sentry.Protocol;
using Sentry.Reflection;

namespace Sentry.Log4Net
Expand Down
2 changes: 0 additions & 2 deletions src/Sentry.NLog/LogLevelExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using NLog;

using Sentry.Protocol;

namespace Sentry.NLog
{
internal static class LogLevelExtensions
Expand Down
1 change: 0 additions & 1 deletion src/Sentry.NLog/SentryTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

using Sentry.Extensibility;
using Sentry.Infrastructure;
using Sentry.Protocol;
using Sentry.Reflection;

namespace Sentry.NLog
Expand Down
1 change: 0 additions & 1 deletion src/Sentry.Serilog/LogLevelExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Sentry.Protocol;
using Serilog.Events;

namespace Sentry.Serilog
Expand Down
1 change: 0 additions & 1 deletion src/Sentry.Serilog/SentrySerilogOptions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Sentry.Protocol;
using Serilog.Events;
using Serilog.Formatting;

Expand Down
2 changes: 0 additions & 2 deletions src/Sentry.Serilog/SentrySink.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Sentry.Extensibility;
using Sentry.Infrastructure;
using Sentry.Protocol;
using Sentry.Reflection;
using Serilog.Core;
using Serilog.Events;
Expand Down
1 change: 0 additions & 1 deletion src/Sentry.Tunnel/SentryTunnelMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Net.Http.Headers;

namespace Sentry.Tunnel
{
Expand Down
2 changes: 0 additions & 2 deletions src/Sentry/IScopeObserver.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System.Collections.Generic;

namespace Sentry
{
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry/ISentryClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public interface ISentryClient
/// </summary>
/// <remarks>
/// Note: this method is NOT meant to be called from user code!
/// Instead, call <see cref="ISpan.Finish(Sentry.SpanStatus)"/> on the transaction.
/// Instead, call <see cref="ISpan.Finish(SpanStatus)"/> on the transaction.
/// </remarks>
/// <param name="transaction">The transaction.</param>
void CaptureTransaction(Transaction transaction);
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry/Infrastructure/SystemClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Sentry.Infrastructure
/// <summary>
/// Implementation of <see cref="ISystemClock"/> to help testability.
/// </summary>
/// <seealso cref="Sentry.Infrastructure.ISystemClock" />
/// <seealso cref="ISystemClock" />
public sealed class SystemClock : ISystemClock
{
/// <summary>
Expand Down
1 change: 0 additions & 1 deletion src/Sentry/Infrastructure/TraceDiagnosticLogger.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Sentry.Extensibility;
namespace Sentry.Infrastructure
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Runtime.ExceptionServices;
using System.Security;
using System.Threading.Tasks;
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry/Internal/Hub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public SentryId CaptureEvent(SentryEvent evt, Scope? scope = null)

actualScope.SessionUpdate = evt switch
{
// TODO: Extract both braches as internal extension methods (IsCrashed and IsErrored):
// TODO: Extract both branches as internal extension methods (IsCrashed and IsErrored):

// Event contains a terminal exception -> end session as crashed
var e when e.SentryExceptions?.Any(x => !(x.Mechanism?.Handled ?? true)) ?? false =>
Expand Down
2 changes: 0 additions & 2 deletions src/Sentry/Internal/ProcessInfo.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Sentry.Extensibility;
using Sentry.PlatformAbstractions;

namespace Sentry.Internal
{
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry/PlatformAbstractions/RuntimeInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ internal static void SetNetCoreVersion(Runtime runtime)

internal static Runtime? GetFromRuntimeInformation()
{
// Prefered API: netstandard2.0
// Preferred API: netstandard2.0
// https://github.com/dotnet/corefx/blob/master/src/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/RuntimeInformation.cs
// https://github.com/mono/mono/blob/90b49aa3aebb594e0409341f9dca63b74f9df52e/mcs/class/corlib/System.Runtime.InteropServices.RuntimeInformation/RuntimeInformation.cs
// e.g: .NET Framework 4.7.2633.0, .NET Native, WebAssembly
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry/Scope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public Contexts Contexts
}

// Internal for testing.
internal Action<User?> UserChanged => (user) =>
internal Action<User?> UserChanged => user =>
{
if (Options.EnableScopeSync &&
Options.ScopeObserver is { } observer)
Expand Down
1 change: 0 additions & 1 deletion src/Sentry/Span.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Sentry.Internal.Extensions;

Expand Down
9 changes: 9 additions & 0 deletions test/Sentry.AspNet.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Test project")]
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#if NET5_0 || NETCOREAPP3_1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using FluentAssertions;
using Microsoft.AspNetCore.Builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public async Task Transaction_binds_exception_thrown()
.Configure(app =>
{
app.UseRouting();
app.Use(async (r, c) =>
app.Use(async (_, c) =>
{
try
{
Expand Down
Loading

0 comments on commit af93c89

Please sign in to comment.