Skip to content

Commit

Permalink
Merge pull request #12 from signalfx/dvernon/splunkOtel_0.11.0_fix
Browse files Browse the repository at this point in the history
Update for SplunkOtel 0.11.0 & Podspec
  • Loading branch information
dvernon-splunk authored Jul 31, 2023
2 parents 303ce30 + 458eb69 commit 734f391
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 11 deletions.
38 changes: 38 additions & 0 deletions SplunkOtelCrashReporting.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# NOTE: Be sure to run
#
# `pod lib lint SplunkOtelCrashReporting.podspec`
#
# to ensure this is a valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
s.name = 'SplunkOtelCrashReporting'
s.version = '0.6.0'
s.summary = 'Splunk OpenTelemetry Crash Reporting pod for iOS'
s.description = <<-DESC
The Splunk RUM agent for iOS provides a Swift package that captures:
HTTP requests, using URLSession instrumentation
Application startup information
UI activity - screen name (typically ViewController name), actions, and PresentationTransitions
Crashes/unhandled exceptions using SplunkRumCrashReporting
🚧 This project is currently in BETA. It is officially supported by Splunk. However, breaking changes MAY be introduced.
DESC

s.swift_version = '5.1'
s.cocoapods_version = '>= 1.10'

s.homepage = 'https://github.com/signalfx/splunk-otel-ios.git'
s.license = { :type => "Apache", :file => 'LICENSE' }
s.author = { 'Splunk' => 'www.splunk.com' }
s.source = { :git => 'https://github.com/signalfx/splunk-otel-ios-crashreporting.git', :tag => s.version.to_s }
# Make sure the deployment target matches with Package.swift
s.ios.deployment_target = '11.0'
s.source_files = 'SplunkRumCrashReporting/SplunkRumCrashReporting/**/*.swift'
s.static_framework = true
s.dependency 'PLCrashReporter', '~> 1.11.1'
s.dependency 'SplunkOtel', '~> 0.11.0'
end
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@
repositoryURL = "https://github.com/microsoft/plcrashreporter";
requirement = {
kind = exactVersion;
version = 1.9.0;
version = 1.11.1;
};
};
86D31808271655B300B43379 /* XCRemoteSwiftPackageReference "splunk-otel-ios" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ limitations under the License.
import Foundation
import CrashReporter
import SplunkOtel
import OpenTelemetryApi

let CrashReportingVersionString = "0.5.0"
// Make sure the version numbers on the podspec and CrashReporting.swift match
let CrashReportingVersionString = "0.6.0"

var TheCrashReporter: PLCrashReporter?
private var customDataDictionary: [String: String] = [String: String]()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ limitations under the License.
import SplunkOtel
import Foundation
import XCTest
import OpenTelemetryApi
import OpenTelemetrySdk

var localSpans: [SpanData] = []

Expand All @@ -47,8 +45,14 @@ class CrashTests: XCTestCase {
let crashPath = Bundle(for: CrashTests.self).url(forResource: "sample_v1", withExtension: "plcrash")!
let crashData = try Data(contentsOf: crashPath)

SplunkRum.initialize(beaconUrl: "http://127.0.0.1:8989/v1/traces", rumAuth: "FAKE", options: SplunkRumOptions(allowInsecureBeacon: true, debug: true))
OpenTelemetrySDK.instance.tracerProvider.addSpanProcessor(SimpleSpanProcessor(spanExporter: TestSpanExporter()))
SplunkRumBuilder(beaconUrl: "http://127.0.0.1:8989/v1/traces", rumAuth: "FAKE")
.allowInsecureBeacon(enabled: true)
.debug(enabled: true)
.build()
let tracerProvider = TracerProviderBuilder()
.add(spanProcessor: SimpleSpanProcessor(spanExporter: TestSpanExporter()))
.build()
OpenTelemetry.registerTracerProvider(tracerProvider: tracerProvider)
localSpans.removeAll()

SplunkRumCrashReporting.start()
Expand Down Expand Up @@ -79,14 +83,20 @@ class CrashTests: XCTestCase {
let crashPath = Bundle(for: CrashTests.self).url(forResource: "sample_v2", withExtension: "plcrash")!
let crashData = try Data(contentsOf: crashPath)

SplunkRum.initialize(beaconUrl: "http://127.0.0.1:8989/v1/traces", rumAuth: "FAKE", options: SplunkRumOptions(allowInsecureBeacon: true, debug: true))
OpenTelemetrySDK.instance.tracerProvider.addSpanProcessor(SimpleSpanProcessor(spanExporter: TestSpanExporter()))
SplunkRumBuilder(beaconUrl: "http://127.0.0.1:8989/v1/traces", rumAuth: "FAKE")
.allowInsecureBeacon(enabled: true)
.debug(enabled: true)
.build()
let tracerProvider = TracerProviderBuilder()
.add(spanProcessor: SimpleSpanProcessor(spanExporter: TestSpanExporter()))
.build()
OpenTelemetry.registerTracerProvider(tracerProvider: tracerProvider)
localSpans.removeAll()

SplunkRumCrashReporting.start()
try loadPendingCrashReport(crashData)

XCTAssertEqual(localSpans.count, 4)
XCTAssertEqual(localSpans.count, 2)
let crashReport = localSpans.first(where: { (span) -> Bool in
return span.name == "SIGTRAP"
})
Expand Down
15 changes: 14 additions & 1 deletion fullbuild.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
#!/bin/bash
set -e
set -ex
swiftlint --strict

# Make sure the version numbers on the podspec and CrashReporting.swift match
echo "Checking that version numbers match"
rumVer="$(grep CrashReportingVersionString SplunkRumCrashReporting/SplunkRumCrashReporting/CrashReporting.swift | grep -o '[0-9]*\.[0-9]*\.[0-9]*')"
podVer="$(grep s.version SplunkOtelCrashReporting.podspec | grep -o '[0-9]*\.[0-9]*\.[0-9]*')"
if [ $podVer != $rumVer ]; then
echo "Error: The version numbers in SplunkOtelCrashReporting.podspec and SplunkRum.swift do not match"
exit 1
fi

# Check the podspec is valid
pod lib lint SplunkOtelCrashReporting.podspec

xcodebuild -project SplunkRumCrashReporting/SplunkRumCrashReporting.xcodeproj -scheme SplunkRumCrashReporting -configuration Debug build
xcodebuild -project SplunkRumCrashReporting/SplunkRumCrashReporting.xcodeproj -scheme SplunkRumCrashReporting -configuration Debug test
xcodebuild -project SplunkRumCrashReporting/SplunkRumCrashReporting.xcodeproj -scheme SplunkRumCrashReporting -configuration Release build
Expand Down

0 comments on commit 734f391

Please sign in to comment.