mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add some Sentry transactions.
This commit is contained in:
@@ -257,6 +257,7 @@ public class PluginRegister
|
|||||||
/// <returns>The filter that allows reading the specified path</returns>
|
/// <returns>The filter that allows reading the specified path</returns>
|
||||||
public IFilter GetFilter(string path)
|
public IFilter GetFilter(string path)
|
||||||
{
|
{
|
||||||
|
ITransactionTracer transaction = SentrySdk.StartTransaction("GetPlugin", "DetectFilter");
|
||||||
IFilter noFilter = null;
|
IFilter noFilter = null;
|
||||||
|
|
||||||
foreach(IFilter filter in Filters.Values)
|
foreach(IFilter filter in Filters.Values)
|
||||||
@@ -269,7 +270,12 @@ public class PluginRegister
|
|||||||
|
|
||||||
var foundFilter = (IFilter)filter.GetType().GetConstructor(Type.EmptyTypes)?.Invoke([]);
|
var foundFilter = (IFilter)filter.GetType().GetConstructor(Type.EmptyTypes)?.Invoke([]);
|
||||||
|
|
||||||
if(foundFilter?.Open(path) == ErrorNumber.NoError) return foundFilter;
|
if(foundFilter?.Open(path) == ErrorNumber.NoError)
|
||||||
|
{
|
||||||
|
transaction.Finish();
|
||||||
|
|
||||||
|
return foundFilter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
noFilter = filter;
|
noFilter = filter;
|
||||||
@@ -281,10 +287,17 @@ public class PluginRegister
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!noFilter?.Identify(path) == true) return null;
|
if(!noFilter?.Identify(path) == true)
|
||||||
|
{
|
||||||
|
transaction.Finish();
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
noFilter?.Open(path);
|
noFilter?.Open(path);
|
||||||
|
|
||||||
|
transaction.Finish();
|
||||||
|
|
||||||
return noFilter;
|
return noFilter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,6 +48,8 @@ public static class ArchiveFormat
|
|||||||
/// <returns>Detected archive plugin</returns>
|
/// <returns>Detected archive plugin</returns>
|
||||||
public static IArchive Detect(IFilter archiveFilter)
|
public static IArchive Detect(IFilter archiveFilter)
|
||||||
{
|
{
|
||||||
|
ITransactionTracer transaction = SentrySdk.StartTransaction("GetPlugin", "DetectArchive");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PluginRegister plugins = PluginRegister.Singleton;
|
PluginRegister plugins = PluginRegister.Singleton;
|
||||||
@@ -76,12 +78,16 @@ public static class ArchiveFormat
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Not recognized
|
// Not recognized
|
||||||
|
transaction.Finish();
|
||||||
|
|
||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
SentrySdk.CaptureException(ex);
|
SentrySdk.CaptureException(ex);
|
||||||
|
|
||||||
|
transaction.Finish();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ using System.Linq;
|
|||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
using Aaru.Logging;
|
using Aaru.Logging;
|
||||||
|
using Sentry;
|
||||||
|
|
||||||
namespace Aaru.Core;
|
namespace Aaru.Core;
|
||||||
|
|
||||||
@@ -53,6 +54,7 @@ public static class Filesystems
|
|||||||
public static void Identify(IMediaImage imagePlugin, out List<string> idPlugins, Partition partition,
|
public static void Identify(IMediaImage imagePlugin, out List<string> idPlugins, Partition partition,
|
||||||
bool getGuid = false)
|
bool getGuid = false)
|
||||||
{
|
{
|
||||||
|
ITransactionTracer transaction = SentrySdk.StartTransaction("GetPlugin", "DetectFilesystem");
|
||||||
PluginRegister plugins = PluginRegister.Singleton;
|
PluginRegister plugins = PluginRegister.Singleton;
|
||||||
|
|
||||||
idPlugins = [];
|
idPlugins = [];
|
||||||
@@ -66,13 +68,12 @@ public static class Filesystems
|
|||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
AaruLogging
|
AaruLogging.Error(Localization.Core.Filesystems_Identify_Error, plugin.Name);
|
||||||
.Error(Localization.Core.Filesystems_Identify_Error,
|
|
||||||
plugin.Name);
|
|
||||||
|
|
||||||
AaruLogging.Exception(ex, Localization.Core.Filesystems_Identify_Error,
|
AaruLogging.Exception(ex, Localization.Core.Filesystems_Identify_Error, plugin.Name);
|
||||||
plugin.Name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
transaction.Finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,6 +48,8 @@ public static class ImageFormat
|
|||||||
/// <returns>Detected image plugin</returns>
|
/// <returns>Detected image plugin</returns>
|
||||||
public static IBaseImage Detect(IFilter imageFilter)
|
public static IBaseImage Detect(IFilter imageFilter)
|
||||||
{
|
{
|
||||||
|
ITransactionTracer transaction = SentrySdk.StartTransaction("GetPlugin", "DetectImageFormat");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PluginRegister plugins = PluginRegister.Singleton;
|
PluginRegister plugins = PluginRegister.Singleton;
|
||||||
@@ -102,7 +104,12 @@ public static class ImageFormat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(imageFormat != null) return imageFormat;
|
if(imageFormat != null)
|
||||||
|
{
|
||||||
|
transaction.Finish();
|
||||||
|
|
||||||
|
return imageFormat;
|
||||||
|
}
|
||||||
|
|
||||||
// Check only RAW plugin
|
// Check only RAW plugin
|
||||||
foreach(IMediaImage imagePlugin in plugins.MediaImages.Values)
|
foreach(IMediaImage imagePlugin in plugins.MediaImages.Values)
|
||||||
@@ -128,12 +135,16 @@ public static class ImageFormat
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Still not recognized
|
// Still not recognized
|
||||||
|
transaction.Finish();
|
||||||
|
|
||||||
return imageFormat;
|
return imageFormat;
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
SentrySdk.CaptureException(ex);
|
SentrySdk.CaptureException(ex);
|
||||||
|
|
||||||
|
transaction.Finish();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user