SkySpark Axon Code and Standards
Defcomp Functions
When testing Defcomp functions in SkySpark, use the ruleTest() function with the correct syntax.
Example:
ruleTest(baseloadKPI, @p:cadev:r:2d7b37dd-35156c25, 2023-12-31)
Normal Functions
When testing normal functions in SkySpark, you can execute them directly using the following syntax.
Example:
baseloadKPI(readLink(@p:cadev:r:2d7b37dd-35156c25), 2023-12-31)
Debugging Tips
-
Logging within normal functions can be challenging, so return the value to check it in the debug app.
- Example:
logInfo("host", "" + threshold)
- Example:
-
Use
Ctrl + Ito quickly locate the definition of any function in the editor. -
When using Defcomp functions, you can use the
debugparameter to capture and display variable values within the Shell App.
Coding Practices
Code Application for Writing Axon Rules
When writing Axon rules, they typically fall into two categories:
- KPI Rules: These rules should be prefixed with
caKPI. - Spark Rules: These rules should be prefixed with
caRule.
Helper Functions
- Helper functions should start with the prefix
fnto denote utility-like operations.
Naming Convention
When naming Axon rules, follow this consistent structure:
{caRule/caKPI}{ShortNameOfPod}{FunctionShortDescription}
Example:
caRuleEnvHeatWastageCost
In this example:
caRuleindicates that it's a rule.Envrefers to the environment-related pod.HeatWastageCostsuccinctly describes the function or purpose of the rule.
Important Tags for Creating Rules
When creating new rules, ensure to include the following tags for clarity and maintenance:
-
Dis Tag:
- This tag is what the engineering team will see within the Rules App.
-
Doc Tag:
- Provides documentation for developers regarding the rule’s logic.
-
Help Tag:
- Intended for the engineering team to fill in further instructions or details on the rule.
-
Package Tag:
- This tag specifies the library in Stack Hub. (Note: You need to add this tag manually as it is not included by default.)