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

Release v1.6.1 #278

Merged
merged 4 commits into from
Jun 24, 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
4 changes: 2 additions & 2 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ author_url: "https://www.bugsnag.com"
author: "Bugsnag Inc"
clean: false # avoid deleting docs/.git
framework_root: "BugsnagPerformance"
github_file_prefix: "https://github.com/bugsnag/bugsnag-cocoa-performance/tree/v1.6.0/Bugsnag"
github_file_prefix: "https://github.com/bugsnag/bugsnag-cocoa-performance/tree/v1.6.1/Bugsnag"
github_url: "https://github.com/bugsnag/bugsnag-cocoa-performance"
hide_documentation_coverage: true
module: "BugsnagPerformance"
module_version: "1.6.0"
module_version: "1.6.1"
objc: true
output: "docs"
readme: "README.md"
Expand Down
4 changes: 2 additions & 2 deletions BugsnagPerformance.podspec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "BugsnagPerformance",
"version": "1.6.0",
"version": "1.6.1",
"summary": "The Bugsnag performance monitoring framework for iOS.",
"homepage": "https://github.com/bugsnag/bugsnag-cocoa-performance",
"license": {
Expand All @@ -12,7 +12,7 @@
},
"source": {
"git": "https://github.com/bugsnag/bugsnag-cocoa-performance.git",
"tag": "v1.6.0"
"tag": "v1.6.1"
},
"platforms": {
"ios": "13.0"
Expand Down
6 changes: 3 additions & 3 deletions BugsnagPerformanceSwiftUI.podspec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "BugsnagPerformanceSwiftUI",
"version": "1.6.0",
"version": "1.6.1",
"summary": "DEPRECATED. Please use BugsnagPerformanceSwift instead!",
"homepage": "https://github.com/bugsnag/bugsnag-cocoa-performance",
"license": {
Expand All @@ -12,7 +12,7 @@
},
"source": {
"git": "https://github.com/bugsnag/bugsnag-cocoa-performance.git",
"tag": "v1.6.0"
"tag": "v1.6.1"
},
"platforms": {
"ios": "13.0"
Expand All @@ -23,6 +23,6 @@
"SwiftUI"
],
"dependencies": {
"BugsnagPerformance": "1.6.0"
"BugsnagPerformance": "1.6.1"
}
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

## 1.6.1 (2024-06-24)

### Bug fixes

* Fixed a crash on reportNetworkRequestSpan when networkRequestCallback is not set in the configuration. [277](https://github.com/bugsnag/bugsnag-cocoa-performance/pull/277)

## 1.6.0 (2024-06-11)

### Enhancements
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ build_ios_static: ## Build the static library target
build_carthage: ## Build the latest pushed commit with Carthage
@./scripts/build-carthage.sh

build_xcframework: ## Build as a multiplatform xcframework
@./scripts/build-xcframework.sh

build_swift: ## Build with Swift Package Manager
@swift build

Expand Down
6 changes: 5 additions & 1 deletion Sources/BugsnagPerformance/Private/BugsnagPerformanceImpl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@
probabilityValueExpiresAfterSeconds_ = config.internal.probabilityValueExpiresAfterSeconds;
probabilityRequestsPauseForSeconds_ = config.internal.probabilityRequestsPauseForSeconds;
maxPackageContentLength_ = config.internal.maxPackageContentLength;
networkRequestCallback_ = config.networkRequestCallback;

auto networkRequestCallback = config.networkRequestCallback;
if (networkRequestCallback != nullptr) {
networkRequestCallback_ = (BugsnagPerformanceNetworkRequestCallback _Nonnull)networkRequestCallback;
}

configuration_ = config;
persistentState_->configure(config);
Expand Down
2 changes: 1 addition & 1 deletion Sources/BugsnagPerformance/Private/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
#pragma once

#define TELEMETRY_SDK_NAME "bugsnag.performance.cocoa"
#define TELEMETRY_SDK_VERSION "1.6.0"
#define TELEMETRY_SDK_VERSION "1.6.1"
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.0
1.6.1
22 changes: 22 additions & 0 deletions features/default/manual_spans.feature
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,28 @@ Feature: Manual creation of spans
* every span field "endTimeUnixNano" matches the regex "^[0-9]+$"
* every span bool attribute "bugsnag.span.first_class" does not exist

Scenario: Manually start a network span with callback set to nil
Given I run "ManualNetworkSpanCallbackSetToNilScenario"
And I wait for 1 span
Then the trace "Content-Type" header equals "application/json"
* the trace "Bugsnag-Span-Sampling" header is present
* the trace "Bugsnag-Sent-At" header matches the regex "^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\dZ$"
* the trace payload field "resourceSpans.0.resource" string attribute "service.name" equals "com.bugsnag.fixtures.cocoaperformance"
* the trace payload field "resourceSpans.0.resource" string attribute "telemetry.sdk.name" equals "bugsnag.performance.cocoa"
* the trace payload field "resourceSpans.0.resource" string attribute "telemetry.sdk.version" matches the regex "[0-9]\.[0-9]\.[0-9]"
* a span field "name" equals "[HTTP/GET]"
* a span string attribute "http.flavor" exists
* a span string attribute "http.method" equals "GET"
* a span integer attribute "http.status_code" is greater than 0
* a span integer attribute "http.response_content_length" is greater than 0
* a span string attribute "net.host.connection.type" equals "wifi"
* a span field "spanId" matches the regex "^[A-Fa-f0-9]{16}$"
* a span field "traceId" matches the regex "^[A-Fa-f0-9]{32}$"
* a span field "kind" equals 1
* a span field "startTimeUnixNano" matches the regex "^[0-9]+$"
* a span field "endTimeUnixNano" matches the regex "^[0-9]+$"
* every span bool attribute "bugsnag.span.first_class" does not exist

Scenario: Manually start and end a span field "with" batching
Given I run "BatchingScenario"
And I wait for 2 spans
Expand Down
4 changes: 4 additions & 0 deletions features/fixtures/ios/Fixture.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
9657A8992A3CF75B001CEF5D /* AutoInstrumentTabViewLoadScenario.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9657A8982A3CF75B001CEF5D /* AutoInstrumentTabViewLoadScenario.swift */; };
9657A89B2A3D06EB001CEF5D /* AutoInstrumentNavigationViewLoadScenario.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9657A89A2A3D06EB001CEF5D /* AutoInstrumentNavigationViewLoadScenario.swift */; };
967F6F1A29C4AD300054EED8 /* ReleaseStageNotEnabledScenario.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967F6F1929C4AD300054EED8 /* ReleaseStageNotEnabledScenario.swift */; };
96F5268C2C259E4E0095D600 /* ManualNetworkSpanCallbackSetToNilScenario.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96F5268B2C259E4E0095D600 /* ManualNetworkSpanCallbackSetToNilScenario.swift */; };
CB0496942913CA300097E526 /* BatchingWithTimeoutScenario.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB0496932913CA300097E526 /* BatchingWithTimeoutScenario.swift */; };
CB0AD76E2965BBDA002A3FB6 /* InitialPScenario.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB0AD76D2965BBDA002A3FB6 /* InitialPScenario.swift */; };
CB2B8A9D2A0CCEF90054FBBE /* AutoInstrumentFileURLRequestScenario.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB2B8A9C2A0CCEF90054FBBE /* AutoInstrumentFileURLRequestScenario.swift */; };
Expand Down Expand Up @@ -109,6 +110,7 @@
9657A8982A3CF75B001CEF5D /* AutoInstrumentTabViewLoadScenario.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoInstrumentTabViewLoadScenario.swift; sourceTree = "<group>"; };
9657A89A2A3D06EB001CEF5D /* AutoInstrumentNavigationViewLoadScenario.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoInstrumentNavigationViewLoadScenario.swift; sourceTree = "<group>"; };
967F6F1929C4AD300054EED8 /* ReleaseStageNotEnabledScenario.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReleaseStageNotEnabledScenario.swift; sourceTree = "<group>"; };
96F5268B2C259E4E0095D600 /* ManualNetworkSpanCallbackSetToNilScenario.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManualNetworkSpanCallbackSetToNilScenario.swift; sourceTree = "<group>"; };
CB0496932913CA300097E526 /* BatchingWithTimeoutScenario.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BatchingWithTimeoutScenario.swift; sourceTree = "<group>"; };
CB0AD76D2965BBDA002A3FB6 /* InitialPScenario.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InitialPScenario.swift; sourceTree = "<group>"; };
CB211D0629EEB615008F748D /* BugsnagPerformanceConfiguration+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "BugsnagPerformanceConfiguration+Private.h"; path = "../../../../Sources/BugsnagPerformance/Private/BugsnagPerformanceConfiguration+Private.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -233,6 +235,7 @@
CBC90C4229C466BD00280884 /* ForceUBSan.m */,
CB0AD76D2965BBDA002A3FB6 /* InitialPScenario.swift */,
09DA59A42A6E866B00A06EEE /* ManualNetworkCallbackScenario.swift */,
96F5268B2C259E4E0095D600 /* ManualNetworkSpanCallbackSetToNilScenario.swift */,
CBE6B66A28FD66B400D1CF78 /* ManualNetworkSpanScenario.swift */,
09D59E162BDFA23600199E1B /* ManualNetworkTracePropagationScenario.swift */,
01E7918928EC7B5E00855993 /* ManualSpanBeforeStartScenario.swift */,
Expand Down Expand Up @@ -361,6 +364,7 @@
9657A89B2A3D06EB001CEF5D /* AutoInstrumentNavigationViewLoadScenario.swift in Sources */,
01D3A7E028F0290D0063D79E /* AutoInstrumentAppStartsScenario.swift in Sources */,
01E3F99128F46B6700003F44 /* ManualViewLoadScenario.swift in Sources */,
96F5268C2C259E4E0095D600 /* ManualNetworkSpanCallbackSetToNilScenario.swift in Sources */,
01A58C1529096AF4006E4DF7 /* SamplingProbabilityZeroScenario.swift in Sources */,
CB0AD76E2965BBDA002A3FB6 /* InitialPScenario.swift in Sources */,
099331FC2C11F6CF009EC92F /* AutoInstrumentAVAssetScenario.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// ManualNetworkSpanCallbackSetToNilScenario.swift
// Fixture
//
// Created by Robert B on 21/06/2024.
//

import BugsnagPerformance
import os

class MyCallbackSetToNilNetworkDelegate: NSObject {
static let shared = MyCallbackSetToNilNetworkDelegate()
public let urlConfiguration = URLSessionConfiguration.default
public var urlSession: URLSession!

private override init() {
super.init()
self.urlSession = URLSession(configuration: urlConfiguration, delegate: self, delegateQueue: OperationQueue())
}
}

extension MyCallbackSetToNilNetworkDelegate : URLSessionDataDelegate {
func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) {
BugsnagPerformance.reportNetworkRequestSpan(task: task, metrics: metrics)
}
}

@objcMembers
class ManualNetworkSpanCallbackSetToNilScenario: Scenario {

func query(string: String) {
let url = URL(string: string, relativeTo: fixtureConfig.reflectURL)!
MyCallbackSetToNilNetworkDelegate.shared.urlSession.dataTask(with: url).resume()
}

override func configure() {
super.configure()
config.networkRequestCallback = nil
}

override func run() {
query(string: "?status=200")
}
}
123 changes: 123 additions & 0 deletions scripts/build-xcframework.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#!/usr/bin/env bash
#
# Written by: Karl Stenerud
#
# Script to build all platforms, architectures, and simulators into a single xcframework per target.
#
# See https://developer.apple.com/documentation/xcode/creating-a-multi-platform-binary-framework-bundle
#

set -e -u -o pipefail



# -------------------------------------------------------------------
# Configuration
# -------------------------------------------------------------------

# Base name of the .xcodeproj directory
PROJECT_NAME=BugsnagPerformance

# Targets that are suffixed with the platform (e.g. XYZ-iOS, XYZ-macOS etc)
NAMESPACED_TARGETS=( "BugsnagPerformance" )

# Targets that are not namespaced
# Disabled for now due to issue: 'BugsnagPerformanceTrackedViewContainer' is not a member type of class 'BugsnagPerformance.BugsnagPerformance'
# GENERIC_TARGETS=( "BugsnagPerformanceSwift" )
GENERIC_TARGETS=( )

# Platforms we are building for: iOS, macOS, tvOS, watchOS (in future: visionOS)
PLATFORMS=( "iOS" )



# -------------------------------------------------------------------
# Script
# -------------------------------------------------------------------

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
PROJECT_DIR=$( cd -- "$( dirname -- "${SCRIPT_DIR}" )" &> /dev/null && pwd )
XCFW_DIR="${PROJECT_DIR}/build/xcframeworks"
INTERMEDIATES_DIR="${XCFW_DIR}/intermediates"
PRODUCTS_DIR="${XCFW_DIR}/products"

rm -rf "${XCFW_DIR}"
mkdir -p "${INTERMEDIATES_DIR}"
mkdir -p "${PRODUCTS_DIR}"

##
# Build a target. This function tries to sort out whether the target is namespaced or not
# (i.e. if it's named XYZ or XYZ-iOS) so that it produces a consistently named output file
# (such as XYZ-iOS.framework, XYZ-iOS-simulator.framework).
#
# Args:
# 1: Name of compilation target
# 2: Name of platform to build for (iOS, macOS, etc)
#
# Return: A set of commandline argumets for the final framework build.
##
build_target() {
target=$1
platform=$2

framework_name=${target}
if [[ ${framework_name} == *${platform} ]]; then
# If our target is named "XYZ-iOS", remove the "-iOS" part from the framework name
framework_name="${framework_name%-${platform}}"
fi

destination="generic/platform=${platform}"
archive_path="${INTERMEDIATES_DIR}/${target}"
if [[ ${archive_path} != *${platform} ]]; then
# Make sure our archive path is namespaced with the platform
archive_path="${archive_path}-${platform}"
fi
# Note: Redirecting xcodebuild's stdout to stderr because we need stdout for ourselves.
xcodebuild archive -project ${PROJECT_DIR}/${PROJECT_NAME}.xcodeproj \
-scheme ${target} \
-configuration Release \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
-destination "${destination}" \
-archivePath "${archive_path}" 1>&2
echo "-archive ${archive_path}.xcarchive -framework ${framework_name}.framework"

if [ "${platform}" != "macOS" ]; then
# For non-macos targrets, build for the simulator as well.
destination="${destination} Simulator"
archive_path="${archive_path}-simulator"
xcodebuild archive -project ${PROJECT_DIR}/${PROJECT_NAME}.xcodeproj \
-scheme ${target} \
-configuration Release \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
-destination "${destination}" \
-archivePath "${archive_path}" 1>&2
echo "-archive ${archive_path}.xcarchive -framework ${framework_name}.framework"
fi
}

if [[ ${#NAMESPACED_TARGETS[@]} -gt 0 ]]; then
for target in "${NAMESPACED_TARGETS[@]}"; do
xcframework_args=""
for platform in "${PLATFORMS[@]}"; do
new_args=$( build_target ${target}-${platform} ${platform} )
xcframework_args="${xcframework_args} ${new_args}"
done
xcodebuild -create-xcframework ${xcframework_args} -output "${PRODUCTS_DIR}/${target}.xcframework"
done
fi

if [[ ${#GENERIC_TARGETS[@]} -gt 0 ]]; then
for target in "${GENERIC_TARGETS[@]}"; do
xcframework_args=""
for platform in "${PLATFORMS[@]}"; do
new_args=$( build_target ${target} ${platform} )
xcframework_args="${xcframework_args} ${new_args}"
done
xcodebuild -create-xcframework ${xcframework_args} -output "${PRODUCTS_DIR}/${target}.xcframework"
done
fi

echo
echo "** build-frameworks.sh: script completed successfully **"
Loading