Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates EmbraceSemantics to move definitions under SpanEventType #65

Merged
merged 4 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class LowMemoryWarningCaptureService: CaptureService {
name: SpanEventSemantics.LowMemory.name,
timestamp: Date(),
attributes: [
SpanEventSemantics.keyEmbraceType: .string(SpanType.lowMemory.rawValue)
SpanEventSemantics.keyEmbraceType: .string(SpanEventType.lowMemory.rawValue)
]
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public final class TapCaptureService: CaptureService {

var attributes: [String: AttributeValue] = [
SpanEventSemantics.Tap.keyViewName: .string(viewName),
SpanEventSemantics.keyEmbraceType: .string(SpanType.tap.rawValue)
SpanEventSemantics.keyEmbraceType: .string(SpanEventType.tap.rawValue)
]

// get coordinates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public final class WebViewCaptureService: CaptureService {
let urlString = getUrlString(url: url)

var attributes: [String: AttributeValue] = [
SpanEventSemantics.keyEmbraceType: .string(SpanType.webView.rawValue),
SpanEventSemantics.keyEmbraceType: .string(SpanEventType.webView.rawValue),
SpanEventSemantics.WebView.keyUrl: .string(urlString)
]

Expand Down
1 change: 0 additions & 1 deletion Sources/EmbraceCore/Internal/Embrace+Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ extension Embrace {
userAgent: EmbraceMeta.userAgent
)

let usedDigits = UInt(6)
return RemoteConfig(
options: options,
logger: logger
Expand Down
2 changes: 1 addition & 1 deletion Sources/EmbraceCore/Public/Events/Breadcrumb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class Breadcrumb: NSObject, SpanEvent {
self.timestamp = timestamp
self.attributes = attributes
self.attributes[SpanEventSemantics.Breadcrumb.keyMessage] = .string(message)
self.attributes[SpanEventSemantics.keyEmbraceType] = .string(SpanType.breadcrumb.rawValue)
self.attributes[SpanEventSemantics.keyEmbraceType] = .string(SpanEventType.breadcrumb.rawValue)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class PushNotificationEvent: NSObject, SpanEvent {
var dict: [String: AttributeValue] = [:]

// set types
dict[SpanEventSemantics.keyEmbraceType] = .string(SpanType.pushNotification.rawValue)
dict[SpanEventSemantics.keyEmbraceType] = .string(SpanEventType.pushNotification.rawValue)
dict[SpanEventSemantics.PushNotification.keyType] =
isSilent(userInfo: apsDict) ?
.string(SpanEventSemantics.PushNotification.silentType) :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@

import EmbraceCommonInternal

public extension SpanType {
static let breadcrumb = SpanType(system: "breadcrumb")
public extension SpanEventType {
static let breadcrumb = SpanEventType(system: "breadcrumb")
}

public extension SpanEventSemantics {
@available(*, deprecated, message: "Use Breadcrumb as this struct will be removed in future versions", renamed: "Breadcrumb")
@available(
*,
deprecated,
message: "Use Breadcrumb as this struct will be removed in future versions",
renamed: "Breadcrumb")
struct Bradcrumb {
public static let name: String = Breadcrumb.name
public static let keyMessage: String = Breadcrumb.keyMessage
Expand All @@ -20,3 +24,12 @@ public extension SpanEventSemantics {
public static let keyMessage = "message"
}
}

public extension SpanType {
@available(
*,
deprecated,
renamed: "SpanEventType.breadcrumb",
message: "Has been moved to `SpanEventType.breadcrumb`")
static let breadcrumb = SpanType(system: "breadcrumb")
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@
//
import EmbraceCommonInternal

public extension SpanType {
static let lowMemory = SpanType(system: "low_memory")
public extension SpanEventType {
static let lowMemory = SpanEventType(system: "low_memory")
}

public extension SpanEventSemantics {
struct LowMemory {
public static let name = "emb-device-low-memory"
}
}

public extension SpanType {
@available(
*,
deprecated,
renamed: "SpanEventType.lowMemory",
message: "Has been moved to `SpanEventType.lowMemory`")
static let lowMemory = SpanType(system: "low_memory")
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import EmbraceCommonInternal

public extension SpanType {
static let pushNotification = SpanType(system: "push_notification")
public extension SpanEventType {
static let pushNotification = SpanEventType(system: "push_notification")
}

public extension SpanEventSemantics {
Expand All @@ -23,3 +23,12 @@ public extension SpanEventSemantics {
public static let silentType = "silent"
}
}

public extension SpanType {
@available(
*,
deprecated,
renamed: "SpanEventType.pushNotification",
message: "Has been moved to `SpanEventType.pushNotification`")
static let pushNotification = SpanEventType(system: "push_notification")
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import EmbraceCommonInternal

public extension SpanType {
static let tap = SpanType(ux: "tap")
public extension SpanEventType {
static let tap = SpanEventType(ux: "tap")
}

public extension SpanEventSemantics {
Expand All @@ -15,3 +15,8 @@ public extension SpanEventSemantics {
public static let keyCoordinates = "tap.coords"
}
}

public extension SpanType {
@available(*, deprecated, renamed: "SpanEventType.tap", message: "Has been moved to `SpanEventType.tap`")
static let tap = SpanType(ux: "tap")
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import EmbraceCommonInternal

public extension SpanType {
static let webView = SpanType(ux: "webview")
public extension SpanEventType {
static let webView = SpanEventType(ux: "webview")
}

public extension SpanEventSemantics {
Expand All @@ -15,3 +15,8 @@ public extension SpanEventSemantics {
public static let keyErrorCode = "webview.error_code"
}
}

public extension SpanType {
@available(*, deprecated, renamed: "SpanEventType.webView", message: "Has been moved to `SpanEventType.webView`")
static let webView = SpanType(ux: "webview")
}
Loading