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

feat: Performance monitoring #909

Merged
merged 18 commits into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/buildandtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches:
- master
- release/**
- feat/performance-monitoring
bruno-garcia marked this conversation as resolved.
Show resolved Hide resolved
pull_request:

jobs:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## unreleased

- feat: Expand SentrySpanContext through SentryTransaction #919
- feat: Performance Monitoring API
- feat: Add sendDefaultPii to SentryOptions #923

## 6.1.4
Expand Down
17 changes: 12 additions & 5 deletions Samples/iOS-ObjectiveC/iOS-ObjectiveC/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand All @@ -24,7 +24,7 @@
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="AVC-4r-eVc">
<rect key="frame" x="8" y="116.5" width="398" height="180"/>
<rect key="frame" x="8" y="116.5" width="398" height="210"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rUC-at-hwU">
<rect key="frame" x="0.0" y="0.0" width="398" height="30"/>
Expand Down Expand Up @@ -62,8 +62,15 @@
<action selector="captureException:" destination="BYZ-38-t0r" eventType="touchUpInside" id="ezD-qB-SSr"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="PFR-up-CPy">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="I9B-iL-of0">
<rect key="frame" x="0.0" y="150" width="398" height="30"/>
<state key="normal" title="captureTransaction"/>
<connections>
<action selector="captureTransaction:" destination="BYZ-38-t0r" eventType="touchUpInside" id="uaN-VO-vJA"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="PFR-up-CPy">
<rect key="frame" x="0.0" y="180" width="398" height="30"/>
<state key="normal" title="crash"/>
<connections>
<action selector="crash:" destination="BYZ-38-t0r" eventType="touchUpInside" id="6xT-zA-EZI"/>
Expand All @@ -85,7 +92,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="133" y="139"/>
<point key="canvasLocation" x="12" y="3"/>
</scene>
</scenes>
<resources>
Expand Down
10 changes: 10 additions & 0 deletions Samples/iOS-ObjectiveC/iOS-ObjectiveC/ViewController.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#import "ViewController.h"

@import Sentry;

@interface
Expand Down Expand Up @@ -99,6 +100,15 @@ - (IBAction)captureException:(id)sender
[SentrySDK captureException:exception withScope:scope];
}

- (IBAction)captureTransaction:(id)sender
{
SentryTransaction *fakeTransaction = [SentrySDK startTransactionWithName:@"Some Transaction"];

dispatch_after(
dispatch_time(DISPATCH_TIME_NOW, (int64_t)(arc4random_uniform(100) + 400 * NSEC_PER_MSEC)),
dispatch_get_main_queue(), ^{ [fakeTransaction finish]; });
}

- (IBAction)crash:(id)sender
{
[SentrySDK crash];
Expand Down
15 changes: 11 additions & 4 deletions Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17126"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand All @@ -24,7 +24,7 @@
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="480-5y-FtF">
<rect key="frame" x="8" y="95.5" width="398" height="210"/>
<rect key="frame" x="8" y="95.5" width="398" height="240"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QJW-l9-sD6">
<rect key="frame" x="0.0" y="0.0" width="398" height="30"/>
Expand Down Expand Up @@ -68,8 +68,15 @@
<action selector="captureNSException:" destination="BYZ-38-t0r" eventType="touchUpInside" id="BT7-dZ-MrB"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lgF-Uq-3Bb">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cdR-H3-8fr">
<rect key="frame" x="0.0" y="180" width="398" height="30"/>
<state key="normal" title="captureTransaction"/>
<connections>
<action selector="captureTransaction:" destination="BYZ-38-t0r" eventType="touchUpInside" id="kff-pT-Uf4"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lgF-Uq-3Bb">
<rect key="frame" x="0.0" y="210" width="398" height="30"/>
<state key="normal" title="crash"/>
<connections>
<action selector="crash:" destination="BYZ-38-t0r" eventType="touchUpInside" id="imm-ZO-4Af"/>
Expand Down
7 changes: 7 additions & 0 deletions Samples/iOS-Swift/iOS-Swift/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ class ViewController: UIViewController {
SentrySDK.capture(exception: exception, scope: scope)
}

@IBAction func captureTransaction(_ sender: Any) {
let transaction = SentrySDK.startTransaction(name: "Some Transaction")
DispatchQueue.main.asyncAfter(deadline: .now() + Double.random(in: 0.4...0.6), execute: {
transaction.finish()
})
}

@IBAction func crash(_ sender: Any) {
SentrySDK.crash()
}
Expand Down
23 changes: 17 additions & 6 deletions Samples/macOS-Swift/macOS-Swift/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17156"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17701"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -732,15 +732,15 @@
</connections>
</buttonCell>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0rS-ee-VAF">
<rect key="frame" x="179" y="88" width="126" height="32"/>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="c5W-zA-19P">
<rect key="frame" x="163" y="89" width="160" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Sentry.crash()" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="k1V-IH-Ru7">
<buttonCell key="cell" type="push" title="captureTransaction" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="OVU-vi-LRM">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="sentryCrash:" target="XfG-lQ-9wD" id="8gG-2n-QOP"/>
<action selector="captureTransaction:" target="XfG-lQ-9wD" id="5CC-xI-gEt"/>
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nAm-U5-PON">
Expand All @@ -765,6 +765,17 @@
<action selector="captureUserFeedback:" target="XfG-lQ-9wD" id="gH0-NO-T7d"/>
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0rS-ee-VAF">
<rect key="frame" x="180" y="57" width="126" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Sentry.crash()" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="k1V-IH-Ru7">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="sentryCrash:" target="XfG-lQ-9wD" id="8gG-2n-QOP"/>
</connections>
</button>
</subviews>
</view>
</viewController>
Expand Down
7 changes: 7 additions & 0 deletions Samples/macOS-Swift/macOS-Swift/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ class ViewController: NSViewController {
NSApp.perform("_crashOnException:", with: exception)
}

@IBAction func captureTransaction(_ sender: Any) {
let transaction = SentrySDK.startTransaction(name: "Some Transaction")
DispatchQueue.main.asyncAfter(deadline: .now() + Double.random(in: 0.4...0.6), execute: {
transaction.finish()
})
}

@IBAction func sentryCrash(_ sender: Any) {
SentrySDK.crash()
}
Expand Down
11 changes: 11 additions & 0 deletions Samples/tvOS-Swift/tvOS-Swift/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ struct ContentView: View {
SentrySDK.capture(exception: exception, scope: scope)
}

var captureTransactionAction: () -> Void = {
let transaction = SentrySDK.startTransaction(name: "Some Transaction")
DispatchQueue.main.asyncAfter(deadline: .now() + Double.random(in: 0.4...0.6), execute: {
transaction.finish()
})
}

var body: some View {
VStack {
Button(action: addBreadcrumbAction) {
Expand All @@ -63,6 +70,10 @@ struct ContentView: View {
Text("Capture NSException")
}

Button(action: captureTransactionAction) {
Text("Capture Transaction")
}

Button(action: {
SentrySDK.crash()
}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ struct ContentView: View {
SentrySDK.capture(exception: exception, scope: scope)
}

var captureTransaction: () -> Void = {
let transaction = SentrySDK.startTransaction(name: "Some Transaction")
DispatchQueue.main.asyncAfter(deadline: .now() + Double.random(in: 0.4...0.6), execute: {
transaction.finish()
})
}

var body: some View {
ScrollView {
VStack {
Expand All @@ -45,6 +52,10 @@ struct ContentView: View {
Button(action: captureNSExceptionAction) {
Text("Capture NSException")
}

Button(action: captureTransaction) {
Text("Capture Transaction")
}
}
}
}
Expand Down