Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove confidential data from Sentry #1384

Merged
merged 2 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Mail/MailApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import InfomaniakLogin
import InfomaniakNotifications
import MailCore
import MailResources
import Sentry
import SwiftUI
import UIKit

Expand Down
1 change: 0 additions & 1 deletion Mail/UserAccountScene.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import InfomaniakLogin
import InfomaniakNotifications
import MailCore
import MailResources
import Sentry
import SwiftUI
import UIKit
import VersionChecker
Expand Down
1 change: 0 additions & 1 deletion MailCore/Cache/MailboxInfosManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import Foundation
import InfomaniakCore
import Realm
import RealmSwift
import Sentry

/// Conforming to `RealmAccessible` to get a standard `.getRealm` function
extension MailboxInfosManager: RealmAccessible {}
Expand Down
2 changes: 1 addition & 1 deletion MailCore/Cache/MailboxManager/MailboxManager+Thread.swift
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ public extension MailboxManager {
scope.setContext(value: ["Message": ["uid": message.uid,
"messageId": message.messageId],
"Folder": ["id": message.folder?.remoteId,
"name": message.folder?.name,
"name": message.folder?.matomoName,
"cursor": message.folder?.cursor]],
key: "Message context")
}
Expand Down
1 change: 0 additions & 1 deletion MailCore/Models/Thread.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import Foundation
import MailResources
import RealmSwift
import Sentry

public struct ThreadResult: Decodable {
public let threads: [Thread]?
Expand Down
11 changes: 5 additions & 6 deletions MailCore/Utils/SentryDebug.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,10 @@ public enum SentryDebug {
scope.setContext(value: ["threads": Array(threads).map {
[
"uid": "\($0.uid)",
"subject": $0.subject ?? "No subject",
"messageIds": "\($0.messageIds.joined(separator: ","))",
"lastMessageFromFolder": $0.lastMessageFromFolder?.uid ?? "nil",
"messages": Array($0.messages)
.map { ["message uid": $0.uid, "message subject": $0.subject ?? "No subject", "message date": $0.date] }
.map { ["message uid": $0.uid, "message date": $0.date] }
]
}],
key: "threads")
Expand Down Expand Up @@ -207,7 +206,7 @@ public enum SentryDebug {
"references": message.references ?? "nil"],
"Seen": ["Expected": actualSeen, "Actual": liveMessage.seen],
"Folder": ["id": message.folder?.remoteId ?? "nil",
"name": message.folder?.name ?? "nil",
"name": message.folder?.matomoName ?? "nil",
"last update": message.folder?.lastUpdate,
"cursor": message.folder?.cursor ?? "nil"]],
key: "Message context")
Expand Down Expand Up @@ -237,23 +236,23 @@ public enum SentryDebug {

static func addBackoffBreadcrumb(folder: Folder, index: Int) {
let breadcrumb = Breadcrumb()
breadcrumb.message = "Backoff \(index) for folder \(folder.name) - \(folder.remoteId)"
breadcrumb.message = "Backoff \(index) for folder \(folder.matomoName) - \(folder.remoteId)"
breadcrumb.level = .warning
breadcrumb.type = "debug"
SentrySDK.addBreadcrumb(breadcrumb)
}

static func addResetingFolderBreadcrumb(folder: Folder) {
let breadcrumb = Breadcrumb()
breadcrumb.message = "Reseting folder after failed backoff \(folder.name) - \(folder.remoteId)"
breadcrumb.message = "Reseting folder after failed backoff \(folder.matomoName) - \(folder.remoteId)"
breadcrumb.level = .warning
breadcrumb.type = "debug"
SentrySDK.addBreadcrumb(breadcrumb)
}

static func failedResetingAfterBackoff(folder: Folder) {
SentrySDK.capture(message: "Failed reseting folder after backoff") { scope in
scope.setContext(value: ["Folder": ["Id": folder.id, "name": folder.name]],
scope.setContext(value: ["Folder": ["Id": folder.id, "name": folder.matomoName]],
key: "Folder context")
}
}
Expand Down
Loading