flash.profiler

# Telemetry - AS3

Package | flash.profiler
Class | public final class Telemetry
Inheritance | Telemetry Object

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 11.4, AIR 3.4

The Telemetry class lets an application profile ActionScript code and register handlers for commands

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | connected : Boolean [static] [read-only] Indicates whether Telemetry is connected to a server | Telemetry
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | spanMarker : Number [static] [read-only] Returns a marker for use with Telemetry.sendSpanMetric | Telemetry

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | registerCommandHandler(commandName:String, handler:Function):Boolean [static] Register a function that can be called by issuing a command over a socket Returns true if the registration is successful. | Telemetry
|  | sendMetric(metric:String, value:*):void [static] Requests a custom metric from Telemetry. | Telemetry
|  | sendSpanMetric(metric:String, startSpanMarker:Number, value:* = null):void [static] Requests a custom span metric from Telemetry Use Telemetry.spanMarker to get a marker at the start of function to be profiled and call Telemetry.sendSpanMetric at the end of function with the marker. | Telemetry
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | unregisterCommandHandler(commandName:String):Boolean [static] | Telemetry
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Property Detail

### connected

property

`connected:Boolean` [read-only]

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 11.4, AIR 3.4

Indicates whether Telemetry is connected to a server

Implementation
`public static function get connected():Boolean`

### spanMarker

property

`spanMarker:Number` [read-only]

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 11.4, AIR 3.4

Returns a marker for use with `Telemetry.sendSpanMetric`

Implementation
`public static function get spanMarker():Number`

Related API Elements

sendSpanMetric()
Method Detail

### registerCommandHandler

()
method

`public static function registerCommandHandler(commandName:String, handler:Function):Boolean`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 11.4, AIR 3.4

Register a function that can be called by issuing a command over a socket

Returns true if the registration is successful. If registration fails, there is already a handler registered for the command used (or the command name starts with '.', which is reserved for player internal use) Already registered handlers may be unregistered using unregisterCommandHandler before registering another handler.

The handler function's return value is sent as the result of the command (`tlm-response.result`). The handler function can throw Error, if it wants to send an error response. In this case, `Error.message` and `Error.id` are sent as `tlm-response.tlm-error.message` and `tlm-response.tlm-error.code`, respectively. (`tlm-response.result` and `tlm-response.tlm-error.data` are sent as null)

Parameters

| `commandName:String` — String specifying a unique name (The command over the socket should specify this string as the method name). The guideline is to follow reverse DNS notation, which helps to avoid namespace collisions. Additionally, and names starting with . are reserved for native use.
| `handler:Function` — Function to be called when a command is received by Telemetry over the socket with the method name, as specified in functionId argument. The handler should accept only one argument of type Array (as defined by `tlm-method.params` in Telemetry Protocol), which has to be sent by Telemetry server along with method name.

Returns

| `Boolean`

### sendMetric

()
method

`public static function sendMetric(metric:String, value:*):void`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 11.4, AIR 3.4

Requests a custom metric from Telemetry. The metric name and object are sent as per the Telemetry protocol format.

The guideline for custom metric namespaces is to follow reverse DNS notation, which helps to avoid namespace collisions.

Parameters

| `metric:String` — Metric name
| `value:*` — Any primitive value/object containing the metric details

Throws

| `ArgumentError` — If metric uses reserved namespaces like flash native namespace (for example, if the metric name starts with '.')

### sendSpanMetric

()
method

`public static function sendSpanMetric(metric:String, startSpanMarker:Number, value:* = null):void`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 11.4, AIR 3.4

Requests a custom span metric from Telemetry

Use `Telemetry.spanMarker` to get a marker at the start of function to be profiled and call `Telemetry.sendSpanMetric` at the end of function with the marker. Telemetry sends the name, starting marker, and duration of the function plus the optional value as per the Telemetry protocol.

The guideline for custom metric namespaces is to follow reverse DNS notation, which helps to avoid namespace collisions.

Span metrics for durations less than a specified threshold, which could be controlled from the Telemetry Server using Telemetry Protocol, would be ignored by Telemetry (will not be sent to Telemetry Server).

Parameters

| `metric:String` — Metric name
| `startSpanMarker:Number` — Start marker.
| `value:*` (default = `null`)`` — Optional parameter. Any primitive value/object to be sent along with name, marker and duration

Throws

| `ArgumentError` — If metric uses reserved namespaces like flash native namespace (i.e. if metric name starts with '.')

Related API Elements

spanMarker
sendSpanMetric()

### unregisterCommandHandler

()
method

`public static function unregisterCommandHandler(commandName:String):Boolean`

Parameters

| `commandName:String`

Returns

| `Boolean`

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00