DDFL allows your FiveM server to interact with the DataDog REST API through HTTP requests. This can be useful if you want to monitor your server, measure its growth or simply collect statistics.
To install this library, you just need to download it (or clone it)
and then add ensure datadog-fivem
to your server.cfg
.
If you want, you can define your API key directly using the convar datadog_api_key
.
🌐 To obtain or generate an API key, follow this link
Otherwise, use the ddfl:setApiKey
event by passing your API key as a parameter to the event.
Usage: TriggerEvent("ddfl:setApiKey", "yourApiKeyHere")
To use DDFL, you must make sure that DDFL is started before any other script that will use it.
🌐 To obtain or generate an application key, follow this link
To make queries, you must authenticate with an application key. Create your authorization with this line;
TriggerEvent("ddfl:setApplication", "myApplicationName", "myApplicationKey")
TriggerEvent("ddf:setApplication", "myApplicationName", "myApplicationKey", true)
(With logs)
You can put whatever you want for myApplicationName
, it only serves to identify your application.
Here are the current possible queries
Requiered:
metricTable
Usage:
TriggerEvent("ddfl:submitMetric", "myApplication", function(success)
-- Code
end, metricTable)
Example:
TriggerEvent("ddfl:submitMetric", "myApplication", function(success)
if (success) then
print("Metric submitted")
else
print("Metric failed to submit")
end
end, { metric = "test.metric", type = "gauge", points = { { os.time(), 1.5 } }, tags = { "user:me", "test:ok" } })
Requiered:
from
Optional:
host
tag
Usage:
TriggerEvent("ddfl:getActiveMetrics", "myApplication", function(data)
local metrics = data.metrics
for k,v in pairs(metrics) do
print("-> " .. v)
end
end, from, host, tag)
Example: WIP
Requiered:
metric_name
Usage:
TriggerEvent("ddfl:getMetricMetadata", "myApplication", function(data)
print(json.encode(data))
end, metric_name)
Example: WIP
Warning: only accessible for Metrics without Limits™ users
Requiered:
metric_name
Usage:
TriggerEvent("ddfl:getMetricTagConfiguration", "myApplication", function(data)
print(json.encode(data))
end, metric_name)
Example: WIP
✅ • Submit Metrics (usage)
✅ • Get active metrics (usage)
✅ • Get metric metadata (usage)
✅ • Get metric tag configuration (usage)
⌛ • Create a tag configuration
⌛ • Edit metric metadata
⌛ • Edit tag configuration
⌛ • Delete tag configuration
⌛ • Search metrics
⌛ • List tag configuration
⌛ • Get timeseries points
⌛ • List tags by metric name
⌛ • List distinct metric volume by metric name