Initialize
Enrich TenXSummary instances produced by an aggregator using custom JavaScript constructors.
Enriching summary instances with calculated fields provides a method for creating dynamic tag dimensions when publishing to metric outputs (e.g., Prometheus).
Calculated summary fields can combine data from:
-
The aggregated values extracted from TenXObjects grouped into the current summary instance.
-
TSV/CSV lookup files.
To load custom summary .js files at run time see JavaScript configuration.
The example below enriches summary instances with HTTP message lookup value:
// Extend the TenXSummary class to define a custom ctor
export default tenx.
/**
* Input constructors can initialize specific resources at the start of pipeline execution.
*/
export class HttpInput extends TenXInput {
/**
* This constructor loads the 'http.csv' lookup table to enrich instances of 'HttpSummary' below.
*/
constructor() {
if !TenXLookup.load("data/run/lookup/http.csv", true)
throw new Error("could not load HTTP lookup!");
}
export class HttpSummary extends TenXSummary {
/**
* This constructor calculates an HTTP message for TenXSummaries by translating the numeric 'code'
* value into a human-readable 'reason' message which can be used as a metric dimension
*/
constructor() {
if (this.code) this.reason = TenXLookup.get("http", this.code);
}
}
Options
Specify the options below to configure multiple Summary JavaScript:
| Name | Description |
|---|---|
| summaryActionsClassName | JavaScript class name |
| summaryActions | 10x JavaScript statement to execute |
| summaryActionsFile | Declaring .js file |
summaryActionsClassName
JavaScript class name.
| Type | Required | Names |
|---|---|---|
| String | ✔ | [summaryActionsClassName, TenXSummaryClassName] |
Specifies the JavaScript class name in which summaryActions are defined.
summaryActions
10x JavaScript statement to execute.
| Type | Default | Names |
|---|---|---|
| List | [] | [summaryActions, TenXSummary] |
JavaScript statements for initializing target aggregator(s) TenXSummary instances.
NOTE: This argument is not designed to be set directly, but instead by passing a .js launch file containing these statements nested within an TenXSummary sub-class constructor as command line argument as described above.
summaryActionsFile
Declaring .js file.
| Type | Default | Names |
|---|---|---|
| String | "" | [summaryActionsFile, TenXSummaryFile] |
Specifies the .js file name declaring summaryActions.
This unit is defined in summary/unit.yaml.