Skip to content
Open
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
24 changes: 20 additions & 4 deletions BugsnagPerformance.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
094FA7472B10EDE700112ED4 /* BugsnagPerformanceSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 094FA7322B10EDE600112ED4 /* BugsnagPerformanceSwift.framework */; };
094FA7482B10EDE700112ED4 /* BugsnagPerformanceSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 094FA7322B10EDE600112ED4 /* BugsnagPerformanceSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
094FA7522B10EEB600112ED4 /* BugsnagPerformance.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 72E4BB63359EA30E80116E2A /* BugsnagPerformance.framework */; };
09509B752ADFE9A900A358EC /* TracerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 09509B742ADFE9A900A358EC /* TracerTests.mm */; };
096CBC172B1752F700534F0C /* BugsnagPerformanceSwiftUIInstrumentation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 096CBC152B1752F100534F0C /* BugsnagPerformanceSwiftUIInstrumentation.swift */; };
09856B9E2B9606A500620907 /* BugsnagPerformanceSwiftUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 094FA7422B10EDE700112ED4 /* BugsnagPerformanceSwiftUITests.swift */; };
0986B7C02B287C9D00BD2CA3 /* WeakSpansList.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0986B7BF2B287C9D00BD2CA3 /* WeakSpansList.mm */; };
Expand Down Expand Up @@ -188,6 +187,9 @@
967949B62E97CC9E005FD87F /* SpanLifecycleHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 967949B52E97CC95005FD87F /* SpanLifecycleHandler.h */; };
967949B82E97CCA9005FD87F /* SpanLifecycleHandlerImpl.mm in Sources */ = {isa = PBXBuildFile; fileRef = 967949B72E97CCA6005FD87F /* SpanLifecycleHandlerImpl.mm */; };
967949BA2E97D5A5005FD87F /* SpanLifecycleHandlerImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 967949B92E97D59B005FD87F /* SpanLifecycleHandlerImpl.h */; };
967949BD2E99373E005FD87F /* SpanStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 967949BC2E993735005FD87F /* SpanStore.h */; };
967949BF2E993749005FD87F /* SpanStoreImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 967949BE2E993742005FD87F /* SpanStoreImpl.h */; };
967949C12E993750005FD87F /* SpanStoreImpl.mm in Sources */ = {isa = PBXBuildFile; fileRef = 967949C02E99374E005FD87F /* SpanStoreImpl.mm */; };
967F6F1829C3783B0054EED8 /* BugsnagPerformanceConfiguration+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 967F6F1729C3782D0054EED8 /* BugsnagPerformanceConfiguration+Private.h */; };
968AA5FB2CCA5A9200BA69CF /* BSGPerformanceSharedSessionProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 968AA5FA2CCA5A9200BA69CF /* BSGPerformanceSharedSessionProxy.h */; };
968AA5FD2CCA5AB000BA69CF /* BSGPerformanceSharedSessionProxy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 968AA5FC2CCA5AB000BA69CF /* BSGPerformanceSharedSessionProxy.mm */; };
Expand Down Expand Up @@ -408,7 +410,6 @@
094FA7352B10EDE600112ED4 /* BugsnagPerformanceSwift.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = BugsnagPerformanceSwift.docc; sourceTree = "<group>"; };
094FA73B2B10EDE700112ED4 /* BugsnagPerformanceSwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BugsnagPerformanceSwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
094FA7422B10EDE700112ED4 /* BugsnagPerformanceSwiftUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BugsnagPerformanceSwiftUITests.swift; sourceTree = "<group>"; };
09509B742ADFE9A900A358EC /* TracerTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TracerTests.mm; sourceTree = "<group>"; };
096CBC152B1752F100534F0C /* BugsnagPerformanceSwiftUIInstrumentation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BugsnagPerformanceSwiftUIInstrumentation.swift; sourceTree = "<group>"; };
0986B7BF2B287C9D00BD2CA3 /* WeakSpansList.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WeakSpansList.mm; sourceTree = "<group>"; };
0987F2772C32D4AD00777FD8 /* BugsnagPerformanceSpanContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BugsnagPerformanceSpanContext.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -546,6 +547,9 @@
967949B52E97CC95005FD87F /* SpanLifecycleHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SpanLifecycleHandler.h; sourceTree = "<group>"; };
967949B72E97CCA6005FD87F /* SpanLifecycleHandlerImpl.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = SpanLifecycleHandlerImpl.mm; sourceTree = "<group>"; };
967949B92E97D59B005FD87F /* SpanLifecycleHandlerImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SpanLifecycleHandlerImpl.h; sourceTree = "<group>"; };
967949BC2E993735005FD87F /* SpanStore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SpanStore.h; sourceTree = "<group>"; };
967949BE2E993742005FD87F /* SpanStoreImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SpanStoreImpl.h; sourceTree = "<group>"; };
967949C02E99374E005FD87F /* SpanStoreImpl.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = SpanStoreImpl.mm; sourceTree = "<group>"; };
967F6F1729C3782D0054EED8 /* BugsnagPerformanceConfiguration+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BugsnagPerformanceConfiguration+Private.h"; sourceTree = "<group>"; };
968AA5FA2CCA5A9200BA69CF /* BSGPerformanceSharedSessionProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BSGPerformanceSharedSessionProxy.h; sourceTree = "<group>"; };
968AA5FC2CCA5AB000BA69CF /* BSGPerformanceSharedSessionProxy.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = BSGPerformanceSharedSessionProxy.mm; sourceTree = "<group>"; };
Expand Down Expand Up @@ -867,6 +871,7 @@
CB7FD935299D330500499E13 /* SpanOptions.h */,
96D55C7D2A1EA5A8006D1F29 /* SpanStackingHandler.h */,
96D55C7F2A1EA5C6006D1F29 /* SpanStackingHandler.mm */,
967949BB2E99372C005FD87F /* SpanStore */,
CBEBE59129F2783C00BF0B4F /* Swizzle.h */,
CBEBE59029F2783C00BF0B4F /* Swizzle.mm */,
098FC8532D37A08D001B627D /* SystemInfoSampler.h */,
Expand Down Expand Up @@ -947,7 +952,6 @@
CB2B8A9A2A0924A50054FBBE /* SpanTests.mm */,
098FC87A2D3FD095001B627D /* TestHelpers.h */,
CB747D20299E5458003CA1B4 /* TimeTests.mm */,
09509B742ADFE9A900A358EC /* TracerTests.mm */,
09B473092B2313570024CF11 /* WeakSpansListTests.mm */,
CB0AD75A295F27DD002A3FB6 /* WorkerTests.mm */,
);
Expand Down Expand Up @@ -1197,6 +1201,16 @@
path = SpanLifecycle;
sourceTree = "<group>";
};
967949BB2E99372C005FD87F /* SpanStore */ = {
isa = PBXGroup;
children = (
967949BC2E993735005FD87F /* SpanStore.h */,
967949BE2E993742005FD87F /* SpanStoreImpl.h */,
967949C02E99374E005FD87F /* SpanStoreImpl.mm */,
);
path = SpanStore;
sourceTree = "<group>";
};
969EE0EE2E7872A600600F63 /* SpanFactory */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1331,6 +1345,7 @@
0122C24C29019770002D243C /* NetworkInstrumentation.h in Headers */,
962CE8352E67972300380522 /* NetworkSpanFactoryImpl.h in Headers */,
962CE7CE2E60766000380522 /* ViewLoadInstrumentationStateRepository.h in Headers */,
967949BD2E99373E005FD87F /* SpanStore.h in Headers */,
963726C12DEA4E5700C739E6 /* BugsnagPerformancePriority.h in Headers */,
962CE7E82E6123E700380522 /* ViewLoadLoadingIndicatorsHandlerImpl.h in Headers */,
962CE7E92E6123E700380522 /* ViewLoadLoadingIndicatorsHandler.h in Headers */,
Expand Down Expand Up @@ -1371,6 +1386,7 @@
09B473072B23087D0024CF11 /* WeakSpansList.h in Headers */,
96F1292B2DCCB9B900A6FB2B /* BugsnagPerformanceRemoteSpanContext.h in Headers */,
962CE8282E67189800380522 /* NetworkEarlyPhaseHandlerImpl.h in Headers */,
967949BF2E993749005FD87F /* SpanStoreImpl.h in Headers */,
09F23A8C2CE351ED00F0D769 /* BugsnagSwiftTools.h in Headers */,
0921F02B2A67CBD600C764EB /* BugsnagPerformanceNetworkRequestInfo.h in Headers */,
962CE7D52E60967A00380522 /* BugsnagPerformanceLoadingIndicatorView+Private.h in Headers */,
Expand Down Expand Up @@ -1736,7 +1752,6 @@
09E313042BF363020081F219 /* CrossTalkTests.mm in Sources */,
CB747D21299E5458003CA1B4 /* TimeTests.mm in Sources */,
0122C27129019CEF002D243C /* OtlpTraceEncodingTests.mm in Sources */,
09509B752ADFE9A900A358EC /* TracerTests.mm in Sources */,
098FC8792D3FADFE001B627D /* SpanAttributesTests.mm in Sources */,
962F80F229DB03A400BE82BC /* PerformanceMicrobenchmarkTests.swift in Sources */,
CB747D1F299E4984003CA1B4 /* SpanOptionsTests.mm in Sources */,
Expand Down Expand Up @@ -1812,6 +1827,7 @@
09F23A8D2CE351ED00F0D769 /* BugsnagSwiftTools.m in Sources */,
962CE8302E673A9900380522 /* NetworkLifecycleHandlerImpl.mm in Sources */,
968AA5FD2CCA5AB000BA69CF /* BSGPerformanceSharedSessionProxy.mm in Sources */,
967949C12E993750005FD87F /* SpanStoreImpl.mm in Sources */,
964B78562D4B924C00FF077D /* BugsnagPerformanceSpanCondition.mm in Sources */,
CBEC51DD2976F1F9009C0CE3 /* RetryQueue.mm in Sources */,
01A414CE2913C0F0003152A4 /* SpanAttributes.mm in Sources */,
Expand Down
2 changes: 2 additions & 0 deletions Sources/BugsnagPerformance/Private/BugsnagPerformanceImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#import "SpanFactory/ViewLoad/ViewLoadSpanFactoryImpl.h"
#import "SpanFactory/Network/NetworkSpanFactoryImpl.h"
#import "SpanLifecycle/SpanLifecycleHandlerImpl.h"
#import "SpanStore/SpanStoreImpl.h"

#import <mutex>

Expand Down Expand Up @@ -109,6 +110,7 @@ class BugsnagPerformanceImpl: public PhasedStartup {
std::shared_ptr<AppStartupSpanFactoryImpl> appStartupSpanFactory_;
std::shared_ptr<ViewLoadSpanFactoryImpl> viewLoadSpanFactory_;
std::shared_ptr<NetworkSpanFactoryImpl> networkSpanFactory_;
std::shared_ptr<SpanStoreImpl> spanStore_;
std::shared_ptr<SpanLifecycleHandlerImpl> spanLifecycleHandler_;
std::shared_ptr<Tracer> tracer_;
std::unique_ptr<RetryQueue> retryQueue_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@
, appStartupSpanFactory_(std::make_shared<AppStartupSpanFactoryImpl>(plainSpanFactory_, spanAttributesProvider_))
, viewLoadSpanFactory_(std::make_shared<ViewLoadSpanFactoryImpl>(plainSpanFactory_, spanAttributesProvider_))
, networkSpanFactory_(std::make_shared<NetworkSpanFactoryImpl>(plainSpanFactory_, spanAttributesProvider_))
, spanLifecycleHandler_(std::make_shared<SpanLifecycleHandlerImpl>(sampler_, spanStackingHandler_, conditionTimeoutExecutor_, plainSpanFactory_, batch_, frameMetricsCollector_, spanStartCallbacks_, spanEndCallbacks_, ^{this->onSpanStarted();}))
, tracer_(std::make_shared<Tracer>(plainSpanFactory_, viewLoadSpanFactory_, networkSpanFactory_, spanLifecycleHandler_, spanStackingHandler_))
, spanStore_(std::make_shared<SpanStoreImpl>(spanStackingHandler_))
, spanLifecycleHandler_(std::make_shared<SpanLifecycleHandlerImpl>(sampler_, spanStore_, conditionTimeoutExecutor_, plainSpanFactory_, batch_, frameMetricsCollector_, spanStartCallbacks_, spanEndCallbacks_, ^{this->onSpanStarted();}))
, tracer_(std::make_shared<Tracer>(plainSpanFactory_, viewLoadSpanFactory_, networkSpanFactory_, spanLifecycleHandler_, spanStore_))
, retryQueue_(std::make_unique<RetryQueue>([persistence_->bugsnagPerformanceDir() stringByAppendingPathComponent:@"retry-queue"]))
, appStateTracker_(appStateTracker)
, viewControllersToSpans_([NSMapTable mapTableWithKeyOptions:NSMapTableWeakMemory | NSMapTableObjectPointerPersonality
Expand Down Expand Up @@ -418,7 +419,7 @@

bool BugsnagPerformanceImpl::sweepTracerTask() noexcept {
BSGLogDebug(@"BugsnagPerformanceImpl::sweepTracerTask()");
spanLifecycleHandler_->sweep();
spanStore_->sweep();
// Never auto-repeat this task, even if work was done; it can wait.
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ConditionTimeoutExecutor {
ConditionTimeoutExecutor() noexcept {};
~ConditionTimeoutExecutor() {};

void sheduleTimeout(BugsnagPerformanceSpanCondition *condition, NSTimeInterval timeout) noexcept {
void scheduleTimeout(BugsnagPerformanceSpanCondition *condition, NSTimeInterval timeout) noexcept {
std::lock_guard<std::mutex> guard(mutex_);
this->conditionIdToTimer_[condition.conditionId] = [NSTimer scheduledTimerWithTimeInterval:timeout repeats:NO block:^(NSTimer *) {
[condition didTimeout];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#import "../ConditionTimeoutExecutor.h"
#import "../BSGPrioritizedStore.h"
#import "../WeakSpansList.h"
#import "../SpanStore/SpanStore.h"

#import <mutex>

Expand All @@ -25,7 +26,7 @@ namespace bugsnag {
class SpanLifecycleHandlerImpl: public SpanLifecycleHandler {
public:
SpanLifecycleHandlerImpl(std::shared_ptr<Sampler> sampler,
std::shared_ptr<SpanStackingHandler> spanStackingHandler,
std::shared_ptr<SpanStore> store,
std::shared_ptr<ConditionTimeoutExecutor> conditionTimeoutExecutor,
std::shared_ptr<PlainSpanFactoryImpl> plainSpanFactory,
std::shared_ptr<Batch> batch,
Expand All @@ -34,16 +35,14 @@ class SpanLifecycleHandlerImpl: public SpanLifecycleHandler {
BSGPrioritizedStore<BugsnagPerformanceSpanEndCallback> *onSpanEndCallbacks,
void (^onSpanStarted)()) noexcept
: sampler_(sampler)
, spanStackingHandler_(spanStackingHandler)
, store_(store)
, conditionTimeoutExecutor_(conditionTimeoutExecutor)
, plainSpanFactory_(plainSpanFactory)
, batch_(batch)
, frameMetricsCollector_(frameMetricsCollector)
, onSpanStartCallbacks_(onSpanStartCallbacks)
, onSpanEndCallbacks_(onSpanEndCallbacks)
, onSpanStarted_(onSpanStarted)
, blockedSpans_([NSMutableArray new])
, potentiallyOpenSpans_(std::make_shared<WeakSpansList>()) {}
, onSpanStarted_(onSpanStarted) {}

void earlyConfigure(BSGEarlyConfiguration *) noexcept {}
void earlySetup() noexcept {}
Expand All @@ -62,27 +61,22 @@ class SpanLifecycleHandlerImpl: public SpanLifecycleHandler {
BugsnagPerformanceSpanCondition *onSpanBlocked(BugsnagPerformanceSpan *blocked, NSTimeInterval timeout) noexcept;
void onSpanCancelled(BugsnagPerformanceSpan *span) noexcept;

void sweep() noexcept;

private:

std::shared_ptr<Sampler> sampler_;
std::shared_ptr<SpanStackingHandler> spanStackingHandler_;
std::shared_ptr<ConditionTimeoutExecutor> conditionTimeoutExecutor_;
std::shared_ptr<PlainSpanFactoryImpl> plainSpanFactory_;
std::shared_ptr<SpanStore> store_;
FrameMetricsCollector *frameMetricsCollector_;
bool isStarted_{false};
void (^onSpanStarted_)(){ ^(){} };

std::shared_ptr<Batch> batch_;
std::shared_ptr<WeakSpansList> potentiallyOpenSpans_;
NSMutableArray<BugsnagPerformanceSpan *> *blockedSpans_;
BSGPrioritizedStore<BugsnagPerformanceSpanStartCallback> *onSpanStartCallbacks_;
BSGPrioritizedStore<BugsnagPerformanceSpanEndCallback> *onSpanEndCallbacks_;
BugsnagPerformanceEnabledMetrics *enabledMetrics_{[BugsnagPerformanceEnabledMetrics withAllEnabled]};

void processClosedSpan(BugsnagPerformanceSpan *span) noexcept;
void cancelQueuedSpan(BugsnagPerformanceSpan *span) noexcept;
bool shouldInstrumentRendering(BugsnagPerformanceSpan *span) noexcept;
void processFrameMetrics(BugsnagPerformanceSpan *span) noexcept;
void callOnSpanStartCallbacks(BugsnagPerformanceSpan *span) noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
if (shouldInstrumentRendering(span)) {
span.startFramerateSnapshot = [frameMetricsCollector_ currentSnapshot];
}
if (options.makeCurrentContext) {
spanStackingHandler_->push(span);
}
potentiallyOpenSpans_->add(span);
store_->addNewSpan(span, options.makeCurrentContext);
callOnSpanStartCallbacks(span);
onSpanStarted_();
}
Expand All @@ -41,10 +38,6 @@
SpanLifecycleHandlerImpl::onSpanClosed(BugsnagPerformanceSpan *span) noexcept {
if (!span.isBlocked) {
processClosedSpan(span);
} else {
@synchronized (this->blockedSpans_) {
[blockedSpans_ addObject:span];
}
}
}

Expand All @@ -63,9 +56,8 @@
}
} onUpgradedCallback:^BugsnagPerformanceSpanContext *(BugsnagPerformanceSpanCondition *c) {
__strong BugsnagPerformanceSpan *strongSpan = c.span;
@synchronized (this->blockedSpans_) {
this->conditionTimeoutExecutor_->cancelTimeout(c);
}
this->conditionTimeoutExecutor_->cancelTimeout(c);

@synchronized (c) {
if (c.isActive) {
return strongSpan;
Expand All @@ -76,22 +68,24 @@
[condition addOnDeactivatedCallback:^(BugsnagPerformanceSpanCondition *c) {
__strong BugsnagPerformanceSpan *strongSpan = c.span;
if (strongSpan.state == SpanStateEnded && !strongSpan.isBlocked) {
@synchronized (this->blockedSpans_) {
[this->blockedSpans_ removeObject:strongSpan];
this->conditionTimeoutExecutor_->cancelTimeout(c);
}
this->store_->removeSpanFromBlocked(span);
this->conditionTimeoutExecutor_->cancelTimeout(c);
this->onSpanClosed(strongSpan);
}
}];
this->conditionTimeoutExecutor_->sheduleTimeout(condition, timeout);
conditionTimeoutExecutor_->scheduleTimeout(condition, timeout);
store_->addSpanToBlocked(span);
return condition;
}

void
SpanLifecycleHandlerImpl::onSpanCancelled(BugsnagPerformanceSpan *span) noexcept {
if (span) {
batch_->removeSpan(span.traceIdHi, span.traceIdLo, span.spanId);
[blockedSpans_ removeObject:span];
if (!span) {
return;
}
batch_->removeSpan(span.traceIdHi, span.traceIdLo, span.spanId);
if (span.isBlocked) {
store_->removeSpanFromBlocked(span);
}
}

Expand Down Expand Up @@ -225,15 +219,9 @@

void
SpanLifecycleHandlerImpl::abortAllOpenSpans() noexcept {
potentiallyOpenSpans_->abortAllOpen();
}

void
SpanLifecycleHandlerImpl::sweep() noexcept {
constexpr unsigned minEntriesBeforeCompacting = 10000;
if (potentiallyOpenSpans_->count() >= minEntriesBeforeCompacting) {
potentiallyOpenSpans_->compact();
}
store_->performActionAndClearOpenSpans(^(BugsnagPerformanceSpan *span) {
[span abortIfOpen];
});
}

void
Expand All @@ -244,7 +232,7 @@
}
}

spanStackingHandler_->onSpanClosed(span.spanId);
store_->removeSpan(span);

if(span.state == SpanStateAborted) {
return;
Expand Down
32 changes: 32 additions & 0 deletions Sources/BugsnagPerformance/Private/SpanStore/SpanStore.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// SpanStore.h
// BugsnagPerformance
//
// Created by Robert Bartoszewski on 10/10/2025.
// Copyright © 2025 Bugsnag. All rights reserved.
//

#import <BugsnagPerformance/BugsnagPerformanceSpan.h>

namespace bugsnag {

/**
* SpanStore keeps track of all open spans. It allows adding and removing spans,
* quering the current stack as well as performing actions on all open spans
* (e.g., when the app goes to background).
*/
class SpanStore {
public:
virtual void addNewSpan(BugsnagPerformanceSpan *span, bool makeCurrentContext) noexcept = 0;
virtual void removeSpan(BugsnagPerformanceSpan *span) noexcept = 0;
virtual void performActionAndClearOpenSpans(void (^action)(BugsnagPerformanceSpan *span)) noexcept = 0;

virtual void addSpanToBlocked(BugsnagPerformanceSpan *span) noexcept = 0;
virtual void removeSpanFromBlocked(BugsnagPerformanceSpan *span) noexcept = 0;

virtual bool hasSpanOnCurrentStack(NSString *attribute, NSString *value) noexcept = 0;
virtual void sweep() noexcept = 0;

virtual ~SpanStore() {}
};
}
Loading