Conversation
b528ef8 to
66f7a9a
Compare
| } | ||
|
|
||
| @objc func formatted() -> String { | ||
| return endTimes.map { (tag, end) in |
There was a problem hiding this comment.
you might want to include the tags that have starts and no ends as like a "unfinished" or a -1 or something, just so they don't fail silently
| } | ||
|
|
||
| @objc func formatted() -> String { | ||
| return endTimes.map { (tag, end) in |
There was a problem hiding this comment.
will iterating over the map keep the original order of the tags? might be helpful for log readability
There was a problem hiding this comment.
going to switch this over to using open telemetry specs.
| import Testing | ||
|
|
||
| @Suite("SDK Tests") | ||
| struct RadarSDKTestsSwift { |
There was a problem hiding this comment.
could add a test for starting a tag and not ending it, and a test for trying to end a tag that wasn't started
|
|
||
| import Foundation | ||
|
|
||
| @objc(RadarTelemetry) class RadarTelemetry: NSObject { |
There was a problem hiding this comment.
nit: if this class isn't actually going to end up sending the logs to the server, you might want to rename it RadarTimer or RadarStopwatch or something
Switching over to using OpenTelemetry trace structure:
#470
Introduce a RadarProfiler. keeps track of what time each operation started/ended, and produce a formatted string of the performance.
RadarProfiler has two timing methods
start(operation)andend(operation)which tracks the time elapsed for a specific operation. In this PR it's being used fortrackVerified.the
formattedmethod returns a formatted string of all the operations that were tracked. e.g.getLocation: 0.003, trackAPI: 1.518, total: 3.448, getAttestToken: 1.477, getConfig: 0.450then it's sent to logs. (currently debug level, but maybe this should be info) which then will be parsed and processed by the server (in the future)
The test in swift does run in CI, but the log doesn't show up. It does show up it if fails, it'll say
RadarSDKTestsSwift.test_profiler()failed. But no output for success for some reason (for now).This test is written with the Swift Testing framework, which requires xcode 16. (updated github workflow to public pre-release for this).