Remove OTLP support.

This commit is contained in:
Doug 2024-05-08 10:54:54 +01:00 committed by Doug
parent e1a2c5e599
commit 9282088891
10 changed files with 10 additions and 109 deletions

View File

@ -70,13 +70,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
let appSettings = AppSettings() let appSettings = AppSettings()
if appSettings.otlpTracingEnabled { MXLog.configure(logLevel: appSettings.logLevel)
MXLog.configure(logLevel: appSettings.logLevel, otlpConfiguration: .init(url: appSettings.otlpTracingURL,
username: appSettings.otlpTracingUsername,
password: appSettings.otlpTracingPassword))
} else {
MXLog.configure(logLevel: appSettings.logLevel)
}
let appName = InfoPlistReader.main.bundleDisplayName let appName = InfoPlistReader.main.bundleDisplayName
let appVersion = InfoPlistReader.main.bundleShortVersionString let appVersion = InfoPlistReader.main.bundleShortVersionString

View File

@ -35,7 +35,6 @@ final class AppSettings {
case enableInAppNotifications case enableInAppNotifications
case pusherProfileTag case pusherProfileTag
case logLevel case logLevel
case otlpTracingEnabled
case viewSourceEnabled case viewSourceEnabled
case richTextEditorEnabled case richTextEditorEnabled
case appAppearance case appAppearance
@ -255,15 +254,6 @@ final class AppSettings {
@UserPreference(key: UserDefaultsKeys.pusherProfileTag, storageType: .userDefaults(store)) @UserPreference(key: UserDefaultsKeys.pusherProfileTag, storageType: .userDefaults(store))
var pusherProfileTag: String? 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 // MARK: - Maps
// maptiler base url // maptiler base url

View File

@ -29,10 +29,6 @@ struct InfoPlistReader {
static let utTypeIdentifierKey = "UTTypeIdentifier" static let utTypeIdentifierKey = "UTTypeIdentifier"
static let utDescriptionKey = "UTTypeDescription" static let utDescriptionKey = "UTTypeDescription"
static let otlpTracingURL = "otlpTracingURL"
static let otlpTracingUsername = "otlpTracingUsername"
static let otlpTracingPassword = "otlpTracingPassword"
static let bundleURLTypes = "CFBundleURLTypes" static let bundleURLTypes = "CFBundleURLTypes"
static let bundleURLName = "CFBundleURLName" static let bundleURLName = "CFBundleURLName"
static let bundleURLSchemes = "CFBundleURLSchemes" static let bundleURLSchemes = "CFBundleURLSchemes"
@ -107,20 +103,6 @@ struct InfoPlistReader {
infoPlistValue(forKey: Keys.mapLibreAPIKey) 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 // MARK: - Custom App Scheme
var appScheme: String { var appScheme: String {

View File

@ -33,11 +33,10 @@ enum MXLog {
private static var target: String! private static var target: String!
static func configure(target: String? = nil, static func configure(target: String? = nil,
logLevel: TracingConfiguration.LogLevel, logLevel: TracingConfiguration.LogLevel) {
otlpConfiguration: OTLPConfiguration? = nil) {
guard !didConfigureOnce else { return } 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 { if let target {
self.target = target self.target = target

View File

@ -17,12 +17,6 @@
import Foundation import Foundation
import MatrixRustSDK import MatrixRustSDK
struct OTLPConfiguration {
let url: String
let username: String
let password: String
}
enum RustTracing { enum RustTracing {
/// The base filename used for log files. This may be suffixed by the target /// The base filename used for log files. This may be suffixed by the target
/// name and other log management metadata during rotation. /// name and other log management metadata during rotation.
@ -31,32 +25,19 @@ enum RustTracing {
static var logsDirectory: URL { .appGroupContainerDirectory } static var logsDirectory: URL { .appGroupContainerDirectory }
private(set) static var currentTracingConfiguration: TracingConfiguration? private(set) static var currentTracingConfiguration: TracingConfiguration?
static func setup(configuration: TracingConfiguration, otlpConfiguration: OTLPConfiguration?) { static func setup(configuration: TracingConfiguration) {
currentTracingConfiguration = configuration currentTracingConfiguration = configuration
// Keep a minimum of 1 week of log files. In reality it will be longer // Keep a minimum of 1 week of log files. In reality it will be longer
// as the app is unlikely to be running continuously. // as the app is unlikely to be running continuously.
let maxFiles: UInt64 = 24 * 7 let maxFiles: UInt64 = 24 * 7
if let otlpConfiguration { setupTracing(config: .init(filter: configuration.filter,
setupOtlpTracing(config: .init(clientName: "ElementX-iOS", writeToStdoutOrSystem: true,
user: otlpConfiguration.username, writeToFiles: .init(path: logsDirectory.path(percentEncoded: false),
password: otlpConfiguration.password, filePrefix: configuration.fileName,
otlpEndpoint: otlpConfiguration.url, fileSuffix: configuration.fileExtension,
filter: configuration.filter, maxFiles: maxFiles)))
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)))
}
} }
/// A list of all log file URLs, sorted chronologically. This is only public for testing purposes, within /// A list of all log file URLs, sorted chronologically. This is only public for testing purposes, within

View File

@ -45,7 +45,6 @@ enum DeveloperOptionsScreenViewAction {
protocol DeveloperOptionsProtocol: AnyObject { protocol DeveloperOptionsProtocol: AnyObject {
var logLevel: TracingConfiguration.LogLevel { get set } var logLevel: TracingConfiguration.LogLevel { get set }
var otlpTracingEnabled: Bool { get set }
var shouldCollapseRoomStateEvents: Bool { get set } var shouldCollapseRoomStateEvents: Bool { get set }
var hideUnreadMessagesBadge: Bool { get set } var hideUnreadMessagesBadge: Bool { get set }
var elementCallBaseURL: URL { get set } var elementCallBaseURL: URL { get set }

View File

@ -25,11 +25,6 @@ struct DeveloperOptionsScreen: View {
Form { Form {
Section("Logging") { Section("Logging") {
LogLevelConfigurationView(logLevel: $context.logLevel) LogLevelConfigurationView(logLevel: $context.logLevel)
Toggle(isOn: $context.otlpTracingEnabled) {
Text("OTLP tracing")
Text("Requires app reboot")
}
} }
Section("Room List") { Section("Room List") {

View File

@ -117,12 +117,6 @@
<string>$(KEYCHAIN_ACCESS_GROUP_IDENTIFIER)</string> <string>$(KEYCHAIN_ACCESS_GROUP_IDENTIFIER)</string>
<key>mapLibreAPIKey</key> <key>mapLibreAPIKey</key>
<string>$(MAPLIBRE_API_KEY)</string> <string>$(MAPLIBRE_API_KEY)</string>
<key>otlpTracingPassword</key>
<string>${OTLP_TRACING_PASSWORD}</string>
<key>otlpTracingURL</key>
<string>${OTLP_TRACING_URL}</string>
<key>otlpTracingUsername</key>
<string>${OTLP_TRACING_USERNAME}</string>
<key>productionAppName</key> <key>productionAppName</key>
<string>$(PRODUCTION_APP_NAME)</string> <string>$(PRODUCTION_APP_NAME)</string>
</dict> </dict>

View File

@ -108,9 +108,6 @@ targets:
LSItemContentTypes: $(PILLS_UT_TYPE_IDENTIFIER) LSItemContentTypes: $(PILLS_UT_TYPE_IDENTIFIER)
LSSupportsOpeningDocumentsInPlace: false LSSupportsOpeningDocumentsInPlace: false
mapLibreAPIKey: $(MAPLIBRE_API_KEY) mapLibreAPIKey: $(MAPLIBRE_API_KEY)
otlpTracingURL: ${OTLP_TRACING_URL}
otlpTracingUsername: ${OTLP_TRACING_USERNAME}
otlpTracingPassword: ${OTLP_TRACING_PASSWORD}
settings: settings:

View File

@ -416,39 +416,9 @@ private_lane :config_secrets do
maplibre_api_key = ENV["MAPLIBRE_API_KEY"] maplibre_api_key = ENV["MAPLIBRE_API_KEY"]
UI.user_error!("Invalid Map Libre API key.") unless !maplibre_api_key.to_s.empty? 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( set_xcconfig_value(
path: './ElementX/SupportingFiles/secrets.xcconfig', path: './ElementX/SupportingFiles/secrets.xcconfig',
name: 'MAPLIBRE_API_KEY', name: 'MAPLIBRE_API_KEY',
value: 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 end