Skip to main content

Monitor MarkLogic Server

Configure telemetry with XQuery

You can also configure telemetry using the Telemetry APIs. See APIs for telemetry for the complete list. Here are a few examples of configuring telemetry using XQuery. You can run these examples in the Query Console. To set the telemetry log level with XQuery:

xquery version "1.0-ml";
import module namespace admin = "http://marklogic.com/xdmp/admin"
  at "/MarkLogic/admin.xqy";
let $config := admin:get-configuration()
let $groupid := admin:group-get-id($config, "Default")
let $value := "finest"
let $tlogconfig := admin:group-set-telemetry-log-level($config, $groupid, $value)
return
admin:save-configuration($tlogconfig)

To check the telemetry log configuration, use this query:

xquery version "1.0-ml";
import module namespace admin = "http://marklogic.com/xdmp/admin"
  at "/MarkLogic/admin.xqy";
  
let $config := admin:get-configuration()
let $groupid := admin:group-get-id($config, "Default")
return
admin:group-get-telemetry-log-level($config, $groupid)
=>
finest

To see the type of metering data that is being collected by telemetry, you can use the admin:group-get-telemetry-metering() function.

xquery version "1.0-ml";
import module namespace admin = "http://marklogic.com/xdmp/admin"
  at "/MarkLogic/admin.xqy";
let $config := admin:get-configuration()
return
admin:group-get-telemetry-metering($config,
  admin:group-get-id($config, "Default"))
=>
daily

To see whether telemetry usage data is being collected by telemetry, you can use the admin:group-get-telemetry-usage function.

xquery version "1.0-ml";
import module namespace admin = "http://marklogic.com/xdmp/admin" 
at "/MarkLogic/admin.xqy";
let $config := admin:get-configuration()
let $groupid := admin:group-get-id($config, "Default")
return admin:group-get-telemetry-usage($config, $groupid)
=>
enabled

To see the type of proxy server URL that is being used by telemetry, you can use the admin:group-get-telemetry-proxy function.

xquery version "1.0-ml";
import module namespace admin = "http://marklogic.com/xdmp/admin"
  at "/MarkLogic/admin.xqy";
let $config := admin:get-configuration()
return
admin:group-get-telemetry-proxy($config,
  admin:group-get-id($config, "Default"))
=>
"https://proxy.marklogic.com:8080"