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 1.9.0 #546

Merged
merged 6 commits into from
Oct 30, 2023
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 example-new-architecture/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PODS:
- DatadogSDKCrashReporting (1.22.0):
- DatadogSDK (= 1.22.0)
- PLCrashReporter (~> 1.11.0)
- DatadogSDKReactNative (1.8.5):
- DatadogSDKReactNative (1.9.0):
- DatadogSDK (~> 1.22.0)
- DatadogSDKCrashReporting (~> 1.22.0)
- RCT-Folly (= 2021.07.22.00)
Expand Down Expand Up @@ -942,7 +942,7 @@ SPEC CHECKSUMS:
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DatadogSDK: 46e1a7363bc3130fae151ec4aedf11ea291517c5
DatadogSDKCrashReporting: 24a0e6ec6db905cdeb174721962a7941b2f8a9d2
DatadogSDKReactNative: f5aebd969f859454689ca16326520c65a4eb3725
DatadogSDKReactNative: 28e1439d5a240608b84c1516b7770e231388cfcf
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: ddb55c55295ea51ed98aa7e2e08add2f826309d5
FBReactNativeSpec: 33a87f65f1a467d5f63d11d0cc106a10d3b0639d
Expand Down
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PODS:
- DatadogSDKCrashReporting (1.22.0):
- DatadogSDK (= 1.22.0)
- PLCrashReporter (~> 1.11.0)
- DatadogSDKReactNative (1.8.5):
- DatadogSDKReactNative (1.9.0):
- DatadogSDK (~> 1.22.0)
- DatadogSDKCrashReporting (~> 1.22.0)
- React-Core
Expand Down Expand Up @@ -530,7 +530,7 @@ SPEC CHECKSUMS:
boost: 57d2868c099736d80fcd648bf211b4431e51a558
DatadogSDK: 46e1a7363bc3130fae151ec4aedf11ea291517c5
DatadogSDKCrashReporting: 24a0e6ec6db905cdeb174721962a7941b2f8a9d2
DatadogSDKReactNative: 1cd2c5ca0673e9fc83ad4b44b2c14f90cce9d53c
DatadogSDKReactNative: 92e7f7fb2e1231d35b22971e899efe863bd43d8d
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: ddb55c55295ea51ed98aa7e2e08add2f826309d5
FBReactNativeSpec: 90fc1a90b4b7a171e0a7c20ea426c1bf6ce4399c
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"npmClient": "yarn",
"version": "1.8.5",
"version": "1.9.0",
"packages": [
"packages/*"
],
Expand Down
4 changes: 2 additions & 2 deletions packages/codepush/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@datadog/mobile-react-native-code-push",
"version": "1.8.5",
"version": "1.9.0",
"description": "A client-side React Native module to interact with Appcenter Codepush and Datadog",
"keywords": [
"datadog",
Expand Down Expand Up @@ -38,7 +38,7 @@
"prepare": "rm -rf lib && yarn bob build"
},
"devDependencies": {
"@datadog/mobile-react-native": "^1.8.5",
"@datadog/mobile-react-native": "^1.9.0",
"@testing-library/react-native": "7.0.2",
"react-native-builder-bob": "0.17.1",
"react-native-code-push": "7.0.5"
Expand Down
10 changes: 10 additions & 0 deletions packages/core/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ def getExtOrIntegerDefault(name) {
android {
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
buildToolsVersion getExtOrDefault('buildToolsVersion')
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
if (agpVersion.tokenize('.')[0].toInteger() >= 7) {
namespace = "com.datadog.reactnative"
}
if (agpVersion.tokenize('.')[0].toInteger() >= 8) {
buildFeatures {
buildConfig = true
}
}

defaultConfig {
minSdkVersion 21
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
Expand Down
5 changes: 2 additions & 3 deletions packages/core/ios/Sources/DdTraceImplementation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,13 @@ public class DdTraceImplementation: NSObject {
public func finishSpan(spanId: NSString, context: NSDictionary, timestampMs: Double, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
objc_sync_enter(self)
let optionalSpan = spanDictionary.removeValue(forKey: spanId)
objc_sync_exit(self)

if let span = optionalSpan {
set(tags: castAttributesToSwift(context).mergeWithGlobalAttributes(), to: span)
let timeIntervalSince1970: TimeInterval = timestampMs / 1_000
span.finish(at: Date(timeIntervalSince1970: timeIntervalSince1970))
}

objc_sync_exit(self)

resolve(nil)
}

Expand Down
6 changes: 5 additions & 1 deletion packages/core/ios/Tests/DdTraceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ internal class DdTraceTests: XCTestCase {
}

func testTracingConcurrently() {
// It is possible and acceptable that a concurrent finishSpan resolve is called on a different thread before we get the lastResolveValue.
// This would override lastResolveValue to be `nil`. To avoid this, we use a different resolve.
func mockFinishResolve(args: Any?) {}

let iterationCount = 30
DispatchQueue.concurrentPerform(iterations: iterationCount) { iteration in
tracer.startSpan(
Expand All @@ -149,7 +153,7 @@ internal class DdTraceTests: XCTestCase {
reject: mockReject
)
let spanID = lastResolveValue as! NSString
tracer.finishSpan(spanId: spanID, context: testTags, timestampMs: 100, resolve: mockResolve, reject: mockReject)
tracer.finishSpan(spanId: spanID, context: testTags, timestampMs: 100, resolve: mockFinishResolve, reject: mockReject)
}

XCTAssertEqual(mockNativeTracer.startedSpans.count, iterationCount, "\(mockNativeTracer.startedSpans)")
Expand Down
1 change: 1 addition & 0 deletions packages/core/jest/mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const actualDatadog = jest.requireActual('@datadog/mobile-react-native');
const DatadogProviderMock = ({ children }) => {
return <>{children}</>;
};
DatadogProviderMock.initialize = jest.fn().mockResolvedValue();

module.exports = {
...actualDatadog,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@datadog/mobile-react-native",
"version": "1.8.5",
"version": "1.9.0",
"description": "A client-side React Native module to interact with Datadog",
"keywords": [
"datadog",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// generated by genversion
export const version = '1.8.5';
export const version = '1.9.0';
4 changes: 2 additions & 2 deletions packages/react-native-navigation/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@datadog/mobile-react-native-navigation",
"version": "1.8.5",
"version": "1.9.0",
"description": "A client-side React Native module to interact with Datadog",
"keywords": [
"datadog",
Expand Down Expand Up @@ -36,7 +36,7 @@
"prepare": "rm -rf lib && yarn bob build"
},
"devDependencies": {
"@datadog/mobile-react-native": "^1.8.5",
"@datadog/mobile-react-native": "^1.9.0",
"@testing-library/react-native": "7.0.2",
"react-native-builder-bob": "0.17.1",
"react-native-gesture-handler": "1.10.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-webview/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@datadog/mobile-react-native-webview",
"version": "1.8.5",
"version": "1.9.0",
"description": "A client-side React Native module to interact with react-native-webview and Datadog",
"keywords": [
"datadog",
Expand Down
20 changes: 20 additions & 0 deletions packages/react-native-webview/src/NativeDdSdk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2016-Present Datadog, Inc.
*/

import type { TurboModule } from 'react-native';
import { TurboModuleRegistry } from 'react-native';

/**
* We have to redefine the spec for the Native SDK here to be able to use the new architecture.
* We don't declare it in a spec file so we don't end up with a duplicate definition of the native module.
*/
interface PartialNativeDdSdkSpec extends TurboModule {
consumeWebviewEvent(message: string): Promise<void>;
telemetryError(message: string, stack: string, kind: string): Promise<void>;
}
export const NativeDdSdk = TurboModuleRegistry.get<PartialNativeDdSdkSpec>(
'DdSdk'
);
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2016-Present Datadog, Inc.
*/
import { NativeModules } from 'react-native';
import { NativeDdSdk } from '../NativeDdSdk';

export function formatAllowedHosts(allowedHosts?: string[]): string {
try {
return `'${JSON.stringify(allowedHosts)}'`;
} catch (e: any) {
if (NativeModules.DdSdk && NativeModules.DdSdk.telemetryError) {
NativeModules.DdSdk.telemetryError(
if (NativeDdSdk) {
NativeDdSdk.telemetryError(
getErrorMessage(e),
getErrorStackTrace(e),
'AllowedHostsError'
Expand Down
12 changes: 1 addition & 11 deletions packages/react-native-webview/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
*/
import type { WebViewMessageEvent, WebViewProps } from 'react-native-webview';
import { WebView as RNWebView } from 'react-native-webview';
import type { TurboModule } from 'react-native';
import { TurboModuleRegistry } from 'react-native';
import React, { forwardRef, useCallback } from 'react';

import { NativeDdSdk } from './NativeDdSdk';
import {
DATADOG_MESSAGE_PREFIX,
getInjectedJavaScriptBeforeContentLoaded
Expand Down Expand Up @@ -50,12 +49,3 @@ const WebViewComponent = (props: Props, ref: React.Ref<RNWebView<Props>>) => {
export const WebView = forwardRef(WebViewComponent);

export default WebView;

/**
* We have to redefine the spec for the Native SDK here to be able to use the new architecture.
* We don't declare it in a separate file so we don't end up with a duplicate definition of the native module.
*/
interface PartialNativeDdSdkSpec extends TurboModule {
consumeWebviewEvent(message: string): Promise<void>;
}
const NativeDdSdk = TurboModuleRegistry.get<PartialNativeDdSdkSpec>('DdSdk');
4 changes: 2 additions & 2 deletions packages/react-navigation/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@datadog/mobile-react-navigation",
"version": "1.8.5",
"version": "1.9.0",
"description": "A client-side React Native module to interact with Datadog",
"keywords": [
"datadog",
Expand Down Expand Up @@ -36,7 +36,7 @@
"prepare": "rm -rf lib && yarn bob build"
},
"devDependencies": {
"@datadog/mobile-react-native": "^1.8.5",
"@datadog/mobile-react-native": "^1.9.0",
"@react-navigation/native-v5": "npm:@react-navigation/[email protected]",
"@react-navigation/native-v6": "npm:@react-navigation/[email protected]",
"@react-navigation/stack-v5": "npm:@react-navigation/[email protected]",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3510,7 +3510,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@datadog/mobile-react-native-code-push@workspace:packages/codepush"
dependencies:
"@datadog/mobile-react-native": ^1.8.5
"@datadog/mobile-react-native": ^1.9.0
"@testing-library/react-native": 7.0.2
react-native-builder-bob: 0.17.1
react-native-code-push: 7.0.5
Expand All @@ -3526,7 +3526,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@datadog/mobile-react-native-navigation@workspace:packages/react-native-navigation"
dependencies:
"@datadog/mobile-react-native": ^1.8.5
"@datadog/mobile-react-native": ^1.9.0
"@testing-library/react-native": 7.0.2
react-native-builder-bob: 0.17.1
react-native-gesture-handler: 1.10.3
Expand Down Expand Up @@ -3554,7 +3554,7 @@ __metadata:
languageName: unknown
linkType: soft

"@datadog/mobile-react-native@^1.8.5, @datadog/mobile-react-native@workspace:packages/core":
"@datadog/mobile-react-native@^1.9.0, @datadog/mobile-react-native@workspace:packages/core":
version: 0.0.0-use.local
resolution: "@datadog/mobile-react-native@workspace:packages/core"
dependencies:
Expand All @@ -3570,7 +3570,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@datadog/mobile-react-navigation@workspace:packages/react-navigation"
dependencies:
"@datadog/mobile-react-native": ^1.8.5
"@datadog/mobile-react-native": ^1.9.0
"@react-navigation/native-v5": "npm:@react-navigation/[email protected]"
"@react-navigation/native-v6": "npm:@react-navigation/[email protected]"
"@react-navigation/stack-v5": "npm:@react-navigation/[email protected]"
Expand Down