1 Introduction
Datadog is a monitoring and analysis tool for cloud applications, providing monitoring of servers, databases, tools, and services, through a SaaS-based data analytics platform. You can link your Mendix Cloud v4 apps to Datadog to provide additional monitoring.
Datadog logging is supported in Mendix version 7.15 and above.
This document explains how to configure your Mendix Cloud v4 app to send data to Datadog.
Datadog is not supported in Mendix Cloud v3, nor in default deployment buildpacks for other cloud platforms.
2 Datadog API Key
To make use of Datadog you will need a Datadog API key. If you already use Datadog, skip to the Existing Datadog User section to learn how to get one.
2.1 New Datadog User
If you are new to Datadog, you will need to get an account first.
- Go to the Datadog site (https://www.datadoghq.com/) and choose GET STARTED FREE.
- Enter your Datadog account details. Once you have entered your details you cannot continue until you have set up your agent.
Choose the option From Source.
Copy the value of DD_API_KEY key shown on the install script.
You now need to use this API key with your app: see Connect Node to Datadog.
2.2 Existing Datadog User
To find your existing API key, or to request a new one for your app, do the following:
- Login to your Datadog account.
Go to the Integrations > API screen.
Copy an existing API Key or create a new one.
For more information on Datadog API keys, see the following page on the Datadog site: How do I reset my Application Keys and related documentation.
3 Connect Node to Datadog
To send your runtime information to Datadog, you need to provide the Datadog API key to your environment.
- Go to the Environments page of your app in the Developer Portal.
- Click Details to select the environment you wish to monitor with Datadog.
- Open the Runtime tab.
- Add a Custom Environment Variable.
Select DD_API_KEY from the Name dropdown.
Enter the Datadog API key, obtained in the Datadog API Key section, above, as the Value of the Environment Variable.
Add a second Custom Environment Variable:
- Name: DD_LOG_LEVEL
- Value: INFO
This will ensure that some messages are sent to Datadog. You can change the log level later once you have confirmed that Datadog is receiving them.
Return to the Environments page for your app and Deploy or Transport your app into the selected environment.
Your app must be redeployed as additional dependencies need to be included.
Restarting the app is not sufficient to start sending data to Datadog.Restart the application.
4 Customizing the Metrics Agent
By default, Mendix will pass a log of request handlers to Datadog.
The following Mendix requests handler calls will be passed to Datadog:
WebserviceRequestHandler
ServiceRequestHandler
– OData requestsRestRequestHandler
ProcessorRequestHandler
ClientRequestHandler
FileRequestHandler
PageUrlRequestHandler
However, it is possible to add activities and microflows to be passed to DataDog, and to restrict which request handler calls are sent, by using JSON to configure the metrics agent.
4.1 Format of Metrics Agent Configuration
You can specify which request handlers, microflows, and activities are reported to Datadog using a JSON configuration with the following format (note that this is the syntax and not an example of this custom setting):
{
"requestHandlers": [
{
"name": "*" | "<requesthandler>"
}
],
"microflows": [
{
"name": "*" | "<microflow>"
}
],
"activities": [
{
"name": "*" | "<activity>"
}
]
}
Value | What Is Sent | Note |
---|---|---|
"name": "*" |
All | Default |
"name": "<requesthandler>" |
All request handler calls of this type | see list of request handlers above |
"name": "<microflow>" |
Each time this microflow is run | The format is <module>.<microflow> For example, TrainingManagement.ACT_CancelScheduledCourse |
"name": "<activity>" |
all activities of this type | click activities1 below to see the list of options |
[1]Activities (click to see list)
The following Mendix activities can be passed to Datadog:
CastObject
ChangeObject
CommitObject
CreateObject
DeleteObject
RetrieveObject
RollbackObject
AggregateList
ChangeList
ListOperation
JavaAction
Microflow
CallRestService
CallWebService
ImportWithMapping
ExportWithMapping
Example
The following example will send logs for:
- All request handlers
- The microflow
After_Startup
in the moduleAdministration
- The
CreateObject
andDeleteObject
activities
{
"requestHandlers": [
{
"name": "*"
}
],
"microflows": [
{
"name": "Administration.After_Startup"
}
],
"activities": [
{
"name": "CreateObject"
},
{
"name": "DeleteObject"
}
]
}
4.2 Passing a Configuration to the Metrics Agent
You pass the configuration to the metrics agent by adding a Custom Runtime Setting to your Mendix Cloud environment.
- Go to the Environments page of your app.
- Click Details next to the environment you have configured for Datadog.
Add a Custom Environment Variable METRICS_AGENT_CONFIG with the value of the JSON required for your configuration.
Click Save.
Restart your app to apply the new settings.
5 Additional Information
5.1 Log Levels
The valid values for DD_LOG_LEVEL are:
- CRITICAL
- ERROR
- WARNING
- INFO
- DEBUG
5.2 Datadog Events Log
The Datadog Events log contains events which come from your app: those are the same events that would appear in the Mendix Console. It does not contain events from the environment.
5.3 Datadog Issues
If you have any issues related to accessing Datadog, please contact their support here: Support | Datadog, or by email at support@datadoghq.com.