From d74c812c0cd47cefc85c6997f1ec751396ff2687 Mon Sep 17 00:00:00 2001 From: Aga Date: Thu, 1 Aug 2024 18:24:06 +0200 Subject: [PATCH] chore: remove sentry plugin (#6242) * chore: remove sentry plugin * chore: remove circle CI config for sentry * Removed sentry from test bash scripts --- .circleci/config.yml | 3 +- ci-benchmark.sh | 2 - ci-editmode-test.sh | 3 - ci-playmode-test.sh | 3 - ci-setup.sh | 6 -- convert-asset-bundles.sh | 2 - scripts/package.json | 1 - scripts/src/inject-sentry-params.ts | 76 --------------- .../Assets/DCLPlugins/SentryPlugin.meta | 8 -- .../DCL.Plugins.SentryPlugin.asmdef | 20 ---- .../DCL.Plugins.SentryPlugin.asmdef.meta | 7 -- .../SentryPlugin/SentryController.cs | 94 ------------------- .../SentryPlugin/SentryController.cs.meta | 3 - .../DCLPlugins/SentryPlugin/SentryPlugin.cs | 38 -------- .../SentryPlugin/SentryPlugin.cs.meta | 11 --- .../Assets/DCLPlugins/SentryPlugin/Tests.meta | 3 - .../DCL.Plugins.SentryPlugin.Tests.asmdef | 25 ----- ...DCL.Plugins.SentryPlugin.Tests.asmdef.meta | 3 - .../Tests/SentryControllerTests.cs | 90 ------------------ .../Tests/SentryControllerTests.cs.meta | 3 - .../DCLServices/Lambdas/LambdasService.cs | 22 ++--- .../Lambdas/Tests/LambdasServiceShould.cs | 18 +--- unity-renderer/Assets/Plugins/Sentry.meta | 8 -- .../SentryBuildtimeOptionsConfiguration.asset | 14 --- ...ryBuildtimeOptionsConfiguration.asset.meta | 8 -- .../Plugins/Sentry/SentryCliOptions.asset | 21 ----- .../Sentry/SentryCliOptions.asset.meta | 8 -- unity-renderer/Assets/Resources/Sentry.meta | 8 -- .../Resources/Sentry/SentryOptions.asset | 72 -------------- .../Resources/Sentry/SentryOptions.asset.meta | 8 -- .../PluginSystem/PluginSystemFactory.cs | 2 - .../ServiceLocatorFactory.cs | 2 - .../ServiceLocatorTestFactory.cs | 9 -- .../MainScripts/DCL/Helpers/SentryUtils.meta | 3 - .../SentryUtils/DisposableTransaction.cs | 29 ------ .../SentryUtils/DisposableTransaction.cs.meta | 3 - .../Helpers/SentryUtils/IWebRequestMonitor.cs | 18 ---- .../SentryUtils/IWebRequestMonitor.cs.meta | 3 - .../Helpers/SentryUtils/SentryUtils.asmdef | 4 - .../SentryUtils/SentryUtils.asmdef.meta | 3 - .../SentryUtils/SentryWebRequestMonitor.cs | 81 ---------------- .../SentryWebRequestMonitor.cs.meta | 3 - unity-renderer/Packages/manifest.json | 1 - unity-renderer/Packages/packages-lock.json | 7 -- 44 files changed, 10 insertions(+), 746 deletions(-) delete mode 100644 scripts/src/inject-sentry-params.ts delete mode 100644 unity-renderer/Assets/DCLPlugins/SentryPlugin.meta delete mode 100644 unity-renderer/Assets/DCLPlugins/SentryPlugin/DCL.Plugins.SentryPlugin.asmdef delete mode 100644 unity-renderer/Assets/DCLPlugins/SentryPlugin/DCL.Plugins.SentryPlugin.asmdef.meta delete mode 100644 unity-renderer/Assets/DCLPlugins/SentryPlugin/SentryController.cs delete mode 100644 unity-renderer/Assets/DCLPlugins/SentryPlugin/SentryController.cs.meta delete mode 100644 unity-renderer/Assets/DCLPlugins/SentryPlugin/SentryPlugin.cs delete mode 100644 unity-renderer/Assets/DCLPlugins/SentryPlugin/SentryPlugin.cs.meta delete mode 100644 unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests.meta delete mode 100644 unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests/DCL.Plugins.SentryPlugin.Tests.asmdef delete mode 100644 unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests/DCL.Plugins.SentryPlugin.Tests.asmdef.meta delete mode 100644 unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests/SentryControllerTests.cs delete mode 100644 unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests/SentryControllerTests.cs.meta delete mode 100644 unity-renderer/Assets/Plugins/Sentry.meta delete mode 100644 unity-renderer/Assets/Plugins/Sentry/SentryBuildtimeOptionsConfiguration.asset delete mode 100644 unity-renderer/Assets/Plugins/Sentry/SentryBuildtimeOptionsConfiguration.asset.meta delete mode 100644 unity-renderer/Assets/Plugins/Sentry/SentryCliOptions.asset delete mode 100644 unity-renderer/Assets/Plugins/Sentry/SentryCliOptions.asset.meta delete mode 100644 unity-renderer/Assets/Resources/Sentry.meta delete mode 100644 unity-renderer/Assets/Resources/Sentry/SentryOptions.asset delete mode 100644 unity-renderer/Assets/Resources/Sentry/SentryOptions.asset.meta delete mode 100644 unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils.meta delete mode 100644 unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/DisposableTransaction.cs delete mode 100644 unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/DisposableTransaction.cs.meta delete mode 100644 unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/IWebRequestMonitor.cs delete mode 100644 unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/IWebRequestMonitor.cs.meta delete mode 100644 unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/SentryUtils.asmdef delete mode 100644 unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/SentryUtils.asmdef.meta delete mode 100644 unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/SentryWebRequestMonitor.cs delete mode 100644 unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/SentryWebRequestMonitor.cs.meta diff --git a/.circleci/config.yml b/.circleci/config.yml index e7c2bd588e..e3acb59751 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -228,11 +228,10 @@ jobs: sudo apt-get install -y jq - checkout - run: - name: Update sentry params and Components and Renderer Protocol code generation + name: Update Components and Renderer Protocol code generation command: | cd scripts npm install - npm run inject-sentry-params npm run build-protocol # persist to workspace to use in downstream jobs diff --git a/ci-benchmark.sh b/ci-benchmark.sh index 33f85d3302..c30dbeefcd 100644 --- a/ci-benchmark.sh +++ b/ci-benchmark.sh @@ -4,8 +4,6 @@ source ci-setup.sh echo "Running benchmark tests for $PROJECT_PATH" -disable_sentry - xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' $UNITY_PATH/Editor/Unity \ -batchmode \ -projectPath "$PROJECT_PATH" \ diff --git a/ci-editmode-test.sh b/ci-editmode-test.sh index c85aae3bce..8bb5621b4b 100755 --- a/ci-editmode-test.sh +++ b/ci-editmode-test.sh @@ -4,9 +4,6 @@ source ci-setup.sh echo "Running editmode tests for $PROJECT_PATH" -# Disable Sentry -disable_sentry - xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' $UNITY_PATH/Editor/Unity \ -batchmode \ -projectPath "$PROJECT_PATH" \ diff --git a/ci-playmode-test.sh b/ci-playmode-test.sh index acc6430e45..5857d6f54b 100755 --- a/ci-playmode-test.sh +++ b/ci-playmode-test.sh @@ -4,9 +4,6 @@ source ci-setup.sh echo "Running playmode tests for $PROJECT_PATH" -# Disable Sentry -disable_sentry - xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' $UNITY_PATH/Editor/Unity \ -batchmode \ -projectPath "$PROJECT_PATH" \ diff --git a/ci-setup.sh b/ci-setup.sh index 6f4fdac09a..17ed36ee4e 100755 --- a/ci-setup.sh +++ b/ci-setup.sh @@ -1,11 +1,5 @@ #!/usr/bin/env bash -function disable_sentry() -{ - # Disable Sentry - sed -i 's/k__BackingField: 1/k__BackingField: 0/' unity-renderer/Assets/Resources/Sentry/SentryOptions.asset -} - export PROJECT_PATH PROJECT_PATH="$(pwd)/unity-renderer" diff --git a/convert-asset-bundles.sh b/convert-asset-bundles.sh index def3288696..3e05a2db16 100755 --- a/convert-asset-bundles.sh +++ b/convert-asset-bundles.sh @@ -10,8 +10,6 @@ mkdir -p "$OUTPUT_DIR" echo "Running AB conversor for sceneId $SCENE_ID at $CONTENT_URL > $OUTPUT_DIR" echo "Project path: $PROJECT_PATH" -disable_sentry - xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' "$UNITY_PATH/Editor/Unity" \ -batchmode \ -projectPath "$PROJECT_PATH" \ diff --git a/scripts/package.json b/scripts/package.json index 662dd18886..f5b417ca55 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -3,7 +3,6 @@ "version": "1.0.0", "description": "", "scripts": { - "inject-sentry-params": "ts-node --project src/tsconfig.json src/inject-sentry-params.ts", "build-protocol": "ts-node --project src/tsconfig.json src/build-protocol.ts" }, "private": true, diff --git a/scripts/src/inject-sentry-params.ts b/scripts/src/inject-sentry-params.ts deleted file mode 100644 index 224a999933..0000000000 --- a/scripts/src/inject-sentry-params.ts +++ /dev/null @@ -1,76 +0,0 @@ -import * as fs from 'node:fs' - -async function main() { - if (!process.env.CIRCLE_BRANCH) throw new Error('env var CIRCLE_BRANCH not set!') - if (!process.env.CIRCLE_SHA1) throw new Error('env var CIRCLE_SHA1 not set!') - if (!process.env.SENTRY_DSN) throw new Error('env var SENTRY_DSN not set!') - if (!process.env.SENTRY_AUTH_TOKEN) throw new Error('env var SENTRY_AUTH not set!') - - // Inject sentry environment parameters - - const fileToEdit = - '../unity-renderer/Assets/Resources/Sentry/SentryOptions.asset' - const fileContents = fs.readFileSync(fileToEdit).toString() - - let rendererEnvironment = 'editor' - - if (process.env.CIRCLE_BRANCH == 'main') { - rendererEnvironment = 'production' - } else if (process.env.CIRCLE_BRANCH == 'dev') { - rendererEnvironment = 'development' - } else { - rendererEnvironment = `branch` - } - - const searchParams = { - dsn: 'https://dsn.dsn/', - env: '', - release: '', - } - - for (const key in searchParams) { - const value = (searchParams as any)[key] - if (!fileContents.includes(value)) - throw new Error( - `the file ${fileToEdit} does not contain any ${value} string to replace`, - ) - } - - fs.writeFileSync( - fileToEdit, - fileContents - .replace(searchParams.dsn, process.env.SENTRY_DSN) - .replace(searchParams.env, rendererEnvironment) - .replace(searchParams.release, process.env.CIRCLE_SHA1) - ) - - // Inject CLI parameters for sources/symbols - const cliSearchParams = { - auth: '', - } - - const cliFileToEdit = - '../unity-renderer/Assets/Plugins/Sentry/SentryCliOptions.asset' - const cliFileContents = fs.readFileSync(cliFileToEdit).toString() - - for (const key in cliSearchParams) { - const value = (cliSearchParams as any)[key] - if (!cliFileContents.includes(value)) - throw new Error( - `the file ${cliFileToEdit} does not contain any ${value} string to replace`, - ) - } - - fs.writeFileSync( - cliFileToEdit, - cliFileContents.replace( - cliSearchParams.auth, - process.env.SENTRY_AUTH_TOKEN, - ), - ) -} - -main().catch((err) => { - console.error(err) - process.exit(1) -}) diff --git a/unity-renderer/Assets/DCLPlugins/SentryPlugin.meta b/unity-renderer/Assets/DCLPlugins/SentryPlugin.meta deleted file mode 100644 index c8705e0ce8..0000000000 --- a/unity-renderer/Assets/DCLPlugins/SentryPlugin.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d62c3e5fb017a5c4ca9384fbc3b6a50e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/unity-renderer/Assets/DCLPlugins/SentryPlugin/DCL.Plugins.SentryPlugin.asmdef b/unity-renderer/Assets/DCLPlugins/SentryPlugin/DCL.Plugins.SentryPlugin.asmdef deleted file mode 100644 index 8122612f87..0000000000 --- a/unity-renderer/Assets/DCLPlugins/SentryPlugin/DCL.Plugins.SentryPlugin.asmdef +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "DCL.Plugins.SentryPlugin", - "rootNamespace": "", - "references": [ - "GUID:1e6b57fe78f7b724e9567f29f6a40c2c", - "GUID:28f74c468a54948bfa9f625c5d428f56", - "GUID:7fe146b43e76fe745aeaf2020feb54b7", - "GUID:c34e38f41494f834abff029ddf82af43", - "GUID:1de3566cccb280f4a982c59ad0d08c96" - ], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/unity-renderer/Assets/DCLPlugins/SentryPlugin/DCL.Plugins.SentryPlugin.asmdef.meta b/unity-renderer/Assets/DCLPlugins/SentryPlugin/DCL.Plugins.SentryPlugin.asmdef.meta deleted file mode 100644 index fc1853aff3..0000000000 --- a/unity-renderer/Assets/DCLPlugins/SentryPlugin/DCL.Plugins.SentryPlugin.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 203a48519aead80408325875c74b7401 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/unity-renderer/Assets/DCLPlugins/SentryPlugin/SentryController.cs b/unity-renderer/Assets/DCLPlugins/SentryPlugin/SentryController.cs deleted file mode 100644 index 16a56fad1d..0000000000 --- a/unity-renderer/Assets/DCLPlugins/SentryPlugin/SentryController.cs +++ /dev/null @@ -1,94 +0,0 @@ -using DCL; -using Sentry; -using System; -using UnityEngine; - -namespace DCLPlugins.SentryPlugin -{ - public class SentryController : IDisposable - { - private readonly DataStore_Player playerStore; - private readonly DataStore_Realm realmStore; - private readonly IHub sentryHub; - private static string prefix = "explorer."; - private Vector3 currentTeleportPosition, previousTeleportPosition; - - public SentryController(DataStore_Player playerStore, DataStore_Realm realmStore, IHub sentryHub) - { - this.playerStore = playerStore; - this.realmStore = realmStore; - this.sentryHub = sentryHub; - - this.playerStore.playerGridPosition.OnChange += PlayerGridPositionOnOnChange; - this.playerStore.otherPlayers.OnAdded += OtherPlayersOnChanged; - this.playerStore.otherPlayers.OnRemoved += OtherPlayersOnChanged; - this.playerStore.lastTeleportPosition.OnChange += LastTeleportPositionOnOnChange; - this.realmStore.realmName.OnChange += RealmNameOnOnChange; - UserProfile.GetOwnUserProfile().OnUpdate += OnOnUpdate; - } - - private void OnOnUpdate(UserProfile userProfile) - { - if (userProfile == null) return; - sentryHub.ConfigureScope(scope => - { - scope.SetTag($"{prefix}wallet_address", $"{userProfile.userId}"); - scope.SetTag($"{prefix}is_guest", $"{userProfile.isGuest}"); - }); - } - - private void RealmNameOnOnChange(string current, string previous) - { - if (current == previous) return; - sentryHub.ConfigureScope(scope => - { - scope.SetTag($"{prefix}current_realm", current); - scope.SetTag($"{prefix}previous_realm", previous); - }); - } - - private void LastTeleportPositionOnOnChange(Vector3 current, Vector3 previous) - { - currentTeleportPosition = current; - previousTeleportPosition = previous; - UpdatePlayerContext(); - } - - private void OtherPlayersOnChanged(string _, Player __) - { - UpdatePlayerContext(); - } - - private void UpdatePlayerContext() - { - sentryHub.ConfigureScope(scope => - { - scope.Contexts[$"{prefix}teleport"] = new - { - current_teleport_position = $"{currentTeleportPosition.x},{currentTeleportPosition.y}", - previous_teleport_position = $"{previousTeleportPosition.x},{previousTeleportPosition.y}", - total_other_players = this.playerStore.otherPlayers.Count(), - }; - }); - } - - private void PlayerGridPositionOnOnChange(Vector2Int current, Vector2Int previous) - { - if (current == previous) return; - sentryHub.ConfigureScope(scope => - { - scope.SetTag($"{prefix}current_position", $"{current.x},{current.y}"); - scope.SetTag($"{prefix}previous_position", $"{previous.x},{previous.y}"); - }); - } - - public void Dispose() - { - playerStore.playerGridPosition.OnChange -= PlayerGridPositionOnOnChange; - playerStore.otherPlayers.OnAdded -= OtherPlayersOnChanged; - playerStore.otherPlayers.OnRemoved -= OtherPlayersOnChanged; - playerStore.lastTeleportPosition.OnChange -= LastTeleportPositionOnOnChange; - realmStore.realmName.OnChange -= RealmNameOnOnChange; - } - } -} diff --git a/unity-renderer/Assets/DCLPlugins/SentryPlugin/SentryController.cs.meta b/unity-renderer/Assets/DCLPlugins/SentryPlugin/SentryController.cs.meta deleted file mode 100644 index 65f817ce91..0000000000 --- a/unity-renderer/Assets/DCLPlugins/SentryPlugin/SentryController.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f2099d2d7d3641f5be376768bc810fd2 -timeCreated: 1674221571 \ No newline at end of file diff --git a/unity-renderer/Assets/DCLPlugins/SentryPlugin/SentryPlugin.cs b/unity-renderer/Assets/DCLPlugins/SentryPlugin/SentryPlugin.cs deleted file mode 100644 index d050ceed96..0000000000 --- a/unity-renderer/Assets/DCLPlugins/SentryPlugin/SentryPlugin.cs +++ /dev/null @@ -1,38 +0,0 @@ -using DCL; -using Sentry; -using Sentry.Extensibility; -using System; -using System.Reflection; -using UnityEngine; - -namespace DCLPlugins.SentryPlugin -{ - public class SentryPlugin : IPlugin - { - private readonly SentryController controller; - - public SentryPlugin() - { - /* - // Sentry doesn't provide a public getter accessor to its instance - // So we unfortunately need a bit of magic - Type type = typeof(SentrySdk); - FieldInfo info = type.GetField("CurrentHub", BindingFlags.NonPublic | BindingFlags.Static); - if (info == null) - { - Debug.LogError("SentrySdk field could not be reflected. Sentry will not be initialized."); - return; - } - - controller = new SentryController(DataStore.i.player, DataStore.i.realm, info.GetValue(null) as IHub); - */ - } - - public void Dispose() - { - /* - controller?.Dispose(); - */ - } - } -} diff --git a/unity-renderer/Assets/DCLPlugins/SentryPlugin/SentryPlugin.cs.meta b/unity-renderer/Assets/DCLPlugins/SentryPlugin/SentryPlugin.cs.meta deleted file mode 100644 index b961093192..0000000000 --- a/unity-renderer/Assets/DCLPlugins/SentryPlugin/SentryPlugin.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f9e4b0ea851b2fc4dab0cc0ac45e37cf -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests.meta b/unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests.meta deleted file mode 100644 index 6577154dbb..0000000000 --- a/unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: dbb28f0dc0964210b17b12639e463a8c -timeCreated: 1674223769 \ No newline at end of file diff --git a/unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests/DCL.Plugins.SentryPlugin.Tests.asmdef b/unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests/DCL.Plugins.SentryPlugin.Tests.asmdef deleted file mode 100644 index bacae9a216..0000000000 --- a/unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests/DCL.Plugins.SentryPlugin.Tests.asmdef +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "DCL.Plugins.SentryPlugin.Tests", - "rootNamespace": "", - "references": [ - "GUID:28f74c468a54948bfa9f625c5d428f56", - "GUID:c34e38f41494f834abff029ddf82af43", - "GUID:203a48519aead80408325875c74b7401", - "GUID:1e6b57fe78f7b724e9567f29f6a40c2c" - ], - "includePlatforms": [ - "Editor" - ], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": true, - "precompiledReferences": [ - "NSubstitute.dll", - "Sentry.Unity.dll", - "Sentry.dll" - ], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests/DCL.Plugins.SentryPlugin.Tests.asmdef.meta b/unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests/DCL.Plugins.SentryPlugin.Tests.asmdef.meta deleted file mode 100644 index 6bd22398c3..0000000000 --- a/unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests/DCL.Plugins.SentryPlugin.Tests.asmdef.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 062e3aa16896463494fbe0c3526c7c7e -timeCreated: 1674223787 \ No newline at end of file diff --git a/unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests/SentryControllerTests.cs b/unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests/SentryControllerTests.cs deleted file mode 100644 index cfe1ddd332..0000000000 --- a/unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests/SentryControllerTests.cs +++ /dev/null @@ -1,90 +0,0 @@ -using DCL; -using NSubstitute; -using NUnit.Framework; -using Sentry; -using Sentry.Unity; -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace DCLPlugins.SentryPlugin.Tests -{ - [Category("ToFix")] - public class SentryControllerTests - { - private DataStore_Player playerDataStore; - private DataStore_Realm realmDataStore; - private Scope capturedScope; - - [SetUp] - public void SetUp() - { - // Arrange - var sentryHubMock = Substitute.For(); - capturedScope = new Scope(new SentryUnityOptions()); - sentryHubMock.ConfigureScope(Arg.Do>(x => { x(capturedScope); })); - - this.playerDataStore = new DataStore_Player(); - this.realmDataStore = new DataStore_Realm(); - new SentryController(playerDataStore, realmDataStore, sentryHubMock); - } - - [Test] - public void Player_Update_Updates_Sentry_Tags() - { - // Act - playerDataStore.playerGridPosition.Set(new Vector2Int(10, 10), true); - - // Assert - Assert.AreEqual("10,10", capturedScope.Tags.GetValueOrDefault("Current Position")); - Assert.AreEqual("0,0", capturedScope.Tags.GetValueOrDefault("Previous Position")); - } - - [Test] - public void Teleporting_Updates_Sentry_Contexts() - { - // Act - playerDataStore.lastTeleportPosition.Set(new Vector3(25, 25), true); - - // Assert - Assert.AreEqual("25,25", capturedScope.Contexts.GetValueOrDefault("Current Teleport Position")); - Assert.AreEqual("0,0", capturedScope.Contexts.GetValueOrDefault("Last Teleport Position")); - } - - [Test] - public void Other_Players_Joining_Updates_Sentry_Contexts() - { - // Act - playerDataStore.otherPlayers.Add("Player 1", new Player()); - playerDataStore.otherPlayers.Add("Player 2", new Player()); - playerDataStore.otherPlayers.Add("Player 3", new Player()); - - // Assert - Assert.AreEqual("3", capturedScope.Contexts.GetValueOrDefault("Total Other Players")); - } - - [Test] - public void Other_Players_Leaving_Updates_Sentry_Contexts() - { - // Act - playerDataStore.otherPlayers.Add("Player 1", new Player()); - playerDataStore.otherPlayers.Add("Player 2", new Player()); - playerDataStore.otherPlayers.Remove("Player 2"); - - // Assert - Assert.AreEqual("1", capturedScope.Contexts.GetValueOrDefault("Total Other Players")); - } - - [Test] - public void Realm_Name_Changing_Updates_Sentry_Contexts() - { - // Act - realmDataStore.realmName.Set("Old Realm Name"); - realmDataStore.realmName.Set("New Realm Name"); - - // Assert - Assert.AreEqual("New Realm Name", capturedScope.Tags.GetValueOrDefault("Current Realm")); - Assert.AreEqual("Old Realm Name", capturedScope.Tags.GetValueOrDefault("Previous Realm")); - } - } -} diff --git a/unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests/SentryControllerTests.cs.meta b/unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests/SentryControllerTests.cs.meta deleted file mode 100644 index 30eecedf56..0000000000 --- a/unity-renderer/Assets/DCLPlugins/SentryPlugin/Tests/SentryControllerTests.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: e0715887fa0a41d4a2f83a565bb6f541 -timeCreated: 1674223808 \ No newline at end of file diff --git a/unity-renderer/Assets/DCLServices/Lambdas/LambdasService.cs b/unity-renderer/Assets/DCLServices/Lambdas/LambdasService.cs index 6906eefbca..a857dd7c46 100644 --- a/unity-renderer/Assets/DCLServices/Lambdas/LambdasService.cs +++ b/unity-renderer/Assets/DCLServices/Lambdas/LambdasService.cs @@ -1,13 +1,10 @@ using Cysharp.Threading.Tasks; using DCL; -using MainScripts.DCL.Helpers.SentryUtils; using Newtonsoft.Json; -using Sentry; using System; using System.Collections.Generic; using System.Text; using System.Threading; -using System.Threading.Tasks; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Pool; @@ -19,7 +16,6 @@ public class LambdasService : ILambdasService private ICatalyst catalyst; private Service webRequestController; - private Service urlTransactionMonitor; private readonly Dictionary jsonHeaders = new() { { "Content-Type", "application/json" } }; public async UniTask<(TResponse response, bool success)> Post( @@ -35,9 +31,8 @@ public class LambdasService : ILambdasService string lambdaUrl = await catalyst.GetLambdaUrl(cancellationToken); var url = GetUrl(endPoint, lambdaUrl, urlEncodedParams); var wr = webRequestController.Ref.Post(url, postDataJson, requestAttemps: attemptsNumber, timeout: timeout, disposeOnCompleted: false); - var transaction = urlTransactionMonitor.Ref.TrackWebRequest(wr, endPointTemplate, data: postDataJson, finishTransactionOnWebRequestFinish: false); - return await SendRequestAsync(wr, cancellationToken, endPoint, transaction); + return await SendRequestAsync(wr, cancellationToken, endPoint); } public async UniTask<(TResponse response, bool success)> Get( @@ -51,9 +46,8 @@ public class LambdasService : ILambdasService string lambdaUrl = await catalyst.GetLambdaUrl(cancellationToken); var url = GetUrl(endPoint, lambdaUrl, urlEncodedParams); var wr = webRequestController.Ref.Get(url, requestAttemps: attemptsNumber, timeout: timeout, disposeOnCompleted: false); - var transaction = urlTransactionMonitor.Ref.TrackWebRequest(wr, endPointTemplate, finishTransactionOnWebRequestFinish: false); - return await SendRequestAsync(wr, cancellationToken, endPoint, transaction); + return await SendRequestAsync(wr, cancellationToken, endPoint); } public async UniTask<(TResponse response, bool success)> GetFromSpecificUrl( @@ -96,18 +90,15 @@ public class LambdasService : ILambdasService { var postDataJson = JsonUtility.ToJson(postData); var wr = webRequestController.Ref.Post(url, postDataJson, requestAttemps: attemptsNumber, timeout: timeout, disposeOnCompleted: false, headers: jsonHeaders); - var transaction = urlTransactionMonitor.Ref.TrackWebRequest(wr, endPointTemplate, data: postDataJson, finishTransactionOnWebRequestFinish: false); - return await SendRequestAsync(wr, cancellationToken, url, transaction); + return await SendRequestAsync(wr, cancellationToken, url); } private async UniTask<(TResponse response, bool success)> SendRequestAsync( IWebRequestAsyncOperation webRequestAsyncOperation, CancellationToken cancellationToken, - string endPoint, - DisposableTransaction transaction) + string endPoint) { - using var disposable = transaction; await webRequestAsyncOperation.WithCancellation(cancellationToken); if (!webRequestAsyncOperation.isSucceeded) @@ -119,7 +110,7 @@ public class LambdasService : ILambdasService string textResponse = webRequestAsyncOperation.webRequest.downloadHandler.text; webRequestAsyncOperation.Dispose(); - var res = !TryParseResponse(endPoint, transaction, textResponse, out TResponse response) ? (default, false) : (response, true); + var res = !TryParseResponse(endPoint, textResponse, out TResponse response) ? (default, false) : (response, true); return res; } @@ -191,7 +182,7 @@ private string AppendQueryParamsToUrl(string url, params (string paramName, stri return result; } - internal static bool TryParseResponse(string endPoint, DisposableTransaction transaction, + internal static bool TryParseResponse(string endPoint, string textResponse, out TResponse response) { try @@ -203,7 +194,6 @@ internal static bool TryParseResponse(string endPoint, DisposableTran { response = default; PrintError(endPoint, e.Message); - transaction.SetStatus(SpanStatus.DataLoss); return false; } } diff --git a/unity-renderer/Assets/DCLServices/Lambdas/Tests/LambdasServiceShould.cs b/unity-renderer/Assets/DCLServices/Lambdas/Tests/LambdasServiceShould.cs index 36ec85f4b5..1b6df98e87 100644 --- a/unity-renderer/Assets/DCLServices/Lambdas/Tests/LambdasServiceShould.cs +++ b/unity-renderer/Assets/DCLServices/Lambdas/Tests/LambdasServiceShould.cs @@ -1,9 +1,7 @@ using DCL; -using MainScripts.DCL.Helpers.SentryUtils; using NSubstitute; using NSubstitute.ReceivedExtensions; using NUnit.Framework; -using Sentry; using System; using System.Threading; using UnityEngine; @@ -30,9 +28,6 @@ public class TestResponse private LambdasService lambdasService; private ServiceLocator serviceLocator; - private IWebRequestMonitor transactionMonitor; - private DisposableTransaction disposableTransaction; - private ISpan span; [SetUp] public void Setup() @@ -43,9 +38,6 @@ public void Setup() Environment.Setup(serviceLocator); var catalyst = serviceLocator.Get().catalyst; catalyst.lambdasUrl.Returns(TEST_URL); - - transactionMonitor = serviceLocator.Get(); - disposableTransaction = new DisposableTransaction(span = Substitute.For()); } [Test][Category("ToFix")] @@ -66,21 +58,19 @@ public void ConstructUrlWithoutParams([Values(END_POINT, END_POINT + "/", "/" + public void InvokeTransactionMonitorOnGet() { lambdasService.Get(END_POINT, END_POINT, timeout: 60, attemptsNumber: 5, cancellationToken: CancellationToken.None, urlEncodedParams: ("param1", "45")); - transactionMonitor.Received(1).TrackWebRequest(Arg.Any(), END_POINT); } [Test] public void InvokeTransactionMonitorOnPost() { lambdasService.Post(END_POINT, END_POINT, new TestResponse(), 50, 4, CancellationToken.None, ("param2", "str")); - transactionMonitor.Received(1).TrackWebRequest(Arg.Any(), END_POINT, data: JsonUtility.ToJson(new TestResponse())); } [Test] public void ParseCorrectResponse() { Assert.AreEqual(true, - LambdasService.TryParseResponse(END_POINT, disposableTransaction, "{\"value\":10}", out TestResponse testResponse)); + LambdasService.TryParseResponse(END_POINT, "{\"value\":10}", out TestResponse testResponse)); Assert.AreEqual(10, testResponse.value); } @@ -91,7 +81,7 @@ public void FailWithIncorrectResponse() LogAssert.ignoreFailingMessages = true; Assert.AreEqual(false, - LambdasService.TryParseResponse(END_POINT, disposableTransaction, "{incorrectJson}", out TestResponse testResponse)); + LambdasService.TryParseResponse(END_POINT, "{incorrectJson}", out TestResponse testResponse)); Assert.AreEqual(default, testResponse); } @@ -102,9 +92,7 @@ public void SetTransactionStatusOnParseFail() LogAssert.ignoreFailingMessages = true; Assert.AreEqual(false, - LambdasService.TryParseResponse(END_POINT, disposableTransaction, "{incorrectJson}", out TestResponse _)); - - span.Received(1).Status = SpanStatus.DataLoss; + LambdasService.TryParseResponse(END_POINT, "{incorrectJson}", out TestResponse _)); } [Test] diff --git a/unity-renderer/Assets/Plugins/Sentry.meta b/unity-renderer/Assets/Plugins/Sentry.meta deleted file mode 100644 index 0febceb396..0000000000 --- a/unity-renderer/Assets/Plugins/Sentry.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 304b6a93df8a87949b26060e33f2f278 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/unity-renderer/Assets/Plugins/Sentry/SentryBuildtimeOptionsConfiguration.asset b/unity-renderer/Assets/Plugins/Sentry/SentryBuildtimeOptionsConfiguration.asset deleted file mode 100644 index 2303ee0ff8..0000000000 --- a/unity-renderer/Assets/Plugins/Sentry/SentryBuildtimeOptionsConfiguration.asset +++ /dev/null @@ -1,14 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 457ca7cbb694f904faf8822e56101e40, type: 3} - m_Name: SentryBuildtimeOptionsConfiguration - m_EditorClassIdentifier: diff --git a/unity-renderer/Assets/Plugins/Sentry/SentryBuildtimeOptionsConfiguration.asset.meta b/unity-renderer/Assets/Plugins/Sentry/SentryBuildtimeOptionsConfiguration.asset.meta deleted file mode 100644 index 72df5bca98..0000000000 --- a/unity-renderer/Assets/Plugins/Sentry/SentryBuildtimeOptionsConfiguration.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b5100861b557ac94eb2363eb2dc07459 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/unity-renderer/Assets/Plugins/Sentry/SentryCliOptions.asset b/unity-renderer/Assets/Plugins/Sentry/SentryCliOptions.asset deleted file mode 100644 index 64a2c60338..0000000000 --- a/unity-renderer/Assets/Plugins/Sentry/SentryCliOptions.asset +++ /dev/null @@ -1,21 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 1079966944, guid: 43ec428a58422470fa764bdba9d9bc19, type: 3} - m_Name: SentryCliOptions - m_EditorClassIdentifier: - k__BackingField: 1 - k__BackingField: 0 - k__BackingField: 0 - k__BackingField: - k__BackingField: - k__BackingField: decentraland - k__BackingField: unity-renderer diff --git a/unity-renderer/Assets/Plugins/Sentry/SentryCliOptions.asset.meta b/unity-renderer/Assets/Plugins/Sentry/SentryCliOptions.asset.meta deleted file mode 100644 index cc2cdd3d2f..0000000000 --- a/unity-renderer/Assets/Plugins/Sentry/SentryCliOptions.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b8f95253243956d41a96c01997f5c118 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/unity-renderer/Assets/Resources/Sentry.meta b/unity-renderer/Assets/Resources/Sentry.meta deleted file mode 100644 index 9247b1254f..0000000000 --- a/unity-renderer/Assets/Resources/Sentry.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0831149011b453f41af91e7b210952a8 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/unity-renderer/Assets/Resources/Sentry/SentryOptions.asset b/unity-renderer/Assets/Resources/Sentry/SentryOptions.asset deleted file mode 100644 index 86babb385d..0000000000 --- a/unity-renderer/Assets/Resources/Sentry/SentryOptions.asset +++ /dev/null @@ -1,72 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: -668357930, guid: 43ec428a58422470fa764bdba9d9bc19, type: 3} - m_Name: SentryOptions - m_EditorClassIdentifier: - k__BackingField: 0 - k__BackingField: https://dsn.dsn/ - k__BackingField: 1 - k__BackingField: 1 - k__BackingField: 1000 - k__BackingField: 1000 - k__BackingField: 1000 - k__BackingField: 0.00019999999494757503 - k__BackingField: 1 - k__BackingField: 1 - k__BackingField: 0 - k__BackingField: 1 - k__BackingField: 30000 - k__BackingField: - k__BackingField: - k__BackingField: 1 - k__BackingField: 0 - k__BackingField: 1 - k__BackingField: 75 - k__BackingField: 0 - k__BackingField: 100 - k__BackingField: 20 - k__BackingField: 10 - k__BackingField: 1 - k__BackingField: 1 - k__BackingField: 1 - k__BackingField: 1 - k__BackingField: 1 - k__BackingField: 100 - k__BackingField: 1 - k__BackingField: 0 - k__BackingField: 0 - k__BackingField: 1 - k__BackingField: 30 - k__BackingField: 0 - k__BackingField: 1 - k__BackingField: 2000 - k__BackingField: 30 - k__BackingField: 1 - k__BackingField: 5000 - k__BackingField: 1 - k__BackingField: f401000057020000 - k__BackingField: 1 - k__BackingField: 1 - k__BackingField: 1 - k__BackingField: 1 - k__BackingField: 1 - k__BackingField: 1 - k__BackingField: 1 - k__BackingField: 1 - k__BackingField: 1 - k__BackingField: 1 - k__BackingField: 1 - k__BackingField: {fileID: 0} - k__BackingField: {fileID: 0} - k__BackingField: 1 - k__BackingField: 1 - k__BackingField: 2 diff --git a/unity-renderer/Assets/Resources/Sentry/SentryOptions.asset.meta b/unity-renderer/Assets/Resources/Sentry/SentryOptions.asset.meta deleted file mode 100644 index b1c7d35914..0000000000 --- a/unity-renderer/Assets/Resources/Sentry/SentryOptions.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0f74879fbb6054449acf273b2676a255 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/PluginSystem/PluginSystemFactory.cs b/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/PluginSystem/PluginSystemFactory.cs index 18e224db6b..3650b1a5e8 100644 --- a/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/PluginSystem/PluginSystemFactory.cs +++ b/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/PluginSystem/PluginSystemFactory.cs @@ -24,7 +24,6 @@ using DCLPlugins.FallbackFontsLoader; using DCLPlugins.LoadingScreenPlugin; using DCLPlugins.RealmPlugin; -using DCLPlugins.SentryPlugin; using DCLPlugins.SignupHUDPlugin; using DCLPlugins.ToSPopupHUDPlugin; using DCLPlugins.UIRefresherPlugin; @@ -67,7 +66,6 @@ public static PluginSystem Create() pluginSystem.Register(() => new ChatNotificationsFeature()); pluginSystem.Register(() => new ConnectWalletModalPlugin()); pluginSystem.Register(() => new FallbackFontsLoaderPlugin()); - pluginSystem.Register(() => new SentryPlugin()); pluginSystem.Register(() => new LoadingScreenPlugin()); pluginSystem.Register(() => new SignupHUDPlugin()); pluginSystem.Register(() => new PortableExperiencesTogglePlugin()); diff --git a/unity-renderer/Assets/Scripts/MainScripts/DCL/Environment/Factories/ServiceLocatorFactory/ServiceLocatorFactory.cs b/unity-renderer/Assets/Scripts/MainScripts/DCL/Environment/Factories/ServiceLocatorFactory/ServiceLocatorFactory.cs index 66c4523192..65b0f8fac6 100644 --- a/unity-renderer/Assets/Scripts/MainScripts/DCL/Environment/Factories/ServiceLocatorFactory/ServiceLocatorFactory.cs +++ b/unity-renderer/Assets/Scripts/MainScripts/DCL/Environment/Factories/ServiceLocatorFactory/ServiceLocatorFactory.cs @@ -35,7 +35,6 @@ using MainScripts.DCL.Controllers.FriendsController; using MainScripts.DCL.Controllers.HotScenes; using MainScripts.DCL.Controllers.HUD.CharacterPreview; -using MainScripts.DCL.Helpers.SentryUtils; using MainScripts.DCL.WorldRuntime.Debugging.Performance; using System.Collections.Generic; using WorldsFeaturesAnalytics; @@ -89,7 +88,6 @@ public static ServiceLocator CreateDefault() result.Register(() => new NamesService()); result.Register(() => new LandsService()); result.Register(() => new UpdateEventHandler()); - result.Register(() => new SentryWebRequestMonitor()); // World runtime result.Register(() => new IdleChecker()); diff --git a/unity-renderer/Assets/Scripts/MainScripts/DCL/Environment/TestEnvironment/ServiceLocatorTestFactory.cs b/unity-renderer/Assets/Scripts/MainScripts/DCL/Environment/TestEnvironment/ServiceLocatorTestFactory.cs index cdc39f030d..77ceb35f6b 100644 --- a/unity-renderer/Assets/Scripts/MainScripts/DCL/Environment/TestEnvironment/ServiceLocatorTestFactory.cs +++ b/unity-renderer/Assets/Scripts/MainScripts/DCL/Environment/TestEnvironment/ServiceLocatorTestFactory.cs @@ -12,10 +12,8 @@ using MainScripts.DCL.Controllers.AssetManager; using MainScripts.DCL.Controllers.HotScenes; using MainScripts.DCL.Controllers.HUD.CharacterPreview; -using MainScripts.DCL.Helpers.SentryUtils; using MainScripts.DCL.ServiceProviders.OpenSea.Interfaces; using NSubstitute; -using Sentry; using System; using System.Collections.Generic; using System.Threading; @@ -77,13 +75,6 @@ public static ServiceLocator CreateMocked() return customNftCollectionService; }); - result.Register(() => - { - var subs = Substitute.For(); - subs.TrackWebRequest(default, default).Returns(new DisposableTransaction(Substitute.For())); - return subs; - }); - result.Register( () => { diff --git a/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils.meta b/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils.meta deleted file mode 100644 index 2bdd21f5c9..0000000000 --- a/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 5ac3ff09a1b5498596c256db393ae9ec -timeCreated: 1674208058 \ No newline at end of file diff --git a/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/DisposableTransaction.cs b/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/DisposableTransaction.cs deleted file mode 100644 index 8eb23d9076..0000000000 --- a/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/DisposableTransaction.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Sentry; -using System; - -namespace MainScripts.DCL.Helpers.SentryUtils -{ - /// - /// Finishes `Span` on `Dispose` - /// - public struct DisposableTransaction : IDisposable - { - private ISpan span; - - public DisposableTransaction(ISpan span) - { - this.span = span; - } - - public void Dispose() - { - span?.Finish(); - span = null; - } - - public void SetStatus(SpanStatus spanStatus) - { - span.Status = spanStatus; - } - } -} diff --git a/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/DisposableTransaction.cs.meta b/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/DisposableTransaction.cs.meta deleted file mode 100644 index c3c040bd7d..0000000000 --- a/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/DisposableTransaction.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: c7309f67e7284d82b1ecb7480b6eed45 -timeCreated: 1674224634 \ No newline at end of file diff --git a/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/IWebRequestMonitor.cs b/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/IWebRequestMonitor.cs deleted file mode 100644 index a8947b15b8..0000000000 --- a/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/IWebRequestMonitor.cs +++ /dev/null @@ -1,18 +0,0 @@ -using DCL; - -namespace MainScripts.DCL.Helpers.SentryUtils -{ - public interface IWebRequestMonitor : IService - { - /// - /// Tracks the web request and report its status to the underlying analytics - /// - /// Web Requests' Async Op - /// Effective end point without the domain name - /// The query string component of the URL (e.g. query=foobar&page=2) - /// Submitted data in JSON, if omitted raw data is taken from `WebRequest` - /// If 'true' finishes transaction automatically - DisposableTransaction TrackWebRequest(IWebRequestAsyncOperation webRequestOp, string endPointTemplate, string queryString = null, - string data = null, bool finishTransactionOnWebRequestFinish = false); - } -} diff --git a/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/IWebRequestMonitor.cs.meta b/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/IWebRequestMonitor.cs.meta deleted file mode 100644 index 38cb60e638..0000000000 --- a/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/IWebRequestMonitor.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 86a3688a93eb455284ff45194ba6d31b -timeCreated: 1674221079 \ No newline at end of file diff --git a/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/SentryUtils.asmdef b/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/SentryUtils.asmdef deleted file mode 100644 index 0dd909e53a..0000000000 --- a/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/SentryUtils.asmdef +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "SentryUtils", - "references":[ "GUID:3b80b0b562b1cbc489513f09fc1b8f69", "GUID:e9cee4050cfa5534d9b26e2782df20be", "GUID:ee6523961ef177343ad763fcd55c7c46" ] -} \ No newline at end of file diff --git a/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/SentryUtils.asmdef.meta b/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/SentryUtils.asmdef.meta deleted file mode 100644 index 22819e72de..0000000000 --- a/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/SentryUtils.asmdef.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: da17ceae445f47578f8767333e50b9b3 -timeCreated: 1674208876 \ No newline at end of file diff --git a/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/SentryWebRequestMonitor.cs b/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/SentryWebRequestMonitor.cs deleted file mode 100644 index 1fdb6ebfea..0000000000 --- a/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/SentryWebRequestMonitor.cs +++ /dev/null @@ -1,81 +0,0 @@ -using DCL; -using Sentry; -using UnityEngine; -using UnityEngine.Networking; - -namespace MainScripts.DCL.Helpers.SentryUtils -{ - public class SentryWebRequestMonitor : IWebRequestMonitor - { - private const int DATA_LIMIT = 150; - - public DisposableTransaction TrackWebRequest(IWebRequestAsyncOperation webRequestOp, string endPointTemplate, string queryString = null, - string data = null, bool finishTransactionOnWebRequestFinish = false) - { - var webRequest = webRequestOp.webRequest; - var transaction = SentrySdk.StartTransaction(endPointTemplate, webRequest.method); - - SentrySdk.ConfigureScope(s => - { - s.Transaction = transaction; - - s.Request = new Request - { - Method = webRequest.method, - Url = webRequest.url, - QueryString = queryString, - Data = GetData(webRequest, data) - }; - }); - - void WebRequestOpCompleted(IWebRequestAsyncOperation webRequestAsyncOperation) - { - // if we don't set the span status manually it will be inferred from the errors happening while the transaction - // is active: it's not correct - - // Due to possible repetitions webRequestAsyncOperation.webRequest can represent the web request that was created with the last attempt - SetSpanStatus(transaction, webRequestAsyncOperation.webRequest); - if (finishTransactionOnWebRequestFinish) - transaction.Finish(); - } - - webRequestOp.completed += WebRequestOpCompleted; - return new DisposableTransaction(transaction); - } - - private static void SetSpanStatus(ITransaction transaction, UnityWebRequest webRequest) - { - if (webRequest.WebRequestTimedOut()) - transaction.Status = SpanStatus.DeadlineExceeded; - else - { - transaction.Status = webRequest.responseCode switch - { - 200 => SpanStatus.Ok, - 404 => SpanStatus.NotFound, - 400 => SpanStatus.InvalidArgument, - 403 => SpanStatus.PermissionDenied, - 409 => SpanStatus.Aborted, - 500 => SpanStatus.InternalError, - 503 => SpanStatus.Unavailable, - 401 => SpanStatus.Unauthenticated, - 429 => SpanStatus.ResourceExhausted, - 504 => SpanStatus.DeadlineExceeded, - _ => SpanStatus.UnknownError - }; - } - } - - private static object GetData(UnityWebRequest webRequest, string data) - { - if (data != null) - return data.Length <= DATA_LIMIT ? data : data.Substring(0, DATA_LIMIT); - - return webRequest.uploadHandler?.data; - } - - public void Dispose() { } - - public void Initialize() { } - } -} diff --git a/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/SentryWebRequestMonitor.cs.meta b/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/SentryWebRequestMonitor.cs.meta deleted file mode 100644 index dd27323e85..0000000000 --- a/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/SentryUtils/SentryWebRequestMonitor.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 7ef6c9f690df4c6081c91a6a2e8fdc63 -timeCreated: 1674221239 \ No newline at end of file diff --git a/unity-renderer/Packages/manifest.json b/unity-renderer/Packages/manifest.json index f35474771c..b661c3de4d 100644 --- a/unity-renderer/Packages/manifest.json +++ b/unity-renderer/Packages/manifest.json @@ -37,7 +37,6 @@ "com.vrmc.univrm": "https://github.com/decentraland/UniVRM.git?path=/Assets/VRM#master", "com.vrmc.vrm": "https://github.com/decentraland/UniVRM.git?path=/Assets/VRM10#master", "com.vrmc.vrmshaders": "https://github.com/decentraland/UniVRM.git?path=/Assets/VRMShaders#master", - "io.sentry.unity": "https://github.com/getsentry/unity.git#1.8.0", "net.tnrd.nsubstitute": "https://github.com/decentraland/Unity3D-NSubstitute.git", "ru.threedisevenzeror.unitygifdecoder": "https://github.com/decentraland/Unity-GifDecoder.git", "com.unity.modules.animation": "1.0.0", diff --git a/unity-renderer/Packages/packages-lock.json b/unity-renderer/Packages/packages-lock.json index 3b7363bc26..248f9d2169 100644 --- a/unity-renderer/Packages/packages-lock.json +++ b/unity-renderer/Packages/packages-lock.json @@ -381,13 +381,6 @@ }, "hash": "36366769363b862446f411870ec19594bf7cb81a" }, - "io.sentry.unity": { - "version": "https://github.com/getsentry/unity.git#1.8.0", - "depth": 0, - "source": "git", - "dependencies": {}, - "hash": "cfd1f01ace2495f712f4f7329d14cf020e3e4724" - }, "net.tnrd.nsubstitute": { "version": "https://github.com/decentraland/Unity3D-NSubstitute.git", "depth": 0,