• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ParadoxGameConverters / Fronter.NET / 21962748192

12 Feb 2026 08:17PM UTC coverage: 23.13% (+0.05%) from 23.081%
21962748192

push

github

web-flow
Sentry: explicitly set SendDefaultPii to false (#942)

144 of 772 branches covered (18.65%)

Branch coverage included in aggregate %.

0 of 3 new or added lines in 1 file covered. (0.0%)

2 existing lines in 2 files now uncovered.

728 of 2998 relevant lines covered (24.28%)

8.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/Fronter.NET/Services/SentryHelper.cs
1
using commonItems;
2
using Fronter.LogAppenders;
3
using Fronter.Models;
4
using Fronter.Models.Configuration;
5
using log4net;
6
using log4net.Core;
7
using Sentry;
8
using System;
9
using System.IO;
10
using System.Linq;
11

12
namespace Fronter.Services;
13

14
internal sealed class SentryHelper {
15
        public SentryHelper(Config config) {
×
16
                this.config = config;
×
17
                InitSentry();
×
18
        }
×
19

20
        private readonly Config config;
21

22
        private void InitSentry() {
×
23
                string? release = null;
×
24
                // Try to get version from converter's version.txt
25
                var versionFilePath = Path.Combine(config.ConverterFolder, "configurables/version.txt");
×
26
                if (File.Exists(versionFilePath)) {
×
27
                        var version = new ConverterVersion();
×
28
                        version.LoadVersion(versionFilePath);
×
29
                        if (!string.IsNullOrWhiteSpace(version.Version) && !string.IsNullOrWhiteSpace(config.Name)) {
×
30
                                release = $"{config.Name}@{version.Version}";
×
31
                        }
×
32
                }
×
33

34
                if (release is null) {
×
35
                        Logger.Debug("Skipping Sentry initialization because converter version could not be determined.");
×
36
                        return;
×
37
                }
38

39
                SentrySdk.Init(options => {
×
40
                        // A Sentry Data Source Name (DSN) is required.
×
41
                        // See https://docs.sentry.io/product/sentry-basics/dsn-explainer/
×
42
                        options.Dsn = config.SentryDsn;
×
43

×
NEW
44
                        // GDPR/data-minimization: avoid sending personally identifiable information by default.
×
NEW
45
                        options.SendDefaultPii = false;
×
NEW
46

×
47
                        // This option enables Sentry's "Release Health" feature.
×
48
                        options.AutoSessionTracking = false;
×
49

×
50
                        // This option is recommended for client applications only. It ensures all threads use the same global scope.
×
51
                        // If you're writing a background service of any kind, you should remove this.
×
52
                        options.IsGlobalModeEnabled = true;
×
53

×
54
                        options.AttachStacktrace = false;
×
55

×
56
                        options.MaxBreadcrumbs = int.MaxValue;
×
57
                        options.MaxAttachmentSize = long.MaxValue;
×
58

×
59
                        options.Release = release;
×
60
#if DEBUG
×
61
                        options.Environment = "Debug";
×
62
#else
×
63
                        options.Environment = "Release";
×
64
#endif
×
65
                });
×
66
                Logger.Debug("Sentry initialized.");
×
67
        }
×
68

69
        public void AddBreadcrumb(string text) => SentrySdk.AddBreadcrumb(text);
×
70

71
        public void AddAttachment(string filePath) => SentrySdk.ConfigureScope(scope => scope.AddAttachment(filePath));
×
72

73
        public void SendMessageToSentry(int processExitCode) {
×
74
                LogLine? error = GetFirstErrorLogLineFromGrid();
×
75
                if (error is not null) {
×
76
                        var sentryMessageLevel = error.Level == Level.Fatal ? SentryLevel.Fatal : SentryLevel.Error;
×
77
                        SendMessageToSentry(error.Message, sentryMessageLevel);
×
78
                } else {
×
79
                        var message = $"Converter exited with code {processExitCode}";
×
80
                        SendMessageToSentry(message, SentryLevel.Error);
×
81
                }
×
82
        }
×
83

84
        public void SendMessageToSentry(string message, SentryLevel level) {
×
UNCOV
85
                SentrySdk.CaptureMessage(message, level);
×
86
        }
×
87

88
        private static LogLine? GetFirstErrorLogLineFromGrid() {
×
89
                var gridAppender = LogManager.GetRepository().GetAppenders()
×
90
                        .First(a => string.Equals(a.Name, "grid", StringComparison.OrdinalIgnoreCase));
×
91
                if (gridAppender is LogGridAppender logGridAppender) {
×
92
                        return logGridAppender.LogLines
×
93
                                .FirstOrDefault(l => l.Level is not null && l.Level >= Level.Error);
×
94
                }
95
                return null;
×
96
        }
×
97
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc