Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@servicenow/ui-metrics
Advanced tools
`@servicenow/ui-metrics` is the performance instrumentation and metrics parsing library used by Seismic. It creates marker entries at specific code execution points in Seismic as described in the following sections. The library can also be used to define
@servicenow/ui-metrics
is the performance instrumentation and metrics parsing library used by Seismic. It creates marker entries at specific code execution points in Seismic as described in the following sections. The library can also be used to define custom metrics to be marked by components, but that need should be rare, if ever. Additionally, the parsing code that gets the markers and collates the data in a meaningful and useful fashion can be imported and used by reporting libraries and tests both in production and development.
The metrics described in this section can be marked by some or all Seismic components based on the metric levels and enablement options described in the following section. The metrics below are annotated with their corresponding level.
ERROR
is marked when the Seismic Sandbox catches an error. [5]GQL
is marked directly before the GQL effect XHR call is made. [4]HTTP
is marked directly before the HTTP effect XHR call is made. [4]DISPATCH
is marked when an event is dispatched. [3]RENDER_START
is marked directly before the component renderer onChange
function is called. [2]RENDER_END
is marked directly after the component renderer onChange
function call has completed. [2]RENDER_TREE
is marked after the component and all descendant renders have completed. [2]UPDATE_PROPERTIES
is marked directly before a scheduled property update is applied. [1]UPDATE_STATE
is marked directly before a scheduled state update is applied. [1]
SCHEDULE
is marked when code execution is scheduled. This includes, but is not limited to, state updates, property updates, dispatches, and renders. [1]DEFER
is marked when the execution of code is intentionally deferred. [1]PROPERTY_REFLECTION
is marked when the corresponding property attributes are updated in the DOM. [1]EFFECT_START
is marked directly before an effect function is executed. [0]EFFECT_END
is marked directly after an effect function is executed. [0]PATCH_START
is marked directly before Snabbdom patches the DOM. [0]PATCH_END
is marked directly after Snabbdom patches the DOM. [0]HOOK_START
is marked directly before a Snabbdom hook function executes.HOOK_END
is marked directly after a Snabbdom hook function executes.Enabling metrics can be done globally and/or on a component instance basis. The order of precedence for determining what metrics a component instance will mark during code execution are as follows:
nowMetricTypes
propertynowMetricsLevel
propertywindow.nowUiFramework.metricTypes
window.nowUiFramework.metricsLevel
Global variables must be set before importing Seismic.
Metrics can be accessed by importing and calling getMarkers
, i.e.,
import {getMarkers} from '@servicenow/ui-metrics';
const markers = getMarkers();
getMarkers
returns an array of marker objects. Marker objects are chronologically ordered. Below are the marker object properties.
startTime
: Marker timeinteractionId
: Unique identifier of interaction to which the marker belongscomponentName
: Name of the component that created markercomponentId
: Unique identifier of component instance that created markerevent
: Name of event that was markedlabels
: Variable data related to marked eventmeta
: Additional data specific to the event type, e.g., GQL or HTTP resource entry (XHR request data)Client interactions are identified by the interactionId
property of a marker item returned by getMarkers
. A client interaction can be initiated in two ways:
eventHandlers
, responds to a native eventAll subsequent events, updates, renders, etc. that are a direct result from code execution at one of these entry points are part of a single interaction.
Custom metrics can be defined by calling defineMetric(name, level)
once and then calling mark(host, interactionId, event, labels)
at the point of interest in the code. The interactionId
can be retrieved calling getInteractionId(action.meta)
. labels
should be delimited by :
. Labels should be scalar values.
FAQs
Seismic Metrics Library
The npm package @servicenow/ui-metrics receives a total of 102 weekly downloads. As such, @servicenow/ui-metrics popularity was classified as not popular.
We found that @servicenow/ui-metrics demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.