Skip to content

Commit

Permalink
Removing attachment size parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
NachoEmbrace committed Jan 27, 2025
1 parent b2098c9 commit 206a4a0
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 17 deletions.
6 changes: 0 additions & 6 deletions Sources/EmbraceCore/Internal/Logs/LogController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ protocol LogControllable: LogBatcherDelegate {
attachment: Data?,
attachmentId: String?,
attachmentUrl: URL?,
attachmentSize: Int?,
attributes: [String: String],
stackTraceBehavior: StackTraceBehavior
)
Expand Down Expand Up @@ -73,7 +72,6 @@ class LogController: LogControllable {
attachment: Data? = nil,
attachmentId: String? = nil,
attachmentUrl: URL? = nil,
attachmentSize: Int? = nil,
attributes: [String: String] = [:],
stackTraceBehavior: StackTraceBehavior = .default
) {
Expand Down Expand Up @@ -136,10 +134,6 @@ class LogController: LogControllable {

finalAttributes[LogSemantics.keyAttachmentId] = attachmentId
finalAttributes[LogSemantics.keyAttachmentUrl] = attachmentUrl.absoluteString

if let attachmentSize = attachmentSize {
finalAttributes[LogSemantics.keyAttachmentSize] = String(attachmentSize)
}
}

otel.log(message, severity: severity, timestamp: timestamp, attributes: finalAttributes)
Expand Down
5 changes: 0 additions & 5 deletions Sources/EmbraceCore/Public/Embrace+OTel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ extension Embrace: EmbraceOpenTelemetry {
attachment: nil,
attachmentId: nil,
attachmentUrl: nil,
attachmentSize: nil,
attributes: attributes,
stackTraceBehavior: stackTraceBehavior
)
Expand Down Expand Up @@ -191,7 +190,6 @@ extension Embrace: EmbraceOpenTelemetry {
attachment: attachment,
attachmentId: nil,
attachmentUrl: nil,
attachmentSize: nil,
attributes: attributes,
stackTraceBehavior: stackTraceBehavior
)
Expand All @@ -205,7 +203,6 @@ extension Embrace: EmbraceOpenTelemetry {
/// - timestamp: Timestamp for the log.
/// - attachmentId: Identifier of the attachment
/// - attachmentUrl: URL to dowload the attachment data
/// - attachmentSize: Size of the attachment (optional)
/// - attributes: Attributes for the log.
/// - stackTraceBehavior: Defines if the stack trace information should be added to the log
public func log(
Expand All @@ -215,7 +212,6 @@ extension Embrace: EmbraceOpenTelemetry {
timestamp: Date = Date(),
attachmentId: String,
attachmentUrl: URL,
attachmentSize: Int? = nil,
attributes: [String: String],
stackTraceBehavior: StackTraceBehavior = .default
) {
Expand All @@ -227,7 +223,6 @@ extension Embrace: EmbraceOpenTelemetry {
attachment: nil,
attachmentId: attachmentId,
attachmentUrl: attachmentUrl,
attachmentSize: attachmentSize,
attributes: attributes,
stackTraceBehavior: stackTraceBehavior
)
Expand Down
1 change: 0 additions & 1 deletion Sources/EmbraceOTelInternal/EmbraceOpenTelemetry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public protocol EmbraceOpenTelemetry: AnyObject {
timestamp: Date,
attachmentId: String,
attachmentUrl: URL,
attachmentSize: Int?,
attributes: [String: String],
stackTraceBehavior: StackTraceBehavior
)
Expand Down
5 changes: 2 additions & 3 deletions Tests/EmbraceCoreTests/Internal/Logs/LogControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ private extension LogControllerTests {

func whenCreatingLogWithPreUploadedAttachment() {
let url = URL(string: "http//embrace.test.com/attachment/123", testName: testName)!
sut.createLog("test", severity: .info, attachmentId: UUID().withoutHyphen, attachmentUrl: url, attachmentSize: 12345)
sut.createLog("test", severity: .info, attachmentId: UUID().withoutHyphen, attachmentUrl: url)
}

func thenDoesntTryToUploadAnything() {
Expand Down Expand Up @@ -449,9 +449,8 @@ private extension LogControllerTests {

let attachmentIdFound = log!.attributes["emb.attachment_id"] != nil
let attachmentUrlFound = log!.attributes["emb.attachment_url"] != nil
let attachmentSizeFound = log!.attributes["emb.attachment_size"] != nil

return attachmentIdFound && attachmentUrlFound && attachmentSizeFound
return attachmentIdFound && attachmentUrlFound
}
}

Expand Down
1 change: 0 additions & 1 deletion Tests/TestSupport/Mocks/DummyLogControllable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class DummyLogControllable: LogControllable {
attachment: Data?,
attachmentId: String?,
attachmentUrl: URL?,
attachmentSize: Int?,
attributes: [String : String],
stackTraceBehavior: StackTraceBehavior
) { }
Expand Down
1 change: 0 additions & 1 deletion Tests/TestSupport/Mocks/MockEmbraceOpenTelemetry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ public class MockEmbraceOpenTelemetry: NSObject, EmbraceOpenTelemetry {
timestamp: Date = Date(),
attachmentId: String,
attachmentUrl: URL,
attachmentSize: Int?,
attributes: [String : String] = [:],
stackTraceBehavior: StackTraceBehavior = .default
) {
Expand Down

0 comments on commit 206a4a0

Please sign in to comment.