Skip to content

MetricsManagement

GitHub Actions Bot edited this page May 19, 2023 · 2 revisions

title: MetricsManagement

MetricsManagement Module


Version MetricsManagement 1.0.0

Table of Contents

Usage

To use the MetricsManagement module, you can import it into your project from the Firebolt SDK:

import { MetricsManagement } from '@firebolt-js/ripple-rpc'

Overview

Methods for managing the metrics integrations

Methods

addContext

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

Examples

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}

removeContext

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

Examples

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}

Types

MetricsContext

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
}

Clone this wiki locally