From 92820888918f7344b3f4df4fdef773772daa9e6b Mon Sep 17 00:00:00 2001 From: Doug Date: Wed, 8 May 2024 10:54:54 +0100 Subject: [PATCH] Remove OTLP support. --- .../Sources/Application/AppCoordinator.swift | 8 +---- .../Sources/Application/AppSettings.swift | 10 ------ ElementX/Sources/Other/InfoPlistReader.swift | 18 ---------- ElementX/Sources/Other/Logging/MXLog.swift | 5 ++- .../Sources/Other/Logging/RustTracing.swift | 33 ++++--------------- .../DeveloperOptionsScreenModels.swift | 1 - .../View/DeveloperOptionsScreen.swift | 5 --- ElementX/SupportingFiles/Info.plist | 6 ---- ElementX/SupportingFiles/target.yml | 3 -- fastlane/Fastfile | 30 ----------------- 10 files changed, 10 insertions(+), 109 deletions(-) diff --git a/ElementX/Sources/Application/AppCoordinator.swift b/ElementX/Sources/Application/AppCoordinator.swift index 0011b5499..9babf9920 100644 --- a/ElementX/Sources/Application/AppCoordinator.swift +++ b/ElementX/Sources/Application/AppCoordinator.swift @@ -70,13 +70,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg let appSettings = AppSettings() - if appSettings.otlpTracingEnabled { - MXLog.configure(logLevel: appSettings.logLevel, otlpConfiguration: .init(url: appSettings.otlpTracingURL, - username: appSettings.otlpTracingUsername, - password: appSettings.otlpTracingPassword)) - } else { - MXLog.configure(logLevel: appSettings.logLevel) - } + MXLog.configure(logLevel: appSettings.logLevel) let appName = InfoPlistReader.main.bundleDisplayName let appVersion = InfoPlistReader.main.bundleShortVersionString diff --git a/ElementX/Sources/Application/AppSettings.swift b/ElementX/Sources/Application/AppSettings.swift index 9a5a75ddb..12ed3d4f7 100644 --- a/ElementX/Sources/Application/AppSettings.swift +++ b/ElementX/Sources/Application/AppSettings.swift @@ -35,7 +35,6 @@ final class AppSettings { case enableInAppNotifications case pusherProfileTag case logLevel - case otlpTracingEnabled case viewSourceEnabled case richTextEditorEnabled case appAppearance @@ -255,15 +254,6 @@ final class AppSettings { @UserPreference(key: UserDefaultsKeys.pusherProfileTag, storageType: .userDefaults(store)) var pusherProfileTag: String? - // MARK: - Logging - - @UserPreference(key: UserDefaultsKeys.otlpTracingEnabled, defaultValue: false, storageType: .userDefaults(store)) - var otlpTracingEnabled - - let otlpTracingURL = InfoPlistReader.main.otlpTracingURL - let otlpTracingUsername = InfoPlistReader.main.otlpTracingUsername - let otlpTracingPassword = InfoPlistReader.main.otlpTracingPassword - // MARK: - Maps // maptiler base url diff --git a/ElementX/Sources/Other/InfoPlistReader.swift b/ElementX/Sources/Other/InfoPlistReader.swift index b0cb79784..2f561cf9d 100644 --- a/ElementX/Sources/Other/InfoPlistReader.swift +++ b/ElementX/Sources/Other/InfoPlistReader.swift @@ -29,10 +29,6 @@ struct InfoPlistReader { static let utTypeIdentifierKey = "UTTypeIdentifier" static let utDescriptionKey = "UTTypeDescription" - static let otlpTracingURL = "otlpTracingURL" - static let otlpTracingUsername = "otlpTracingUsername" - static let otlpTracingPassword = "otlpTracingPassword" - static let bundleURLTypes = "CFBundleURLTypes" static let bundleURLName = "CFBundleURLName" static let bundleURLSchemes = "CFBundleURLSchemes" @@ -107,20 +103,6 @@ struct InfoPlistReader { infoPlistValue(forKey: Keys.mapLibreAPIKey) } - // MARK: - OTLP Tracing - - var otlpTracingURL: String { - infoPlistValue(forKey: Keys.otlpTracingURL) - } - - var otlpTracingUsername: String { - infoPlistValue(forKey: Keys.otlpTracingUsername) - } - - var otlpTracingPassword: String { - infoPlistValue(forKey: Keys.otlpTracingPassword) - } - // MARK: - Custom App Scheme var appScheme: String { diff --git a/ElementX/Sources/Other/Logging/MXLog.swift b/ElementX/Sources/Other/Logging/MXLog.swift index 34903690f..e022420b8 100644 --- a/ElementX/Sources/Other/Logging/MXLog.swift +++ b/ElementX/Sources/Other/Logging/MXLog.swift @@ -33,11 +33,10 @@ enum MXLog { private static var target: String! static func configure(target: String? = nil, - logLevel: TracingConfiguration.LogLevel, - otlpConfiguration: OTLPConfiguration? = nil) { + logLevel: TracingConfiguration.LogLevel) { guard !didConfigureOnce else { return } - RustTracing.setup(configuration: .init(logLevel: logLevel, target: target), otlpConfiguration: otlpConfiguration) + RustTracing.setup(configuration: .init(logLevel: logLevel, target: target)) if let target { self.target = target diff --git a/ElementX/Sources/Other/Logging/RustTracing.swift b/ElementX/Sources/Other/Logging/RustTracing.swift index e3b997ce8..3b46c171d 100644 --- a/ElementX/Sources/Other/Logging/RustTracing.swift +++ b/ElementX/Sources/Other/Logging/RustTracing.swift @@ -17,12 +17,6 @@ import Foundation import MatrixRustSDK -struct OTLPConfiguration { - let url: String - let username: String - let password: String -} - enum RustTracing { /// The base filename used for log files. This may be suffixed by the target /// name and other log management metadata during rotation. @@ -31,32 +25,19 @@ enum RustTracing { static var logsDirectory: URL { .appGroupContainerDirectory } private(set) static var currentTracingConfiguration: TracingConfiguration? - static func setup(configuration: TracingConfiguration, otlpConfiguration: OTLPConfiguration?) { + static func setup(configuration: TracingConfiguration) { currentTracingConfiguration = configuration // Keep a minimum of 1 week of log files. In reality it will be longer // as the app is unlikely to be running continuously. let maxFiles: UInt64 = 24 * 7 - if let otlpConfiguration { - setupOtlpTracing(config: .init(clientName: "ElementX-iOS", - user: otlpConfiguration.username, - password: otlpConfiguration.password, - otlpEndpoint: otlpConfiguration.url, - filter: configuration.filter, - writeToStdoutOrSystem: true, - writeToFiles: .init(path: logsDirectory.path(percentEncoded: false), - filePrefix: configuration.fileName, - fileSuffix: configuration.fileExtension, - maxFiles: maxFiles))) - } else { - setupTracing(config: .init(filter: configuration.filter, - writeToStdoutOrSystem: true, - writeToFiles: .init(path: logsDirectory.path(percentEncoded: false), - filePrefix: configuration.fileName, - fileSuffix: configuration.fileExtension, - maxFiles: maxFiles))) - } + setupTracing(config: .init(filter: configuration.filter, + writeToStdoutOrSystem: true, + writeToFiles: .init(path: logsDirectory.path(percentEncoded: false), + filePrefix: configuration.fileName, + fileSuffix: configuration.fileExtension, + maxFiles: maxFiles))) } /// A list of all log file URLs, sorted chronologically. This is only public for testing purposes, within diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift index 0e4d72242..8437d0839 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift @@ -45,7 +45,6 @@ enum DeveloperOptionsScreenViewAction { protocol DeveloperOptionsProtocol: AnyObject { var logLevel: TracingConfiguration.LogLevel { get set } - var otlpTracingEnabled: Bool { get set } var shouldCollapseRoomStateEvents: Bool { get set } var hideUnreadMessagesBadge: Bool { get set } var elementCallBaseURL: URL { get set } diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift index d1e0bd5aa..600541c6b 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift @@ -25,11 +25,6 @@ struct DeveloperOptionsScreen: View { Form { Section("Logging") { LogLevelConfigurationView(logLevel: $context.logLevel) - - Toggle(isOn: $context.otlpTracingEnabled) { - Text("OTLP tracing") - Text("Requires app reboot") - } } Section("Room List") { diff --git a/ElementX/SupportingFiles/Info.plist b/ElementX/SupportingFiles/Info.plist index c0c50edfa..213dbcfad 100644 --- a/ElementX/SupportingFiles/Info.plist +++ b/ElementX/SupportingFiles/Info.plist @@ -117,12 +117,6 @@ $(KEYCHAIN_ACCESS_GROUP_IDENTIFIER) mapLibreAPIKey $(MAPLIBRE_API_KEY) - otlpTracingPassword - ${OTLP_TRACING_PASSWORD} - otlpTracingURL - ${OTLP_TRACING_URL} - otlpTracingUsername - ${OTLP_TRACING_USERNAME} productionAppName $(PRODUCTION_APP_NAME) diff --git a/ElementX/SupportingFiles/target.yml b/ElementX/SupportingFiles/target.yml index 40b7df1d4..b91fe4a0f 100644 --- a/ElementX/SupportingFiles/target.yml +++ b/ElementX/SupportingFiles/target.yml @@ -108,9 +108,6 @@ targets: LSItemContentTypes: $(PILLS_UT_TYPE_IDENTIFIER) LSSupportsOpeningDocumentsInPlace: false mapLibreAPIKey: $(MAPLIBRE_API_KEY) - otlpTracingURL: ${OTLP_TRACING_URL} - otlpTracingUsername: ${OTLP_TRACING_USERNAME} - otlpTracingPassword: ${OTLP_TRACING_PASSWORD} settings: diff --git a/fastlane/Fastfile b/fastlane/Fastfile index f406fcb1a..3821d9392 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -416,39 +416,9 @@ private_lane :config_secrets do maplibre_api_key = ENV["MAPLIBRE_API_KEY"] UI.user_error!("Invalid Map Libre API key.") unless !maplibre_api_key.to_s.empty? - otlp_tracing_url = ENV["OTLP_TRACING_URL"] - UI.user_error!("Invalid OTLP tracing URL.") unless !otlp_tracing_url.to_s.empty? - - otlp_tracing_username = ENV["OTLP_TRACING_USERNAME"] - UI.user_error!("Invalid OTLP tracing username.") unless !otlp_tracing_username.to_s.empty? - - otlp_tracing_password = ENV["OTLP_TRACING_PASSWORD"] - UI.user_error!("Invalid OTLP tracing password.") unless !otlp_tracing_password.to_s.empty? - set_xcconfig_value( path: './ElementX/SupportingFiles/secrets.xcconfig', name: 'MAPLIBRE_API_KEY', value: maplibre_api_key ) - - # URLs need special treatment to work properly in xcconfig files - # https://stackoverflow.com/a/36297483/730924 - # i.e. make sure to use https:/$()/ in the scheme in the stored secret - set_xcconfig_value( - path: './ElementX/SupportingFiles/secrets.xcconfig', - name: 'OTLP_TRACING_URL', - value: otlp_tracing_url - ) - - set_xcconfig_value( - path: './ElementX/SupportingFiles/secrets.xcconfig', - name: 'OTLP_TRACING_USERNAME', - value: otlp_tracing_username - ) - - set_xcconfig_value( - path: './ElementX/SupportingFiles/secrets.xcconfig', - name: 'OTLP_TRACING_PASSWORD', - value: otlp_tracing_password - ) end