Skip to content

Commit f610afb

Browse files
Merge pull request #374 from bugsnag/release-v1.11.1
Release v1.11.1
2 parents 5554a9c + 54965d0 commit f610afb

File tree

13 files changed

+127
-21
lines changed

13 files changed

+127
-21
lines changed

.jazzy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ author_url: "https://www.bugsnag.com"
22
author: "Bugsnag Inc"
33
clean: false # avoid deleting docs/.git
44
framework_root: "BugsnagPerformance"
5-
github_file_prefix: "https://github.com/bugsnag/bugsnag-cocoa-performance/tree/v1.11.0/Bugsnag"
5+
github_file_prefix: "https://github.com/bugsnag/bugsnag-cocoa-performance/tree/v1.11.1/Bugsnag"
66
github_url: "https://github.com/bugsnag/bugsnag-cocoa-performance"
77
hide_documentation_coverage: true
88
module: "BugsnagPerformance"
9-
module_version: "1.11.0"
9+
module_version: "1.11.1"
1010
objc: true
1111
output: "docs"
1212
readme: "README.md"

BugsnagPerformance.podspec.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "BugsnagPerformance",
3-
"version": "1.11.0",
3+
"version": "1.11.1",
44
"summary": "The Bugsnag performance monitoring framework for iOS.",
55
"homepage": "https://github.com/bugsnag/bugsnag-cocoa-performance",
66
"license": {
@@ -12,7 +12,7 @@
1212
},
1313
"source": {
1414
"git": "https://github.com/bugsnag/bugsnag-cocoa-performance.git",
15-
"tag": "v1.11.0"
15+
"tag": "v1.11.1"
1616
},
1717
"platforms": {
1818
"ios": "13.0"

BugsnagPerformanceSwift.podspec.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "BugsnagPerformanceSwift",
3-
"version": "1.11.0",
3+
"version": "1.11.1",
44
"summary": "The Bugsnag performance monitoring framework for Swift-only functionality in iOS.",
55
"homepage": "https://github.com/bugsnag/bugsnag-cocoa-performance",
66
"license": {
@@ -13,7 +13,7 @@
1313
"swift_version": "4.2",
1414
"source": {
1515
"git": "https://github.com/bugsnag/bugsnag-cocoa-performance.git",
16-
"tag": "v1.11.0"
16+
"tag": "v1.11.1"
1717
},
1818
"platforms": {
1919
"ios": "13.0"
@@ -24,6 +24,6 @@
2424
"SwiftUI"
2525
],
2626
"dependencies": {
27-
"BugsnagPerformance": "1.11.0"
27+
"BugsnagPerformance": "1.11.1"
2828
}
2929
}

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
=========
33

4+
## 1.11.1 (2025-01-20)
5+
6+
### Bug fixes
7+
8+
* View load spans are now not first class by default, and don't set the current context.
9+
[369](https://github.com/bugsnag/bugsnag-cocoa-performance/pull/369)
10+
411
## 1.11.0 (2025-01-13)
512

613
### Bug fixes

Sources/BugsnagPerformance/Private/BugsnagPerformanceCrossTalkAPI.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,23 @@
2323

2424
#import <Foundation/Foundation.h>
2525
#import <memory>
26+
#import "PhasedStartup.h"
2627

2728
NS_ASSUME_NONNULL_BEGIN
2829

2930
namespace bugsnag {
3031
class SpanStackingHandler;
32+
class Tracer;
3133
}
3234

33-
@interface BugsnagPerformanceCrossTalkAPI : NSObject
35+
@interface BugsnagPerformanceCrossTalkAPI : NSObject<BSGPhasedStartup>
3436

3537
+ (instancetype) sharedInstance;
3638

3739
/**
38-
* Use the configure method to pass any information this CrossTalk API requires to function.
40+
* Use the initialize method to pass any information this CrossTalk API requires to function.
3941
*/
40-
+ (void)configureWithSpanStackingHandler:(std::shared_ptr<bugsnag::SpanStackingHandler>) handler;
42+
+ (void)initializeWithSpanStackingHandler:(std::shared_ptr<bugsnag::SpanStackingHandler>) handler tracer:(std::shared_ptr<bugsnag::Tracer>) tracer;
4143

4244
@end
4345

@@ -60,7 +62,7 @@ class SpanStackingHandler;
6062
*/
6163
@interface BugsnagPerformanceCrossTalkProxiedObject : NSProxy
6264

63-
+ (instancetype) proxied:(id _Nullable)delegate;
65+
+ (instancetype _Nullable) proxied:(id _Nullable)delegate;
6466

6567
@end
6668

Sources/BugsnagPerformance/Private/BugsnagPerformanceCrossTalkAPI.mm

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#import "BugsnagPerformanceCrossTalkAPI.h"
1010
#import "SpanStackingHandler.h"
11+
#import "Tracer.h"
1112
#import "Utils.h"
1213
#import <objc/runtime.h>
1314

@@ -19,17 +20,20 @@ @interface BugsnagPerformanceCrossTalkAPI ()
1920
// Declare the things your API class needs here
2021

2122
@property(nonatomic) std::shared_ptr<SpanStackingHandler> spanStackingHandler;
23+
@property(nonatomic) std::shared_ptr<Tracer> tracer;
24+
@property(readwrite, nonatomic) BugsnagPerformanceConfiguration *configuration;
2225

2326
@end
2427

2528

2629
@implementation BugsnagPerformanceCrossTalkAPI
2730

2831
/**
29-
* You'll call your configure method during start up.
32+
* You'll call your initialize method during start up.
3033
*/
31-
+ (void)configureWithSpanStackingHandler:(std::shared_ptr<SpanStackingHandler>) handler {
34+
+ (void)initializeWithSpanStackingHandler:(std::shared_ptr<SpanStackingHandler>) handler tracer:(std::shared_ptr<bugsnag::Tracer>)tracer {
3235
BugsnagPerformanceCrossTalkAPI.sharedInstance.spanStackingHandler = handler;
36+
BugsnagPerformanceCrossTalkAPI.sharedInstance.tracer = tracer;
3337
}
3438

3539
#pragma mark Exposed API
@@ -65,6 +69,48 @@ - (NSArray * _Nullable)getCurrentTraceAndSpanIdV1 {
6569
];
6670
}
6771

72+
/**
73+
* Return the final configuration that was provided to [BugsnagPerformance start], or return nil if start has not been called.
74+
*/
75+
- (BugsnagPerformanceConfiguration * _Nullable)getConfigurationV1 {
76+
return (BugsnagPerformanceConfiguration *)[BugsnagPerformanceCrossTalkProxiedObject proxied:self.configuration];
77+
}
78+
79+
- (BugsnagPerformanceSpan * _Nullable)startSpanV1:(NSString * _Nonnull)name options:(BugsnagPerformanceSpanOptions *)optionsIn {
80+
auto tracer = self.tracer;
81+
if (tracer == nullptr) {
82+
return nil;
83+
}
84+
85+
auto options = SpanOptions(optionsIn);
86+
auto span = tracer->startSpan(name, options, BSGFirstClassUnset);
87+
return (BugsnagPerformanceSpan *)[BugsnagPerformanceCrossTalkProxiedObject proxied:span];
88+
}
89+
90+
- (BugsnagPerformanceSpanOptions *)newSpanOptionsV1 {
91+
return (BugsnagPerformanceSpanOptions *)[BugsnagPerformanceCrossTalkProxiedObject proxied:[BugsnagPerformanceSpanOptions new]];
92+
}
93+
94+
- (BugsnagPerformanceSpanContext *)newSpanContextV1:(uint64_t)traceIdHi traceIdLo:(uint64_t)traceIdLo spanId:(SpanId)spanId {
95+
BugsnagPerformanceSpanContext *spanContext = [[BugsnagPerformanceSpanContext alloc] initWithTraceIdHi:traceIdHi
96+
traceIdLo:traceIdLo spanId:spanId];
97+
return (BugsnagPerformanceSpanContext *)[BugsnagPerformanceCrossTalkProxiedObject proxied:spanContext];
98+
}
99+
100+
#pragma mark BSGPhasedStartup
101+
102+
- (void)earlyConfigure:(BSGEarlyConfiguration *)config {}
103+
104+
- (void)earlySetup {}
105+
106+
- (void)configure:(BugsnagPerformanceConfiguration *)config {
107+
self.configuration = config;
108+
}
109+
110+
- (void)start {}
111+
112+
- (void)preStartSetup {}
113+
68114
#pragma mark Internal Functionality
69115

70116
static NSString *BSGUserInfoKeyIsSafeToCall = @"isSafeToCall";
@@ -218,7 +264,11 @@ @interface BugsnagPerformanceCrossTalkProxiedObject ()
218264

219265
@implementation BugsnagPerformanceCrossTalkProxiedObject
220266

221-
+ (instancetype) proxied:(id _Nullable)delegate {
267+
+ (instancetype _Nullable) proxied:(id _Nullable)delegate {
268+
if (delegate == nil) {
269+
return nil;
270+
}
271+
222272
BugsnagPerformanceCrossTalkProxiedObject *proxy = [BugsnagPerformanceCrossTalkProxiedObject alloc];
223273
proxy.delegate = delegate;
224274
return proxy;

Sources/BugsnagPerformance/Private/BugsnagPerformanceImpl.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
[worker_ earlySetup];
109109
[frameMetricsCollector_ earlySetup];
110110

111-
[BugsnagPerformanceCrossTalkAPI configureWithSpanStackingHandler:spanStackingHandler_];
111+
[BugsnagPerformanceCrossTalkAPI initializeWithSpanStackingHandler:spanStackingHandler_ tracer:tracer_];
112112
}
113113

114114
void BugsnagPerformanceImpl::configure(BugsnagPerformanceConfiguration *config) noexcept {
@@ -135,6 +135,7 @@
135135
instrumentation_->configure(config);
136136
[worker_ configure:config];
137137
[frameMetricsCollector_ configure:config];
138+
[BugsnagPerformanceCrossTalkAPI.sharedInstance configure:config];
138139
}
139140

140141
void BugsnagPerformanceImpl::preStartSetup() noexcept {

Sources/BugsnagPerformance/Private/Tracer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class Tracer: public PhasedStartup {
4949
onViewLoadSpanStarted_ = onViewLoadSpanStarted;
5050
}
5151

52+
BugsnagPerformanceSpan *startSpan(NSString *name, SpanOptions options, BSGFirstClass defaultFirstClass) noexcept;
53+
5254
BugsnagPerformanceSpan *startAppStartSpan(NSString *name, SpanOptions options) noexcept;
5355

5456
BugsnagPerformanceSpan *startCustomSpan(NSString *name, SpanOptions options) noexcept;
@@ -95,7 +97,6 @@ class Tracer: public PhasedStartup {
9597
void (^onSpanStarted_)(){ ^(){} };
9698
std::function<void(NSString *)> onViewLoadSpanStarted_{ [](NSString *){} };
9799

98-
BugsnagPerformanceSpan *startSpan(NSString *name, SpanOptions options, BSGFirstClass defaultFirstClass) noexcept;
99100
void createFrozenFrameSpan(NSTimeInterval startTime, NSTimeInterval endTime, BugsnagPerformanceSpanContext *parentContext) noexcept;
100101
void markPrewarmSpan(BugsnagPerformanceSpan *span) noexcept;
101102
void onSpanEndSet(BugsnagPerformanceSpan *span);

Sources/BugsnagPerformance/Private/Tracer.mm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@
251251
Tracer::startViewLoadSpan(BugsnagPerformanceViewType viewType,
252252
NSString *className,
253253
SpanOptions options) noexcept {
254+
// Always override this on a view load span
255+
options.makeCurrentContext = false;
254256
NSString *type = getBugsnagPerformanceViewTypeName(viewType);
255257
onViewLoadSpanStarted_(className);
256258
NSString *name = [NSString stringWithFormat:@"[ViewLoad/%@]/%@", type, className];
@@ -259,7 +261,7 @@
259261
options.firstClass = BSGFirstClassNo;
260262
}
261263
}
262-
auto span = startSpan(name, options, BSGFirstClassYes);
264+
auto span = startSpan(name, options, BSGFirstClassNo);
263265
if (willDiscardPrewarmSpans_) {
264266
markPrewarmSpan(span);
265267
}

Sources/BugsnagPerformance/Private/Version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
#pragma once
1010

1111
#define TELEMETRY_SDK_NAME "bugsnag.performance.cocoa"
12-
#define TELEMETRY_SDK_VERSION "1.11.0"
12+
#define TELEMETRY_SDK_VERSION "1.11.1"

Tests/BugsnagPerformanceTests/CrossTalkTests.mm

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ + (NSError *)mapAPINamed:(NSString * _Nonnull)apiName toSelector:(SEL)toSelector
5353
// Do NOT make implementations for any of the selectors you'll be mapping to.
5454

5555
- (NSArray *) getCurrentTraceAndSpanId;
56+
- (BugsnagPerformanceConfiguration *) getConfiguration;
57+
- (BugsnagPerformanceSpan *) startSpan:(NSString *)name options:(BugsnagPerformanceSpanOptions *)options;
58+
- (BugsnagPerformanceSpanOptions *) newSpanOptions;
59+
- (BugsnagPerformanceSpanContext *) newSpanContext:(u_int64_t)traceIdHi traceIdLo:(u_int64_t)traceIdLo spanId:(u_int64_t)spanId;
5660

5761
@end
5862

@@ -157,6 +161,45 @@ - (void)testGetCurrentTraceAndSpanIdV1 {
157161
[ExampleBugsnagPerformanceCrossTalkAPIClient.sharedInstance getCurrentTraceAndSpanId];
158162
}
159163

164+
- (void)testGetConfigurationV1 {
165+
NSError *err = [ExampleBugsnagPerformanceCrossTalkAPIClient mapAPINamed:@"getConfigurationV1" toSelector:@selector(getConfiguration)];
166+
XCTAssertNil(err);
167+
// Calling the API should work. We can't test the return value since it will return nil in this situation.
168+
[ExampleBugsnagPerformanceCrossTalkAPIClient.sharedInstance getConfiguration];
169+
}
170+
171+
- (void)testStartSpanV1 {
172+
NSError *err = [ExampleBugsnagPerformanceCrossTalkAPIClient mapAPINamed:@"startSpanV1:options:" toSelector:@selector(startSpan:options:)];
173+
XCTAssertNil(err);
174+
// Calling the API should work. We can't test the return value since it will return nil in this situation.
175+
BugsnagPerformanceSpanOptions *spanOptions = [BugsnagPerformanceSpanOptions new];
176+
[ExampleBugsnagPerformanceCrossTalkAPIClient.sharedInstance startSpan:@"test" options:spanOptions];
177+
}
178+
179+
- (void)testNewSpanOptionsV1 {
180+
NSError *err = [ExampleBugsnagPerformanceCrossTalkAPIClient mapAPINamed:@"newSpanOptionsV1" toSelector:@selector(newSpanOptions)];
181+
XCTAssertNil(err);
182+
183+
BugsnagPerformanceSpanOptions *spanOptions = [ExampleBugsnagPerformanceCrossTalkAPIClient.sharedInstance newSpanOptions];
184+
NSDate *startTime = [NSDate new];
185+
spanOptions.startTime = startTime;
186+
XCTAssertEqualObjects(spanOptions.startTime, startTime);
187+
}
188+
189+
- (void)testNewSpanContextV1 {
190+
NSError *err = [ExampleBugsnagPerformanceCrossTalkAPIClient mapAPINamed:@"newSpanContextV1:traceIdLo:spanId:" toSelector:@selector(newSpanContext:traceIdLo:spanId:)];
191+
XCTAssertNil(err);
192+
193+
u_int64_t traceIdHi = 1;
194+
u_int64_t traceIdLo = 2;
195+
SpanId spanId = 3;
196+
BugsnagPerformanceSpanContext *spanContext = [ExampleBugsnagPerformanceCrossTalkAPIClient.sharedInstance newSpanContext:traceIdHi traceIdLo:traceIdLo spanId:spanId];
197+
198+
XCTAssertEqual(spanContext.traceIdHi, traceIdHi);
199+
XCTAssertEqual(spanContext.traceIdLo, traceIdLo);
200+
XCTAssertEqual(spanContext.spanId, spanId);
201+
}
202+
160203
#pragma mark Unit Tests: BugsnagPerformanceCrossTalkAPI published APIs (for unit testing support only)
161204

162205
- (void)testReturnStringTestV1 {

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.11.0
1+
1.11.1

features/default/manual_spans.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Feature: Manual creation of spans
8181
* a span field "name" equals "[ViewLoad/SwiftUI]/ManualView"
8282
* a span string attribute "bugsnag.view.name" equals "ManualView"
8383
* a span string attribute "bugsnag.view.type" equals "SwiftUI"
84-
* every span bool attribute "bugsnag.span.first_class" is true
84+
* every span bool attribute "bugsnag.span.first_class" is false
8585
* every span field "kind" equals 1
8686
* every span field "startTimeUnixNano" matches the regex "^[0-9]+$"
8787
* every span field "endTimeUnixNano" matches the regex "^[0-9]+$"
@@ -116,7 +116,7 @@ Feature: Manual creation of spans
116116
* every span field "startTimeUnixNano" matches the regex "^[0-9]+$"
117117
* every span field "endTimeUnixNano" matches the regex "^[0-9]+$"
118118
* every span string attribute "bugsnag.span.category" equals "view_load"
119-
* every span bool attribute "bugsnag.span.first_class" is true
119+
* every span bool attribute "bugsnag.span.first_class" is false
120120

121121
Scenario: Manually start a network span
122122
Given I run "ManualNetworkSpanScenario"

0 commit comments

Comments
 (0)