• Statistics, monitoring and extra !
  • Standalone
  • Open supply
  • Free to make use of
  • Straightforward to make use of

Summary:

  1. Description
  2. Credits
  3. Download
  4. Installation
  5. Setup
  6. Usage
  7. Examples (and screens)

Description

DataDog-FiveM is a library to communicate with the REST API of the DataDog service (https://www.datadoghq.com/).

For individuals who don’t know, it’s a service that enables to make statistical curves from despatched knowledge. DataDog additionally means that you can do monitoring.


Credits

Idea & Code by Pablo “PABLO-1610
Code evaluation by Jordan “AbsoluteDev


Download

You can download the project from the repo by clicking here: datadog-fivem

This mission is open supply, which implies that I invite all builders who want to contribute and keep this library to take action!


Installation

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.

:globe_with_meridians: To obtain or generate an API key, follow this link

In any other case, use the ddfl:setApiKey occasion by passing your API key as a parameter to the occasion.

Utilization: TriggerEvent("ddfl:setApiKey", "yourApiKeyHere")


Setup

To use DDFL, you must make sure that DDFL is started before any other script that will use it.

:globe_with_meridians: To obtain or generate an application key, follow this link

To make queries, you have to authenticate with an software key. Create your authorization with this line;

TriggerEvent("ddfl:setApplication", "myApplicationName", "myApplicationKey")

TriggerEvent("ddf:setApplication", "myApplicationName", "myApplicationKey", true) (With logs)

You’ll be able to put no matter you need for myApplicationName, it solely serves to determine your software.


Usage

Possible usages


Examples

Creating a simple graph with a single point

Code:

-- Set the API key
TriggerEvent("ddfl:setApiKey", "<yourApiKeyHere>")
-- Create an application instance with a name (just for you) and the app token
TriggerEvent("ddfl:setApplication", "myMonitoringApp", "<yourAppKeyHere>", true)

RegisterCommand("test_metric", function()
    local currentTime, playersCount = os.time(), 25
    TriggerEvent("ddfl:submitMetric", "myMonitoringApp", function(success)
        if (success) then
            print("Players count submitted")
        else
            print("Players count not submitted")
        end
    end, { metric = "myserver.players", type = "gauge", points = { { currentTime, 25 } }, tags = { "filter:all" } })
end)

Result:

Creating multiple points, with one delayed

Code:

-- (...) before this, set API key and app
RegisterCommand("test_metric_multiple", function()
    local currentTime, playersCount = os.time(), 25
    TriggerEvent("ddfl:submitMetric", "myMonitoringApp", function(success)
        if (success) then
            print("2 Players count submitted, with one in the past :o")
        else
            print("2 Players count not submitted")
        end
    end, { metric = "myserver.players.newPlayers", type = "gauge", points = { { currentTime, 10 }, { currentTime - (60*5), 5 } }, tags = { "filter:all" } })
end)

Results:




Looking for paid scripts? Click here