collectors
Collectors
lunar-config.yml -> collectors
Type:
array
Form:
Collectors are used to collect live information from various sources to associate with individual components.
Example collectors definition:
Collector
lunar-config.yml -> collectors.<collector-index>
Type:
object
Forms
Uses form (use an external collector plugin):
Run form (define a collector inline):
Main form (define a collector inline with a main file):
Collectors are used to collect live information from various sources to associate with individual components. Collectors can be used to instrument CI/CD pipelines, run cron jobs, or execute arbitrary logic when code changes.
Collectors can either be imported (Uses form), defined as an inline command (Run form), or defined as a script to run (Main form). When a collector is defined inline (Run and Main forms), a hook must be specified to determine when the collector should run.
name
name
lunar-config.yml -> collectors.<collector-index>.name
Type:
string
Required for Run and Main collector forms, Optional for Uses collector form
The name
field is used to specify the name of the collector. If a name is not provided in the case of a collector plugin, the name from the collector plugin is used. The name must be unique within the configuration.
uses
uses
lunar-config.yml -> collectors.<collector-index>.uses
Type:
string
Forms
GitHub form:
github://<org>/<repo>@<version>
Local form:
./<path-to-collector>
Required in Uses collector form
The uses
field specifies an external (plugin) collector to use. The collector can be a third-party collector, or a local collector defined in a subdirectory.
with
with
lunar-config.yml -> collectors.<collector-index>.with
Type:
object
Optional
The with
field specifies the inputs to pass to the collector plugin. The inputs are defined in the collector's configuration file.
run<language>
run<language>
lunar-config.yml -> collectors.<collector-index>.run<language>
Type:
string
Required in Run collector form
Defines the command to execute when the collector is invoked. Only Bash
and Python
are supported. So runBash
and runPython
are the only valid fields.
If an install.sh
file is present in the same directory as lunar-config.yml
or lunar-collector.yml
, Lunar will run the install script before running the collector script. This script is executed only once in each environment. In ephemeral environments, the script is executed every time the environment is created (e.g. on each CI job, or on each code collector execution). Lunar uses a lock file under the hood to detect if the script has previously been executed.
runBash
lunar-config.yml -> collectors.<collector-index>.runBash
Type:
string
The runBash
field specifies the bash collector script to run.
runPython
lunar-config.yml -> collectors.<collector-index>.runPython
Type:
string
The runPython
field specifies the python collector script to run.
If a requirements.txt
file is present in the same directory as lunar-config.yml
or lunar-collector.yml
, Lunar will install the dependencies before running the collector script.
main<language>
main<language>
lunar-config.yml -> collectors.<collector-index>.main<language>
Type:
string
Required in Main collector form
Defines the main file path used to execute when the collector is invoked. Only Bash
and Python
are supported. So mainBash
and mainPython
are the only valid field.
The file path is relative to the root of the Lunar configuration repository. In the case of an external plugin definition, the path is relative to the plugin directory.
If an install.sh
file is present in the same directory as lunar-config.yml
or lunar-collector.yml
, Lunar will run the install script before running the collector script. This script is executed only once in each environment. In ephemeral environments, the script is executed every time the environment is created (e.g. on each CI job, or on each code collector execution). Lunar uses a lock file under the hood to detect if the script has previously been executed.
mainBash
lunar-config.yml -> collectors.<collector-index>.mainBash
Type:
string
The mainBash
field specifies the path to the bash main file to run.
mainPython
lunar-config.yml -> collectors.<collector-index>.mainPython
Type:
string
The mainPython
field specifies the path to the python main file to run.
If a requirements.txt
file is present in the same directory as lunar-config.yml
or lunar-collector.yml
, Lunar will install the dependencies before running the collector script.
on
on
lunar-config.yml -> collectors.<collector-index>.on
Type:
array
Required
The on
field specifies the tags that the collector should be associated with. The collector will only run when the component has one or more of the specified tags.
To associate the collector with a domain, use the tag domain:<domain-name>
. For example, to associate a collector with the domain bar
, which is under the domain foo
, use the tag domain:foo.bar
.
hook
hook
lunar-config.yml -> collectors.<collector-index>.hook
Type:
object
One of
hook
orhooks
is required in Run collector form
Using hook
is equivalent to using a single hook in the hooks
field. The hook
field specifies when the collector should run.
hooks
hooks
lunar-config.yml -> collectors.<collector-index>.hooks
Type:
array
One of
hook
orhooks
is required in Run collector form
The hooks
field specifies when the collector should run.
Last updated