Skip to content

Function

Options

Specify the options below to configure multiple Function JavaScript:

Name Description
functionFuncName JavaScript function name
functionClassName JavaScript class name
functionType Specify the type of function
functionActions Function statements
functionFile Declaring .js file

functionFuncName

JavaScript function name.

Type Required
String

JavaScript statements for initializing target input(s) TenxTemplates.

NOTE: This argument is not designed to be set directly, but instead by passing a .js launch file containing these statements nested within an TenXObject sub-class constructor as command line argument as described above.

functionClassName

JavaScript class name.

Type Required
String

JavaScript statements for initializing target input(s) TenxTemplates.

NOTE: This argument is not designed to be set directly, but instead by passing a .js launch file containing these statements nested within an TenXObject sub-class constructor as command line argument as described above.

functionType

Specify the type of function.

Type Required
String
Context Description Execution Timing Purpose Example Use Case
Instance Refers to custom subclasses of TenXObject or similar instance-level classes, where code operates on individual data instances (e.g., events or objects). Executed for each instance created during pipeline processing (high-volume, per-event). To enrich, filter, or transform specific data instances at runtime, with access to instance properties via this. In a log processing pipeline, extend TenXObject to add a custom field like this.enrichedLevel = TenXString.toUpperCase(this.level).
Static Static methods or getters in subclasses (e.g., static shouldLoad()), which are class-level and don't require an instance. Called early, before instantiation (e.g., during loading or decision-making phases). For configuration checks, conditional loading, or class-level utilities without per-instance overhead. Use static shouldLoad(config) to decide if a subclass should be applied based on env vars, like return !config.quiet.
Summary Custom subclasses of TenXSummary, which aggregate values across multiple instances. Executed after aggregation phases (e.g., at intervals or after a batch of events). To compute and access summaries like averages, counts, or metrics from grouped data. Extend TenXSummary to calculate custom metrics, e.g., this.avgResponseTime = this.sumResponseTime / this.count.
Template Custom subclasses of TenXTemplate, defining schemas or structures for other objects. Executed during initialization or when templates are loaded/created. To customize the structure/schema of data objects, often for validation or formatting. Extend TenXTemplate to define a custom log format, e.g., adding fields like timestamp and level.
Input Custom subclasses of TenXInput, handling data ingestion. Executed once per pipeline run, during input setup (low-cardinality). To customize how data is read or ingested, with access to input-specific config. Extend TenXInput to read from a custom source, e.g., if (this.inputPath) { this.loadFile(this.inputPath); }.
Output Custom subclasses of TenXOutput, managing data output. Executed once per pipeline run, during output setup (low-cardinality). To customize data writing, formatting, or transmission, with access to output config. Extend TenXOutput to log to a file, e.g., TenXConsole.log("Writing to: " + this.outputFilePath).
Unit Custom subclasses of TenXUnit, representing pipeline components or steps. Executed during pipeline initialization or per-unit setup (low to medium cardinality). To initialize or customize pipeline units like loaders or processors. Extend TenXUnit to load configs, e.g., if (this.unitName === "loadConfig") { TenXConsole.log("Launching..."); }.

functionActions

Function statements.

Type Required
List

JavaScript function statements.

NOTE: This argument is not designed to be set directly, but instead by passing a .js launch file containing these statements nested within an TenXObject sub-class constructor as command line argument as described above.

functionFile

Declaring .js file.

Type Default
String ""

Specifies the .js file name declaring functionActions.


This unit is defined in function/unit.yaml.