Skip to content

Commit

Permalink
Backtrace agent support (#118)
Browse files Browse the repository at this point in the history
* Backtrace agent support

* Do not read application version as 'backtrace.version'
  • Loading branch information
konraddysput authored Oct 31, 2023
1 parent 3fddf0c commit 92a658a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Version 2.0.1
- Added application.session and application.version attribute as defaults - no matter if the metrics integration is enabled or not.
- Added application.build attribute that represents an app build version.
- Added backtrace.agent attribute that represents current agent name.

## Version 2.0.0
- Adds Swift Package Manager support
Expand Down
20 changes: 4 additions & 16 deletions Sources/Features/Attributes/DefaultAttributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -207,26 +207,14 @@ struct LibInfo: AttributesSource {
private static let applicationGuidKey = "backtrace.unique.user.identifier"
private static let applicationLangName = "backtrace-cocoa"

var backtraceVersion: String? {

#if SWIFT_PACKAGE
if let build = Bundle.main.infoDictionary?["CFBundleShortVersionString"] {
return build as? String
}
#else
if let bundle = Bundle(identifier: "Backtrace.io.Backtrace"),
let build = bundle.infoDictionary?["CFBundleShortVersionString"] {
return build as? String
}
#endif
return nil
}

var backtraceVersion = "2.0.1"

var immutable: [String: Any?] {
return ["guid": LibInfo.guid(store: UserDefaultsStore.self).uuidString,
"lang.name": LibInfo.applicationLangName,
"lang.version": backtraceVersion,
"backtrace.version": backtraceVersion]
"backtrace.version": backtraceVersion,
"backtrace.agent": "backtrace-cocoa"]
}

static private func guid(store: UserDefaultsStore.Type) -> UUID {
Expand Down

0 comments on commit 92a658a

Please sign in to comment.