Skip to content

Commit

Permalink
release 1.3.5 (#18)
Browse files Browse the repository at this point in the history
* - Upgraded native iOS Agent to 7.4.9

* added notice failure method with starttime and endtime parameter
  • Loading branch information
ndesai-newrelic committed May 2, 2024
1 parent 503b2ba commit 49567c2
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.3.5

- To address the issue of crashes occurring when using the NoticeFailure method on background threads, we have added StartTime and EndTime parameters to the method. This enhancement should prevent such crashes from happening.
- Upgraded native iOS Agent to 7.4.11
- Upgraded native Android Agent to 7.3.0

## 1.3.4

- Upgraded native iOS Agent to 7.4.10
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,16 @@ See the examples below, and for more detail, see [New Relic IOS SDK doc](https:/
NewRelicAgent.noticeHttpTransaction('https://github.com', 'GET', 200, DateTimeOffset.Now.ToUnixTimeMilliseconds(), DateTimeOffset.Now.ToUnixTimeMilliseconds()+1000, 100, 101, "response body",null);
```

### [noticeNetworkFailure](https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-android/android-sdk-api/notice-network-failure)(string url,string httpMethod,long startTime,long endTime,NewRelicAgent.NetworkFailureCode failureCode,string message): void; or (string url,string httpMethod,Timer timer,NewRelicAgent.NetworkFailureCode failureCode,string message): void;
> Records network failures. If a network request fails, use this method to record details about the failures. In most cases, place this call inside exception handlers, such as catch blocks.
```C#
long startTime = DateTimeOffset.Now.ToUnixTimeMilliseconds();
NewRelic.noticeNetworkFailure('https://github.com', 'GET', startTime, endTime, NewRelic.NetworkFailure.BadURL);

Timer timer = new();
NewRelic.noticeNetworkFailure('https://github.com', 'GET',timer , NewRelic.NetworkFailure.BadURL);
```


### [recordMetric](https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-android/android-sdk-api/recordmetric-android-sdk-api)(string name, string category,double value, NewRelicAgent.MetricUnit valueUnits,NewRelicAgent.MetricUnit countUnits): void;
> Records custom metrics (arbitrary numerical data), where countUnit is the measurement unit of the metric count and valueUnit is the measurement unit for the metric value. If using countUnit or valueUnit, then all of value, countUnit, and valueUnit must all be set.
Expand Down
4 changes: 2 additions & 2 deletions com.newrelic.agent/Editor/TestUnityDependencies.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<dependencies>
<androidPackages>
<androidPackage spec="com.newrelic.agent.android:agent-ndk:1.+"></androidPackage>
<androidPackage spec="com.newrelic.agent.android:android-agent:7.3.0">
<androidPackage spec="com.newrelic.agent.android:android-agent:7.3.1">
</androidPackage>
</androidPackages>
<iosPods>
<iosPod name="NewRelicAgent" version="~> 7.4.10" minTargetSdk="11.0">
<iosPod name="NewRelicAgent" version="~> 7.4.11" minTargetSdk="11.0">
<sources>
<source>https://github.com/CocoaPods/Specs</source>
</sources>
Expand Down
11 changes: 11 additions & 0 deletions com.newrelic.agent/Scripts/Native/NewRelicAndroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,17 @@ override public void noticeNetworkFailure(string url,
pluginInstance.CallStatic("noticeNetworkFailure", url, httpMethod, dateTimeToMillisSinceEpoch(timer.start), dateTimeToMillisSinceEpoch(timer.end), (int)failureCode, message);
}

override public void noticeNetworkFailure(string url,
string httpMethod,
long startTime,
long endTime,
NewRelicAgent.NetworkFailureCode failureCode,
string message)
{
// Invoke the Android agent noticeNetworkFailure(url, httpMethod, startTime, endTime, exception)
pluginInstance.CallStatic("noticeNetworkFailure", url, httpMethod,startTime,endTime, (int)failureCode, message);
}


// Insights Events

Expand Down
33 changes: 27 additions & 6 deletions com.newrelic.agent/Scripts/Native/NewRelicIos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,22 @@ public class NewRelicIos : NewRelic
[DllImport("__Internal")]
private static extern void NR_noticeNetworkRequest(string url, string httpMethod, int statusCode, long startTime, long endTime, long bytesSent, long bytesReceived, string responseBody, System.IntPtr traceAttributes);
[DllImport("__Internal")]
private static extern void NR_noticeNetworkFailure(string url,
private static extern void NR_noticeNetworkFailureWithTimer(string url,
string httpMethod,
System.IntPtr timer,
int failureCode);

//Insights Events
[DllImport("__Internal")]
private static extern void NR_noticeNetworkFailure(string url,
string httpMethod,
long startTime,
long endTime,
int failureCode);

//Insights Events

[DllImport("__Internal")]

[DllImport("__Internal")]
private static extern bool NR_setMaxEventPoolSize(uint size);

[DllImport("__Internal")]
Expand Down Expand Up @@ -383,17 +390,31 @@ override public void noticeNetworkFailure(string url,
NewRelicAgent.NetworkFailureCode failureCode,
string message)
{
NR_noticeNetworkFailure(url,
NR_noticeNetworkFailureWithTimer(url,
httpMethod,
timer.handle,
(int)failureCode);
}

override public void noticeNetworkFailure(string url,
string httpMethod,
long startTime,
long endTime,
NewRelicAgent.NetworkFailureCode failureCode,
string message)
{
NR_noticeNetworkFailure(url,
httpMethod,
startTime,
endTime,
(int)failureCode);
}


// Insights Events
// Insights Events


override public void setMaxEventPoolSize(uint size)
override public void setMaxEventPoolSize(uint size)
{
NR_setMaxEventPoolSize(size);
}
Expand Down
8 changes: 7 additions & 1 deletion com.newrelic.agent/Scripts/Native/NewRelicUnityPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,17 @@ extern "C" {
);


extern void NR_noticeNetworkFailure(const char* url,
extern void NR_noticeNetworkFailureWithTimer(const char* url,
const char* httpMethod,
NRTimer* timer,
int failureCode);

extern void NR_noticeNetworkFailure(const char* url,
const char* httpMethod,
long startTime,
long endTime,
int failureCode);

//Insights Events


Expand Down
18 changes: 17 additions & 1 deletion com.newrelic.agent/Scripts/Native/NewRelicUnityPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ extern void NR_noticeNetworkRequest(const char* URL,
[NewRelic noticeNetworkRequestForURL:url httpMethod:httpMethodString startTime:startTime endTime:endTime responseHeaders:nil statusCode:httpStatusCode bytesSent:bytesSent bytesReceived:bytesSent responseData:data traceHeaders:traceAttributes andParams:nil];
}

extern void NR_noticeNetworkFailure(const char* url,
extern void NR_noticeNetworkFailureWithTimer(const char* url,
const char* httpMethod,
NRTimer* timer,
int failureCode) {
Expand All @@ -414,6 +414,22 @@ extern void NR_noticeNetworkFailure(const char* url,

}

extern void NR_noticeNetworkFailure(const char* url,
const char* httpMethod,
long startTime,
long endTime,
int failureCode) {
NSString* urlString = url?[NSString stringWithUTF8String:url]:nil;
NSString* httpMethodString = httpMethod?[NSString stringWithUTF8String:httpMethod]:nil;

[NewRelic noticeNetworkFailureForURL:urlString?[NSURL URLWithString:urlString]:nil
httpMethod:httpMethodString
startTime:startTime
endTime:endTime
andFailureCode:failureCode];

}

//Insights Events


Expand Down
7 changes: 7 additions & 0 deletions com.newrelic.agent/Scripts/NewRelic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,13 @@ abstract public void noticeNetworkFailure(string url,
NewRelicAgent.NetworkFailureCode failureCode,
string message);

abstract public void noticeNetworkFailure(string url,
string httpMethod,
long startTime,
long endTime,
NewRelicAgent.NetworkFailureCode failureCode,
string message);


// Insights Events

Expand Down
21 changes: 21 additions & 0 deletions com.newrelic.agent/Scripts/NewRelicAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,27 @@ static public void NoticeNetworkFailure(string url,
}
}

/// <summary>
/// records a failed network transaction.
/// </summary>
/// <param name="url">the URL of the request</param>
/// <param name="httpMethod">HTTP method</param>
/// <param name="timer">a timer created when the network request was started</param>
/// <param name="failureCode">Failure code defined from <c>NewRelicAgent.NetworkFailureCode</c> list</param>
/// <param name="message">optional descriptive message, unused in iOS</param>
static public void NoticeNetworkFailure(string url,
string httpMethod,
long startTime,
long endTime,
NewRelicAgent.NetworkFailureCode failureCode,
string message)
{
if (validatePluginImpl())
{
instance.agentInstance.noticeNetworkFailure(url, httpMethod, startTime,endTime, failureCode, message);
}
}


/// <summary>
/// Sets the size of the max event pool.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.newrelic.agent",
"version": "1.3.3",
"version": "1.3.5",
"displayName": "NewRelic SDK",
"description": "NewRelic's Unity SDK lets you bring the deep, introspective and native debugging power of NewRelic into your Unity game or application.",
"unity": "2019.1",
Expand Down

0 comments on commit 49567c2

Please sign in to comment.