- 필수 기능
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- 디지털 경험
- 소프트웨어 제공
- 보안
- 로그 관리
- 관리
- 인프라스트럭처
- ci
- containers
- csm
- ndm
- otel_guides
- overview
- slos
- synthetics
- tests
- 워크플로
Unity Monitoring is in public beta.
Datadog Real User Monitoring (RUM) enables you to visualize and analyze user journeys of your application’s individual users.
Datadog does not support Desktop (Windows, Mac, or Linux), console, or web deployments from Unity. If you have a game or application and want to use Datadog RUM to monitor its performance, create a ticket with Datadog support.
Unity
as the application type.To ensure the safety of your data, you must use a client token. For more information about setting up a client token, see the Client Token documentation.
You can control the data your application sends to Datadog RUM during instrumentation of the RUM Unity SDK. Specify the Session Sample Rate as a percentage between 0 and 100 in the Project Settings window in Unity.
Install External Dependency Manager for Unity (EDM4U). This can be done using Open UPM.
Add the Datadog SDK Unity package from its Git URL at https://github.com/DataDog/unity-package.
Configure your project to use Gradle templates, and enable both Custom Main Template
and Custom Gradle Properties Template
.
In the iOS setting for External Dependency Manager (Assets > External Dependency Manager > iOS Resolver > Settings), disable the Link frameworks statically option and ensure that Allow the same pod to be in multiple targets is enabled.
If you build and receive Duplicate class
errors (common in Unity 2022.x), add the following block in the dependencies
block in your mainTemplate.gradle
:
constraints {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0") {
because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib")
}
}
After adding the Datadog Unity SDK, configure Datadog from your Project Settings:
Client Token
and Application Id
into the fields in the settings window.Site
is correct.In order to be compliant with data protection and privacy policies, the Datadog Unity SDK requires setting a tracking consent value.
The trackingConsent
setting can be one of the following values:
TrackingConsent.Pending
: The Unity SDK starts collecting and batching the data but does not send it to Datadog. The Unity SDK waits for the new tracking consent value to decide what to do with the batched data.TrackingConsent.Granted
: The Unity SDK starts collecting the data and sends it to Datadog.TrackingConsent.NotGranted
: The Unity SDK does not collect any data. No logs are sent to Datadog.Before Datadog sends any data, we need to confirm the user’s Tracking Consent
. This is set to TrackingConsent.Pending
during initialization,
and needs to be set to TrackingConsent.Granted
before Datadog sends any information.
DatadogSdk.Instance.SetTrackingConsent(TrackingConsent.Granted);
You can intercept and send logs from Unity’s default debug logger by enabling the option and threshold in your projects settings.
Datadog maps the Unity levels to the following in Datadog’s Logging Levels:
Unity LogType | Datadog Log Level |
---|---|
Log | Info |
Error | Error |
Assert | Critical |
Warning | Warn |
Exception | Critical |
You can access this default logger to add attributes or tags through the DatadogSdk.DefaultLogger
property.
You can also create additional loggers for more fine grained control of thresholds, service names, logger names, or to supply additional attributes.
var logger = DatadogSdk.Instance.CreateLogger(new DatadogLoggingOptions()
{
SendNetworkInfo = true,
DatadogReportingThreshold = DdLogLevel.Debug,
});
logger.Info("Hello from Unity!");
logger.Debug("Hello with attributes", new()
{
{ "my_attribute", 122 },
{ "second_attribute", "with_value" },
{ "bool_attribute", true },
{
"nested_attribute", new Dictionary<string, object>()
{
{ "internal_attribute", 1.234 },
}
},
});
To manually track new Scenes (Views
in Datadog), use the StartView
and StopView
methods:
public void Start()
{
DatadogSdk.Instance.Rum.StartView("My View", new()
{
{ "view_attribute": "active" }
});
}
Starting a new view automatically ends the previous view.
You can also set Enable Automatic Scene Tracking
in your Project Settings to enable automatically tracking active scenes. This uses Unity’s SceneManager.activeSceneChanged
event to automatically start new scenes.
Datadog offers DatadogTrackedWebRequest
, which is a UnityWebRequest
wrapper intended to be a drop-in replacement for UnityWebRequest
. DatadogTrackedWebRequest
enables Datadog Distributed Tracing.
To enable Datadog Distributed Tracing, you must set the First Party Hosts
in your project settings to a domain that supports distributed tracing. You can also modify the sampling rate for distributed tracing by setting the Tracing Sampling Rate
.
First Party Hosts
does not allow wildcards, but matches any subdomains for a given domain. For example, api.example.com matches staging.api.example.com and prod.api.example.com, but not news.example.com.