API Docs for: 0.8.3
Show:

MojitoPerf Class

Methods

dump

() Array private

Dumps all marks and timeline entries into the console. This method is meant to be called automatically when a request ends. You can target specific metrics by using the configuration:

"perf": { "include": { "mojito-action-context": true } }

Or just exclude some of them by doing:

"perf": { "exclude": { "mojito-action-context": true } }

Returns:

Array: collection of perf logs. Each item will expose: {type, requestId, time, duration, group, label, id, desc}

idFromCommand

(
  • command
)
String private

Produces an ID to identify the timeline or mark based on a command object.

Parameters:

  • command Object

    Object that represent the command to invoke.

Returns:

String: ID that represents the command.

instrumentMojitoRequest

(
  • req
  • res
)

Instruments requests that will be processed by mojito core, providing a valid timeline for that request, and allowing to instrument some other relative processes, and grouping them per request to facilitate analysis. This method is responsible for calling "dump".

Parameters:

  • req Object

    the request object from express.

  • res Object

    the response object from express.

mark

(
  • group
  • label
  • msg
  • id
)
Object

Sets a mark in the request timeline. All marks will be flushed after the end. This is useful to measure when a particular process start or end with respect to the request timeline.

Parameters:

  • group String

    Event group.

  • label String

    Event identifier. Will be combined with group.

  • msg String

    Description of the mark.

  • id String | Object

    Unique identifier of the mark, usually the requestId or a command object.

Returns:

Object: The mark entry.

timeline

(
  • group
  • label
  • msg
  • id
)
Object

Starts a timeline metric, providing a way to call it done at some point in the future. This is useful to measure the time to execute a process in mojito.

Parameters:

  • group String

    Event group.

  • label String

    Event identifier. Will be combined with group.

  • msg String

    Description of the mark.

  • id String

    Unique identifier of the mark, usually the requestId or the yuid().

Returns:

Object: represents the timeline object that has a method called "done" that can be invoked when the process finish.

timeline

(
  • group
  • label
  • msg
  • id
)
Object

Starts a timeline metric, providing a way to call it done at some point in the future. This is useful to measure the time to execute a process in mojito.

Parameters:

  • group String

    Event group.

  • label String

    Event identifier. Will be combined with group.

  • msg String

    Description of the mark.

  • id String

    Unique identifier of the mark, usually the requestId or the yuid().

Returns:

Object: represents the timeline object that has a method called "done" that can be invoked when the process finish.