@appland/models v2.10.2
About
The models contained in src
are useful for manipulating data extracted from AppMaps
created by https://github.com/applandinc/appmap-ruby,
https://github.com/applandinc/appmap-java, or
https://github.com/applandinc/appland-browser-extension .
Table of Contents
API Reference
AppMap
Represents an AppMap. If pre-processing or normalization is required, see AppMapBuilder.
const appmap = new AppMap(data);
version
Returns the version of the AppMap.
metadata
Returns an object containing the AppMap's metadata section.
name
Returns the name of the AppMap. This is shorthand for metadata.name
.
events
Returns the raw event array.
classMap
Returns an object representing the AppMap's class map section.
rootEvent
Returns the root CallNode
, essentially the root of the call stack.
AppMapBuilder
AppMapBuilder allows for pre-processing of data before constructing an AppMap.
const appmap = buildAppMap()
.source(await fromFile(file))
.prune(cmd.size)
.normalize()
.build();
buildAppMap
Begins the construction of an AppMap with the ability to add pre-processing
transformations. A data
object or JSON string can be supplied instead of
calling source
.
event
Add an event transform. This transform will be called for each event still
remaining in the AppMap after chunk
and stack
transforms have completed. The
transform must return event data or undefined
.
builder.event((e) => {
if (e.event === 'return') {
delete e.path;
delete e.lineno;
}
return e;
})
stack
Add a stack transform. This transform will be called for each complete call
call stack still remaining in the AppMap after chunk
transforms have
completed. The transform must an array of events or undefined
.
chunk
Add a chunk transform. This transform will be called for each "chunk" in the AppMap. A chunk may consist of many or one stacks.
source
Specifies the data source. This method will accept stringified JSON or a JSON object.
const appmap = buildAppMap()
.source(await fromUrl(url))
.build();
prune
Prune the event array to fit within a specified size in bytes. This method
applies a chunk
transformation to remove the largest and most frequent event
types.
// Cut down the AppMap event array to ~2MB
const appmap = buildAppMap()
.source(await fromUrl(url))
.prune(2 /* MB */ * 1024 * 1024)
.build();
normalize
Normalize cleans up common issues in an AppMap event array. This includes:
- re-indexing of events
- ordering by thread execution
- re-balancing the stack if methods were still executing when recording stopped
If you're unsure of whether or not your AppMap requires normalization, it likely does.
const appmap = buildAppMap()
.source(await fromFile(path))
.normalize()
.build();
build
Executes and finalizes pre-processing, returning an AppMap
with the
results. Pre-processing transforms are run in the following order:
chunk -> stack -> event
collectEvents
Collects and runs transforms the sorted event array. This method is slow and subsequent calls to this method are not cached.
18 days ago
2 months ago
5 months ago
6 months ago
6 months ago
10 months ago
7 months ago
8 months ago
10 months ago
11 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago