Skip to content

Commit

Permalink
Publish version 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzybinary committed Oct 17, 2024
1 parent dff0671 commit e110809
Show file tree
Hide file tree
Showing 32 changed files with 859 additions and 221 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Change Log

## 1.3.0

* Added an option for detecting non-fatal ANRs on Android.
* Added an option for detecting non-fatal app hangs within a given threshold on iOS.
* Added documentation tooltips to the Datadog Options window (on Labels).
* Added support for file / line mappings in C# exceptions through C# Native Stack Mapping
* Make DatadogWorker's message pools thread safe.
* Stop Resources in DatadogTrackedWebRequest if the underlying UnityWebRequest is Disposed.
* Updated iOS SDK to 2.17.0
* Memory warnings are now tracked as RUM errors
* Fix refresh rate vital for variable refresh rate displays
* Updated Android SDK to 2.14.0
* Increase retry delay on DNS error.
* Stop upload worker on upload failure
* Ensure `UploadWorker` uses the SDK instance name.

## 1.2.0

* Add and option to control when trace context headers are injected into web requests (Trace Context Injection).
Expand Down
80 changes: 54 additions & 26 deletions Editor/DatadogConfigurationWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,54 +39,80 @@ public override void OnGUI(string searchContext)
GUILayout.Label("SDK Options", EditorStyles.boldLabel);

_options.Enabled = EditorGUILayout.ToggleLeft(
new GUIContent("Enable Datadog", "Whether the Datadog Plugin should be enabled or not."),
new GUIContent("Enable Datadog", DatadogHelpStrings.EnabledTooltip),
_options.Enabled);
_options.OutputSymbols = EditorGUILayout.ToggleLeft(
new GUIContent(
"Output Symbol Files",
"Whether the Datadog Plugin should output symbol files for crash reporting."),
DatadogHelpStrings.OutputSymbolsTooltip),
_options.OutputSymbols);
EditorGUI.BeginDisabledGroup(!_options.OutputSymbols);
_options.PerformNativeStackMapping = EditorGUILayout.ToggleLeft(
new GUIContent("Perform Native Stack Mapping", DatadogHelpStrings.PerformNativeStackMappingTooltip),
_options.PerformNativeStackMapping);
EditorGUI.EndDisabledGroup();

_options.ClientToken = EditorGUILayout.TextField("Client Token", _options.ClientToken);
_options.Env = EditorGUILayout.TextField("Env", _options.Env);
_options.ServiceName = EditorGUILayout.TextField("Service Name", _options.ServiceName);
_options.Site = (DatadogSite)EditorGUILayout.EnumPopup("Datadog Site", _options.Site);
_options.BatchSize = (BatchSize)EditorGUILayout.EnumPopup("Batch Size", _options.BatchSize);
_options.UploadFrequency = (UploadFrequency)EditorGUILayout.EnumPopup("Upload Frequency", _options.UploadFrequency);
_options.BatchProcessingLevel = (BatchProcessingLevel)EditorGUILayout.EnumPopup("Batch Processing Level", _options.BatchProcessingLevel);
_options.ClientToken = EditorGUILayout.TextField(new GUIContent("Client Token", DatadogHelpStrings.ClientTokenTooltip), _options.ClientToken);
_options.Env = EditorGUILayout.TextField(new GUIContent("Env", DatadogHelpStrings.EnvTooltip), _options.Env);
_options.ServiceName = EditorGUILayout.TextField(new GUIContent("Service Name", DatadogHelpStrings.ServiceNameTooltip), _options.ServiceName);
_options.Site = (DatadogSite)EditorGUILayout.EnumPopup(new GUIContent("Datadog Site", DatadogHelpStrings.SiteTooltip), _options.Site);
_options.BatchSize = (BatchSize)EditorGUILayout.EnumPopup(new GUIContent("Batch Size", DatadogHelpStrings.BatchSizeTooltip), _options.BatchSize);
_options.UploadFrequency = (UploadFrequency)EditorGUILayout.EnumPopup(
new GUIContent("Upload Frequency", DatadogHelpStrings.UploadFrequencyTooltip), _options.UploadFrequency);
_options.BatchProcessingLevel = (BatchProcessingLevel)EditorGUILayout.EnumPopup(
new GUIContent("Batch Processing Level", DatadogHelpStrings.BatchProcessingLevelTooltip), _options.BatchProcessingLevel);
_options.CrashReportingEnabled = EditorGUILayout.ToggleLeft(
new GUIContent("Enable Crash Reporting", "Whether to report native crashes to Datadog."),
new GUIContent("Enable Crash Reporting", DatadogHelpStrings.CrashReportingEnabledTooltip),
_options.CrashReportingEnabled);

EditorGUILayout.Space();
GUILayout.Label("Logging", EditorStyles.boldLabel);
_options.ForwardUnityLogs = EditorGUILayout.ToggleLeft(
new GUIContent("Forward Unity Logs", "Whether calls to Debug.Log functions should be forwarded to Datadog."),
new GUIContent("Forward Unity Logs", DatadogHelpStrings.ForwardUnityLogsTooltip),
_options.ForwardUnityLogs);
_options.RemoteLogThreshold = (LogType)EditorGUILayout.EnumPopup("Remote Log Threshold", _options.RemoteLogThreshold);
_options.RemoteLogThreshold = (LogType)EditorGUILayout.EnumPopup(
new GUIContent("Remote Log Threshold", DatadogHelpStrings.RemoteLogThresholdTooltip), _options.RemoteLogThreshold);

EditorGUILayout.Space();
GUILayout.Label("RUM Options", EditorStyles.boldLabel);
_options.RumEnabled = EditorGUILayout.ToggleLeft(
new GUIContent("Enable RUM", "Whether to enable Real User Monitoring (RUM)"),
new GUIContent("Enable RUM", DatadogHelpStrings.EnableRumTooltip),
_options.RumEnabled);
EditorGUI.BeginDisabledGroup(!_options.RumEnabled);
_options.RumApplicationId = EditorGUILayout.TextField(
new GUIContent("RUM Application Id",DatadogHelpStrings.RUMApplicationIdTooltip), _options.RumApplicationId);
_options.AutomaticSceneTracking = EditorGUILayout.ToggleLeft(
new GUIContent("Enable Automatic Scene Tracking", "Automatically start Datadog Views when Unity Scenes change"),
new GUIContent("Enable Automatic Scene Tracking", DatadogHelpStrings.EnableSceneTrackingTooltip),
_options.AutomaticSceneTracking);
_options.RumApplicationId = EditorGUILayout.TextField("RUM Application Id", _options.RumApplicationId);
_options.SessionSampleRate =
EditorGUILayout.FloatField("Session Sample Rate", _options.SessionSampleRate);
_options.SessionSampleRate = EditorGUILayout.FloatField(
new GUIContent("Session Sample Rate", DatadogHelpStrings.SessionSampleRateTooltip),
_options.SessionSampleRate);
_options.SessionSampleRate = Math.Clamp(_options.SessionSampleRate, 0.0f, 100.0f);
_options.TraceSampleRate =
EditorGUILayout.FloatField("Trace Sample Rate", _options.TraceSampleRate);
_options.TraceContextInjection =
(TraceContextInjection)EditorGUILayout.EnumPopup("Trace Context Injection", _options.TraceContextInjection);
_options.TraceSampleRate = EditorGUILayout.FloatField(
new GUIContent("Trace Sample Rate", DatadogHelpStrings.TraceSampleRateTooltip),
_options.TraceSampleRate);
_options.TraceContextInjection = (TraceContextInjection)EditorGUILayout.EnumPopup(
new GUIContent("Trace Context Injection", DatadogHelpStrings.TraceContextInjectionTooltip),
_options.TraceContextInjection);
_options.TraceSampleRate = Math.Clamp(_options.TraceSampleRate, 0.0f, 100.0f);
_options.TrackNonFatalAnrs = (NonFatalAnrDetectionOption)EditorGUILayout.EnumPopup(
new GUIContent("Track Non-Fatal ANRs", DatadogHelpStrings.TrackNonFatalAnrsTooltip),
_options.TrackNonFatalAnrs);
EditorGUILayout.BeginHorizontal();
_options.TrackNonFatalAppHangs = EditorGUILayout.ToggleLeft(
new GUIContent("Track Non-Fatal App Hangs", DatadogHelpStrings.TrackNonFatalAppHangsTooltip),
_options.TrackNonFatalAppHangs);
EditorGUI.BeginDisabledGroup(!_options.TrackNonFatalAppHangs);
_options.NonFatalAppHangThreshold = EditorGUILayout.FloatField(
new GUIContent("Threshold", DatadogHelpStrings.NonFatalAppHangThresholdTooltip),
_options.NonFatalAppHangThreshold);
EditorGUI.EndDisabledGroup();
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();

GUILayout.Space(12.0f);

GUILayout.Label("First Party Hosts", EditorStyles.boldLabel);
GUILayout.Label(new GUIContent("First Party Hosts", DatadogHelpStrings.FirstPartyHostsTooltip), EditorStyles.boldLabel);
int toRemove = -1;
for (int i = 0; i < _options.FirstPartyHosts.Count; ++i)
{
Expand Down Expand Up @@ -118,10 +144,12 @@ public override void OnGUI(string searchContext)
_showAdvancedOptions = EditorGUILayout.BeginFoldoutHeaderGroup(_showAdvancedOptions, "Advanced RUM Options");
if (_showAdvancedOptions)
{
_options.CustomEndpoint = EditorGUILayout.TextField("Custom Endpoint", _options.CustomEndpoint);
_options.SdkVerbosity = (CoreLoggerLevel)EditorGUILayout.EnumPopup("SDK Verbosity", _options.SdkVerbosity);
_options.TelemetrySampleRate =
EditorGUILayout.FloatField("Telemetry Sample Rate", _options.TelemetrySampleRate);
_options.CustomEndpoint = EditorGUILayout.TextField(
new GUIContent("Custom Endpoint", DatadogHelpStrings.CustomEndpointTooltip), _options.CustomEndpoint);
_options.SdkVerbosity = (CoreLoggerLevel)EditorGUILayout.EnumPopup(
new GUIContent("SDK Verbosity", DatadogHelpStrings.SdkVerbosityTooltip), _options.SdkVerbosity);
_options.TelemetrySampleRate = EditorGUILayout.FloatField(
new GUIContent("Telemetry Sample Rate", DatadogHelpStrings.TelemetrySampleRateTooltip), _options.TelemetrySampleRate);
_options.TelemetrySampleRate = Math.Clamp(_options.TelemetrySampleRate, 0.0f, 100.0f);
}
EditorGUILayout.EndFoldoutHeaderGroup();
Expand Down
14 changes: 7 additions & 7 deletions Editor/DatadogDependencies.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
<repository>https://repo.maven.apache.org/maven2</repository>
<repository>https://oss.sonatype.org/content/repositories/snapshots</repository>
</repositories>
<androidPackage spec="com.datadoghq:dd-sdk-android-rum:2.11.0">
<androidPackage spec="com.datadoghq:dd-sdk-android-rum:2.14.0">
</androidPackage>
<androidPackage spec="com.datadoghq:dd-sdk-android-logs:2.11.0">
<androidPackage spec="com.datadoghq:dd-sdk-android-logs:2.14.0">
</androidPackage>
<androidPackage spec="com.datadoghq:dd-sdk-android-ndk:2.11.0">
<androidPackage spec="com.datadoghq:dd-sdk-android-ndk:2.14.0">
</androidPackage>
</androidPackages>
<iosPods>
<iosPod name="DatadogCore" bitcodeEnabled="false" minTargetSdk="12.0" version="2.14.1" />
<iosPod name="DatadogLogs" bitcodeEnabled="false" minTargetSdk="12.0" version="2.14.1" />
<iosPod name="DatadogRUM" bitcodeEnabled="false" minTargetSdk="12.0" version="2.14.1" />
<iosPod name="DatadogCrashReporting" bitcodeEnabled="false" minTargetSdk="12.0" version="2.14.1" />
<iosPod name="DatadogCore" bitcodeEnabled="false" minTargetSdk="12.0" version="2.17.0" />
<iosPod name="DatadogLogs" bitcodeEnabled="false" minTargetSdk="12.0" version="2.17.0" />
<iosPod name="DatadogRUM" bitcodeEnabled="false" minTargetSdk="12.0" version="2.17.0" />
<iosPod name="DatadogCrashReporting" bitcodeEnabled="false" minTargetSdk="12.0" version="2.17.0" />
</iosPods>
</dependencies>
97 changes: 97 additions & 0 deletions Editor/DatadogHelpStrings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// 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 2024-Present Datadog, Inc.

// ReSharper disable InconsistentNaming
namespace Datadog.Unity.Editor
{
/// <summary>
/// Class to make editing tooltips and help strings easier.
/// </summary>
public static class DatadogHelpStrings
{
public const string EnabledTooltip =
"Enable or disable the Datadog Unity SDK. When disabled, the SDK will not send any data to Datadog.";

public const string OutputSymbolsTooltip =
"Whether to output symbol files as part of the build. Uploading these files to Datadog enables symbolication "
+ "of native stack traces.";

public const string PerformNativeStackMappingTooltip =
"Converts C# stacks traces to native stack traces in non-development builds. This allows for file and line " +
"mapping to C# code if symbol files are uploaded to Datadog. This is not supported if Output Symbols is disabled.";

public const string ClientTokenTooltip = "This is your Client Token created for your application on Datadog’s website.";

public const string EnvTooltip =
"The environment name that will be sent with each event. This can be used to filter your events on "
+ "different environments (e.g. \"staging\" vs. \"production\").";

public const string ServiceNameTooltip =
"The service name for your application. If this is not set it will be set to your application's package " +
"name or bundle name (e.g.: com.example.android)";

public const string SiteTooltip = "The Datadog site to send data to.";

public const string BatchSizeTooltip =
"Sets the preferred size of batched data uploaded to Datadog. This value impacts the size and number of " +
"requests performed by the SDK (small batches mean more requests, but each request becomes smaller in size).";

public const string UploadFrequencyTooltip =
"Sets the preferred frequency of uploading data to Datadog.";

public const string BatchProcessingLevelTooltip =
"Defines the maximum amount of batches processed sequentially without a delay within one reading/uploading cycle.";

public const string CrashReportingEnabledTooltip = "Enables crash reporting in the RUM SDK.";

public const string ForwardUnityLogsTooltip =
"Whether to forward logs made from Unity’s Debug.Log calls to Datadog’s default logger.";

public const string RemoteLogThresholdTooltip =
"The level at which the default logger forwards logs to Datadog. Logs below this level are not sent.";

public const string EnableRumTooltip =
"Whether to enable sending data from Datadog’s Real User Monitoring APIs";

public const string RUMApplicationIdTooltip =
"The RUM Application ID created for your application on Datadog’s website.";

public const string EnableSceneTrackingTooltip =
"Whether Datadog should automatically track new Views by intercepting Unity’s SceneManager loading.";

public const string SessionSampleRateTooltip =
"The percentage rate at which sessions are sampled. A value of 100 means all sessions are sampled and sent to " +
"Datadog. 50 means 50% of sessions are sampled and sent to Datadog.";

public const string TraceSampleRateTooltip =
"The percentage rate at which distributed traces are sampled. A value of 100 means all traces are sampled and sent to " +
"Datadog. 50 means 50% of traces are sampled and sent to Datadog.";

public const string TraceContextInjectionTooltip =
"Defines whether the context for a distributed trace should be injected into all requests or only into requests that are sampled in.";

public const string TrackNonFatalAnrsTooltip =
"(Android Only) Wether to track non-fatal ANRs (Application Not Responding) errors. The \"SDK Default\" option disables ANR" +
"detection on Android 30+ because it would create too much noise over fatal ANRs. On Android 29 and below, however, " +
"the reporting of non-fatal ANRs is enabled by default, as fatal ANRs cannot be reported on those versions.";

public const string TrackNonFatalAppHangsTooltip =
"(iOS Only) Whether to track non-fatal app hangs. App hangs are detected when the app is unresponsive for a certain amount of time.";

public const string NonFatalAppHangThresholdTooltip =
"The amount of time in seconds that the app must be unresponsive before it is considered a non-fatal app hang.";

public const string FirstPartyHostsTooltip =
"To enable distributed tracing, you must specify which hosts are considered “first party” and have trace information injected.";

public const string CustomEndpointTooltip =
"Send data to a custom endpoint instead of the default Datadog endpoint. This is useful for proxying data through a custom server.";

public const string SdkVerbosityTooltip =
"The level of debugging information the Datadog SDK should output. Higher levels will output more information.";

public const string TelemetrySampleRateTooltip =
"The percentage rate at which Datadog sends internal telemetry data. A value of 100 means all telemetry data is sampled and sent to Datadog.";
}
}
3 changes: 3 additions & 0 deletions Editor/DatadogHelpStrings.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions Editor/iOS/PostBuildProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#if UNITY_EDITOR_OSX
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -123,6 +124,7 @@ func initializeDatadog() {{
var additionalConfigurationItems = new List<string>()
{
$" \"{DatadogSdk.ConfigKeys.Source}\": \"unity\"",
$" \"{DatadogSdk.ConfigKeys.NativeSourceType}\": \"ios+il2cpp\"",
};

if (buildId != null)
Expand Down Expand Up @@ -176,11 +178,15 @@ func initializeDatadog() {{

sb.AppendLine($" rumConfig.sessionSampleRate = {options.SessionSampleRate}");
sb.AppendLine($" rumConfig.telemetrySampleRate = {options.TelemetrySampleRate}");
var appHangThreshold =
options.TrackNonFatalAppHangs ? options.NonFatalAppHangThreshold.ToString(CultureInfo.InvariantCulture) : "nil";
sb.AppendLine(
$" rumConfig.appHangThreshold = {appHangThreshold}");

// Uncomment to enable RUM Configuration Telemetry
// sb.AppendLine(@" rumConfig._internal_mutation {
// $0.configurationTelemetrySampleRate = 100.0
// }");
// sb.AppendLine(@" rumConfig._internal_mutation {
// $0.configurationTelemetrySampleRate = 100.0
// }");
sb.AppendLine(" RUM.enable(with: rumConfig)");
}

Expand Down
Loading

0 comments on commit e110809

Please sign in to comment.