Skip to content

Commit

Permalink
add more docs, fix casting
Browse files Browse the repository at this point in the history
  • Loading branch information
philprime committed Feb 25, 2025
1 parent 5ac2b80 commit 8dee61f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
6 changes: 4 additions & 2 deletions Sources/Swift/Transactions/SentrySpanDataKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import Foundation
* - Use underscores for word separation
* - Follow the format `<namespace>.<attribute>` (e.g. `file.size`)
*
* See [Sentry SDK development documentation](https://develop.sentry.dev/sdk/telemetry/traces/span-data-conventions/) for
* more information.
* - Remark: As Swift `enum` are not available in Objective-C, it uses a `class` with static properties, marked with `@objc` and `@objcMembers` instead.
* To reduce casting between `String` to `NSString` when using from Objective-C, it uses `NSString` instead of `String`.
* Eventually this should be replaced with a Swift `enum` when Objective-C compatibility is not needed anymore.
* - Note: See [Sentry SDK development documentation](https://develop.sentry.dev/sdk/telemetry/traces/span-data-conventions/) for more information.
*/
@objcMembers @objc(SentrySpanDataKey)
class SentrySpanDataKey: NSObject {
Expand Down
7 changes: 5 additions & 2 deletions Sources/Swift/Transactions/SentrySpanOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ import Foundation
/**
* Span operations are short string identifiers that categorize the type of operation a span is measuring.
*
* They follow a hierarchical dot notation format (e.g. 'ui.load.initial_display') to group related operations.
* They follow a hierarchical dot notation format (e.g. `ui.load.initial_display`) to group related operations.
* These identifiers help organize and analyze performance data across different types of operations.
*
* See [Sentry SDK development documentation](https://develop.sentry.dev/sdk/telemetry/traces/span-operations/) for more information.
* - Remark: As Swift `enum` are not available in Objective-C, it uses a `class` with static properties, marked with `@objc` and `@objcMembers` instead.
* To reduce casting between `String` to `NSString` when using from Objective-C, it uses `NSString` instead of `String`.
* Eventually this should be replaced with a Swift `enum` when Objective-C compatibility is not needed anymore.
* - Note: See [Sentry SDK development documentation](https://develop.sentry.dev/sdk/telemetry/traces/span-operations/) for more information.
*/
@objcMembers @objc(SentrySpanOperation)
class SentrySpanOperation: NSObject {
Expand Down
13 changes: 13 additions & 0 deletions Sources/Swift/Transactions/SentryTraceOrigin.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
import Foundation

/**
* Trace origin indicates what created a trace or a span
*
* The origin is of type string and consists of four parts: `<type>.<category>.<integration-name>.<integration-part>`.
*
* Only the first is mandatory. The parts build upon each other, meaning it is forbidden to skip one part.
* For example, you may send parts one and two but aren't allowed to send parts one and three without part two.
*
* - Remark: As Swift `enum` are not available in Objective-C, it uses a `class` with static properties, marked with `@objc` and `@objcMembers` instead.
* To reduce casting between `String` to `NSString` when using from Objective-C, it uses `NSString` instead of `String`.
* Eventually this should be replaced with a Swift `enum` when Objective-C compatibility is not needed anymore.
* - Note: See [Sentry SDK development documenation](https://develop.sentry.dev/sdk/telemetry/traces/trace-origin/) for more information.
*/
@objcMembers @objc(SentryTraceOrigin)
class SentryTraceOrigin: NSObject {
static let autoAppStart: NSString = "auto.app.start"
Expand Down
2 changes: 1 addition & 1 deletion Tests/SentryProfilerTests/SentryProfileTestFixture.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class SentryProfileTestFixture {

/// Advance the mock date provider, start a new transaction and return its handle.
func newTransaction(testingAppLaunchSpans: Bool = false, automaticTransaction: Bool = false, idleTimeout: TimeInterval? = nil) throws -> SentryTracer {
let operation = testingAppLaunchSpans ? SentrySpanOperation.uiLoad : transactionOperation
let operation = testingAppLaunchSpans ? SentrySpanOperation.uiLoad as String : transactionOperation

if automaticTransaction {
return hub.startTransaction(
Expand Down

0 comments on commit 8dee61f

Please sign in to comment.