Skip to content

Commit

Permalink
[ROLLBACK] removed usage of eventsSyncLock
Browse files Browse the repository at this point in the history
  • Loading branch information
ArielDemarco committed Nov 6, 2024
1 parent fcc80ee commit 00e9d2c
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions Sources/OpenTelemetrySdk/Trace/RecordEventsReadableSpan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -192,29 +192,27 @@ public class RecordEventsReadableSpan: ReadableSpan {
}

public func toSpanData() -> SpanData {
eventsSyncLock.withLock {
attributesSyncLock.withLock {
return SpanData(traceId: context.traceId,
spanId: context.spanId,
traceFlags: context.traceFlags,
traceState: context.traceState,
parentSpanId: parentContext?.spanId,
resource: resource,
instrumentationScope: instrumentationScopeInfo,
name: name,
kind: kind,
startTime: startTime,
attributes: attributes.attributes,
events: adaptEvents(),
links: adaptLinks(),
status: status,
endTime: endTime ?? clock.now,
hasRemoteParent: hasRemoteParent,
hasEnded: hasEnded,
totalRecordedEvents: getTotalRecordedEvents(),
totalRecordedLinks: totalRecordedLinks,
totalAttributeCount: totalAttributeCount)
}
attributesSyncLock.withLock {
return SpanData(traceId: context.traceId,
spanId: context.spanId,
traceFlags: context.traceFlags,
traceState: context.traceState,
parentSpanId: parentContext?.spanId,
resource: resource,
instrumentationScope: instrumentationScopeInfo,
name: name,
kind: kind,
startTime: startTime,
attributes: attributes.attributes,
events: adaptEvents(),
links: adaptLinks(),
status: status,
endTime: endTime ?? clock.now,
hasRemoteParent: hasRemoteParent,
hasEnded: hasEnded,
totalRecordedEvents: getTotalRecordedEvents(),
totalRecordedLinks: totalRecordedLinks,
totalAttributeCount: totalAttributeCount)
}
}

Expand Down

0 comments on commit 00e9d2c

Please sign in to comment.