-
Notifications
You must be signed in to change notification settings - Fork 12
MetricsManagement
GitHub Actions Bot edited this page Jun 2, 2023
·
2 revisions
Version MetricsManagement 1.0.0-next.2
To use the MetricsManagement module, you can import it into your project from the Firebolt SDK:
import { MetricsManagement } from '@firebolt-js/ripple-rpc'
Methods for managing the metrics integrations
Add context that can be applied to all metrics reporting
function addContext(context: MetricsContext): Promise<null>
Parameters:
Param | Type | Required | Description |
---|---|---|---|
context |
MetricsContext |
true | The context to add for metrics |
Promise resolution:
null
Capabilities:
Role | Capability |
---|---|
manages | xrn:firebolt:capability:metrics:context |
Set the deviceSessionId
JavaScript:
import { MetricsManagement } from '@firebolt-js/ripple-rpc'
MetricsManagement.addContext({"deviceSessionId":"ccccc-cccc-cccc-cccc-cccccccc"})
.then(results => {
console.log(results)
})
Value of results
:
null
JSON-RPC:
Request:{
"jsonrpc": "2.0",
"id": 1,
"method": "MetricsManagement.addContext",
"params": {
"context": {
"deviceSessionId": "ccccc-cccc-cccc-cccc-cccccccc"
}
}
}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": null
}
${end.method}
Remove context that was previously added by Metrics.addContext
function removeContext(keys: 'deviceSessionId'[]): Promise<null>
Parameters:
Param | Type | Required | Description |
---|---|---|---|
keys |
'deviceSessionId'[] |
true | The list of keys to clear context for values: 'deviceSessionId'
|
Promise resolution:
null
Capabilities:
Role | Capability |
---|---|
manages | xrn:firebolt:capability:metrics:context |
Remove the override for deviceSessionId
JavaScript:
import { MetricsManagement } from '@firebolt-js/ripple-rpc'
MetricsManagement.removeContext(["deviceSessionId"])
.then(result => {
console.log(result)
})
Value of result
:
null
JSON-RPC:
Request:{
"jsonrpc": "2.0",
"id": 1,
"method": "MetricsManagement.removeContext",
"params": {
"keys": [
"deviceSessionId"
]
}
}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": null
}
${end.method}
Context that is used when the platform sends any metrics
type MetricsContext = {
deviceSessionId?: string // A unique id that identifies a sessionId correlating to the scope of when the user has interacted with the device. This sessionId should be reset any time the device goes to the active power state
}