Add the dependency to your project using ROPM, or download the latest zip archive and extract it to your project.
ropm install datadog-roku
Initialize the library with your Datadog client token and Application ID generated when you create a new RUM application in the Datadog UI (see Getting Started with Roku RUM Collection for more information). For security reasons, you must use a client token: you cannot use Datadog API keys to configure the dd-sdk-roku library as they would be exposed client-side in the Roku channel’s package.
sub RunUserInterface(args as dynamic)
screen = CreateObject("roSGScreen")
scene = screen.CreateScene("MyScene")
screen.show()
datadogroku_initialize({
clientToken: "<CLIENT_TOKEN>",
applicationId: "<APPLICATION_ID>"
site: "us1",
env: "<ENV_NAME>",
sessionSampleRate: 100, ' the percentage (integer) of sessions to track
launchArgs: args
})
' complete your channel setup here
end sub
sub RunUserInterface(args as dynamic)
screen = CreateObject("roSGScreen")
scene = screen.CreateScene("MyScene")
screen.show()
datadogroku_initialize({
clientToken: "<CLIENT_TOKEN>",
applicationId: "<APPLICATION_ID>"
site: "eu1",
env: "<ENV_NAME>",
sessionSampleRate: 100, ' the percentage (integer) of sessions to track
launchArgs: args
})
' complete your channel setup here
end sub
sub RunUserInterface(args as dynamic)
screen = CreateObject("roSGScreen")
scene = screen.CreateScene("MyScene")
screen.show()
datadogroku_initialize({
clientToken: "<CLIENT_TOKEN>",
applicationId: "<APPLICATION_ID>"
site: "us3",
env: "<ENV_NAME>",
sessionSampleRate: 100, ' the percentage (integer) of sessions to track
launchArgs: args
})
' complete your channel setup here
end sub
sub RunUserInterface(args as dynamic)
screen = CreateObject("roSGScreen")
scene = screen.CreateScene("MyScene")
screen.show()
datadogroku_initialize({
clientToken: "<CLIENT_TOKEN>",
applicationId: "<APPLICATION_ID>"
site: "us5",
env: "<ENV_NAME>",
sessionSampleRate: 100, ' the percentage (integer) of sessions to track
launchArgs: args
})
' complete your channel setup here
end sub
sub RunUserInterface(args as dynamic)
screen = CreateObject("roSGScreen")
scene = screen.CreateScene("MyScene")
screen.show()
datadogroku_initialize({
clientToken: "<CLIENT_TOKEN>",
applicationId: "<APPLICATION_ID>"
site: "ap1",
env: "<ENV_NAME>",
sessionSampleRate: 100, ' the percentage (integer) of sessions to track
launchArgs: args
})
' complete your channel setup here
end sub
(Optional) When writing your application, you can enable development logs by setting the datadogVerbosity attribute on the global node. All internal messages in the library with a priority equal to or higher than the provided level are then logged to your Roku device’s telnet output:
(Optional) Provide an Associative Array alongside your log message to add attributes to the emitted log. Each entry of the AssocArray is added as an attribute.
All the logs are first stored on the local device in batches. Each batch follows the intake specification. They are sent as soon as network is available. If the network is not available while your channel is opened, or if an upload of data fails, the batch is kept until it can be sent successfully.
To ensure the SDK doesn’t use too much disk space, the data on the disk is automatically discarded if it gets too old.
Note: Before data is uploaded to Datadog, it is stored in cleartext in your channel’s cache directory, meaning that this data can’t be read by other applications. The OS can evict the data at any time, which may result in data loss in some rare cases.