Skip to content

Commit

Permalink
Add SDK information (#176)
Browse files Browse the repository at this point in the history
* Bump sentry-cocoa to 3.4.0
* Add sdk info for react native events on ios
* Set sdk on android
  • Loading branch information
HazAT committed Aug 8, 2017
1 parent 4a9206f commit 7da31f6
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
@@ -1,6 +1,6 @@
[submodule "ios/Sentry"]
path = ios/Sentry
url = https://github.com/getsentry/sentry-swift
url=https://github.com/getsentry/sentry-cocoa
[submodule "ios/KSCrash"]
path = ios/KSCrash
url=https://github.com/kstenerud/KSCrash
Expand Down
3 changes: 3 additions & 0 deletions .travis.yml
@@ -1,3 +1,6 @@
branches:
only:
- master
matrix:
include:
- language: android
Expand Down
6 changes: 3 additions & 3 deletions SentryReactNative.podspec
Expand Up @@ -7,7 +7,7 @@ Pod::Spec.new do |s|
s.name = 'SentryReactNative'
s.version = package['version']
s.license = 'MIT'
s.summary = 'Official Sentry client for react-native'
s.summary = 'Official Sentry SDK for react-native'
s.author = 'Sentry'
s.homepage = "https://github.com/getsentry/react-native-sentry"
s.source = { :git => 'https://github.com/getsentry/react-native-sentry.git', :tag => "#{s.version}"}
Expand All @@ -18,8 +18,8 @@ Pod::Spec.new do |s|
s.preserve_paths = '*.js'

s.dependency 'React'
s.dependency 'Sentry', '~> 3.3.3'
s.dependency 'Sentry/KSCrash', '~> 3.3.3'
s.dependency 'Sentry', '~> 3.4.0'
s.dependency 'Sentry/KSCrash', '~> 3.4.0'

s.source_files = 'ios/RNSentry*.{h,m}'
s.public_header_files = 'ios/RNSentry.h'
Expand Down
12 changes: 10 additions & 2 deletions android/src/main/java/io/sentry/RNSentryModule.java
Expand Up @@ -22,9 +22,11 @@
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
Expand All @@ -37,6 +39,7 @@
import io.sentry.event.BreadcrumbBuilder;
import io.sentry.event.Event;
import io.sentry.event.EventBuilder;
import io.sentry.event.Sdk;
import io.sentry.event.User;
import io.sentry.event.UserBuilder;
import io.sentry.event.helper.ShouldSendEventCallback;
Expand All @@ -49,6 +52,8 @@
public class RNSentryModule extends ReactContextBaseJavaModule {

private static final Pattern mJsModuleIdPattern = Pattern.compile("(?:^|[/\\\\])(\\d+\\.js)$");
private static final String versionString = "0.15.2";
private static final String sdkName = "sentry-react-native";

private final ReactApplicationContext reactContext;
private final ReactApplication reactApplication;
Expand Down Expand Up @@ -291,8 +296,11 @@ public static Event buildEvent(EventBuilder eventBuilder) {
}
}

eventBuilder.withSdkIntegration("react-native");
return eventBuilder.build();
Event event = eventBuilder.build();
Set<String> sdkIntegrations = new HashSet<>();
sdkIntegrations.add("sentry-java");
event.setSdk(new Sdk(sdkName, versionString, sdkIntegrations));
return event;
}

public static <T> List<T> copyIterator(Iterator<T> iter) {
Expand Down
3 changes: 2 additions & 1 deletion appium/tests/test_ios.py
Expand Up @@ -19,7 +19,8 @@ def test_send_message(driver):
assert event['message'] == 'TEST message'
assert event['extra']['react']
assert event['tags']['react'] == '1'
assert event['sdk']['integrations'][0] == 'react-native'
assert event['sdk']['integrations'][0] == 'sentry-cocoa'
assert event['sdk']['name'] == 'sentry-react-native'
assert len(event['user']) > 0


Expand Down
2 changes: 1 addition & 1 deletion examples
7 changes: 6 additions & 1 deletion ios/RNSentry.m
Expand Up @@ -9,6 +9,9 @@
#import <KSCrash/KSCrash.h>
#import <Sentry/Sentry.h>

NSString *const RNSentryVersionString = @"0.15.2";
NSString *const RNSentrySdkName = @"sentry-react-native";

@interface RNSentry()

@property (nonatomic, strong) NSDictionary *lastReceivedException;
Expand Down Expand Up @@ -175,7 +178,9 @@ - (void)setReleaseVersionDist:(SentryEvent *)event {
if (event.extra[@"__sentry_dist"]) {
event.dist = [NSString stringWithFormat:@"%@", event.extra[@"__sentry_dist"]];
}
[event.extra setValue:@[@"react-native"] forKey:@"__sentry_sdk_integrations"];
event.sdk = @{@"name": RNSentrySdkName,
@"version": RNSentryVersionString,
@"integrations": @[@"sentry-cocoa"]};
}

RCT_EXPORT_MODULE()
Expand Down

0 comments on commit 7da31f6

Please sign in to comment.