From 4b358364e8e3858cf0a6a95696b44c06c70c699d Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 19 Dec 2021 12:04:47 +0100 Subject: [PATCH] Remove metrics. --- backend/.editorconfig | 3 +++ .../src/Squidex.Infrastructure/Orleans/J{T}.cs | 18 ++++-------------- .../Assets/AssetContentController.cs | 2 -- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/backend/.editorconfig b/backend/.editorconfig index 5bfe47788..87e22c7d4 100644 --- a/backend/.editorconfig +++ b/backend/.editorconfig @@ -22,6 +22,9 @@ dotnet_diagnostic.SA1649.severity = none # CA1707: Identifiers should not contain underscores dotnet_diagnostic.CA1707.severity = none +# CA2016: Forward the 'CancellationToken' parameter to methods +dotnet_diagnostic.CA2016.severity = none + # CS8618: Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. dotnet_diagnostic.CS8618.severity = none diff --git a/backend/src/Squidex.Infrastructure/Orleans/J{T}.cs b/backend/src/Squidex.Infrastructure/Orleans/J{T}.cs index 389ac3d99..26bbe9214 100644 --- a/backend/src/Squidex.Infrastructure/Orleans/J{T}.cs +++ b/backend/src/Squidex.Infrastructure/Orleans/J{T}.cs @@ -54,27 +54,17 @@ namespace Squidex.Infrastructure.Orleans [SerializerMethod] public static void Serialize(object? input, ISerializationContext context, Type? expected) { - using (Telemetry.Activities.StartActivity("JsonSerializer/Serialize")) - { - var jsonSerializer = GetSerializer(context); - - var stream = new StreamWriterWrapper(context.StreamWriter); + var stream = new StreamWriterWrapper(context.StreamWriter); - jsonSerializer.Serialize(input, stream); - } + GetSerializer(context).Serialize(input, stream); } [DeserializerMethod] public static object? Deserialize(Type expected, IDeserializationContext context) { - using (Telemetry.Activities.StartActivity("JsonSerializer/Deserialize")) - { - var jsonSerializer = GetSerializer(context); - - var stream = new StreamReaderWrapper(context.StreamReader); + var stream = new StreamReaderWrapper(context.StreamReader); - return jsonSerializer.Deserialize(stream, expected); - } + return GetSerializer(context).Deserialize(stream, expected); } private static IJsonSerializer GetSerializer(ISerializerContext context) diff --git a/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetContentController.cs b/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetContentController.cs index f2f5627da..347d54652 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetContentController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetContentController.cs @@ -203,7 +203,6 @@ namespace Squidex.Areas.Api.Controllers.Assets private async Task ResizeAsync(IAssetEntity asset, string suffix, Stream target, ResizeOptions resizeOptions, bool overwrite, CancellationToken ct) { -#pragma warning disable CA2016 // Forward the 'CancellationToken' parameter to methods #pragma warning disable MA0040 // Flow the cancellation token using var activity = Telemetry.Activities.StartActivity("Resize"); @@ -264,7 +263,6 @@ namespace Squidex.Areas.Api.Controllers.Assets await resizeStream.CopyToAsync(target, ct); } } -#pragma warning restore CA2016 // Forward the 'CancellationToken' parameter to methods #pragma warning restore MA0040 // Flow the cancellation token } }