Jump to: navigation, search


orion/metrics is the place for logging runtime events and timings to be consumed by an analytics engine. The API follows:

logEvent(category, action, label, value)

The parameters are essentially categorizations of the event progressing from least- to most-specific.

(required) The String name of the category to log to
(required) The String name of the action to report the event for
(required) The String label for the event
(optional) The Number value to log with the event

A base set of category/action groups has been established (listed below). New kinds of events to be logged should try to fit into an existing group when possible in order to keep the set of namespaces under control. If there really isn't a good place for your new event in the current set of groups then a new category and/or action can be defined (and please update the list below).

Most category/action groups should be self-explanatory, possibly with the exception of the "ui" category. This category is for tracking UI-level events or details that are not already captured by other events. For instance, tracking that a particular button was pressed (if a command is invokable from different places), tracking when a particular UI element is touched or hovered over, etc.

The base set of categories and variables in use are:

Category Action Since
command invoke 8.0
contentAssist activate 8.0
contentAssist apply 8.0
contextMenu open 9.0
editor action 8.0
editor open 8.0
help open 8.0
language tools quickfix 9.0
preferenceChange - 8.0
runtime uncaughtError 8.0
runtime uncaughtErrorStack 9.0
shell invoke 8.0
status error 8.0
status exception 8.0
status success 8.0
status warning 8.0
invoke - 8.0

logTiming(timingCategory, timingVar, timingValue, timingLabel)

This is similar to log event but is for recording timings. The function takes four parameters as follows:

(required) The String name of the category to log the timing to
(required) The String name of the variable to log the timing to
(required) The Number in milliseconds of the timing. Timings to be logged should be explicitly measured using Date.now() or performance.now() to record the start and end times. To get the overall timing, subtract the start from the end to determine the interval.
(required) The String label for the timing

Note that if you're timing something during page loading then the new HTML5 performance variable may be helpful. All current page load timings make use of this.

The base set of categories and variables in use are:

Category Variable Since
language tools parse 9.0
language tools validation 9.0
page complete 8.0
page interactive 8.0
deployment deploy 9.0
deployment restart 9.0
deployment stop 9.0
deployment check status 9.0
deployment retrieve logs 9.0