Skip to main content

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)
  • Use Ctrl + I to quickly locate the definition of any function in the editor.

  • When using Defcomp functions, you can use the debug parameter 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:

  1. KPI Rules: These rules should be prefixed with caKPI.
  2. Spark Rules: These rules should be prefixed with caRule.

Helper Functions

  • Helper functions should start with the prefix fn to denote utility-like operations.

Naming Convention

When naming Axon rules, follow this consistent structure:

{caRule/caKPI}{ShortNameOfPod}{FunctionShortDescription}

Example:

caRuleEnvHeatWastageCost

In this example:

  • caRule indicates that it's a rule.
  • Env refers to the environment-related pod.
  • HeatWastageCost succinctly 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:

  1. Dis Tag:

    • This tag is what the engineering team will see within the Rules App.
  2. Doc Tag:

    • Provides documentation for developers regarding the rule’s logic.
  3. Help Tag:

    • Intended for the engineering team to fill in further instructions or details on the rule.
  4. 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.)