translator

package
v1.247349.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorMessages = []string{}

ErrorMessages will provide detail error messages to user

View Source
var InfoMessages = []string{}

Functions

func AddErrorMessages

func AddErrorMessages(path, message string)

func AddInfoMessages

func AddInfoMessages(path, message string)

func DefaultCase

func DefaultCase(key string, defaultVal, input interface{}) (returnKey string, returnVal interface{})

DefaultCase check if current input overrides the default value for the given config entry key.

func DefaultIntegralCase

func DefaultIntegralCase(key string, defaultVal, input interface{}) (returnKey string, returnVal interface{})

func DefaultStringArrayCase

func DefaultStringArrayCase(key string, defaultVal, input interface{}) (returnKey string, returnVal interface{})

func DefaultTimeIntervalCase

func DefaultTimeIntervalCase(key string, defaultVal, input interface{}) (returnKey string, returnVal interface{})

func GetTargetPlatform

func GetTargetPlatform() string

func InitWindowsObject

func InitWindowsObject(objectName, instances, counters, measurement string) map[string]interface{}

func IsTranslateSuccess

func IsTranslateSuccess() bool

func IsValid

func IsValid(input interface{}, key string, path string) bool

IsValid checks wether the mandatory config parameter is valid

func MergePlugins

func MergePlugins(map1 map[string]interface{}, map2 map[string]interface{}) map[string]interface{}

Don't modify map1 or map2, it's hard to make sure we don't reference map1 or map2 reference in whole proj This method is mainly to merge different plugins or multiple instances of same plugins

func MergeTwoUniqueMaps

func MergeTwoUniqueMaps(map1 map[string]interface{}, map2 map[string]interface{}) map[string]interface{}

Don't modify map1 or map2, it's hard to make sure we don't reference map1 or map2 reference in whole proj This method is mainly to merge maps which don't have same key, it's a shallow merge. Fail this method if not serving this purpose.

func ProcessDefaultConfig

func ProcessDefaultConfig(childRule map[string]Rule, result map[string]interface{}) map[string]interface{}

ProcessDefaultConfig process the input when user want to use the default configuration. In json the default configuration should be like "cpu":"default"

func ProcessNoRuleToApply

func ProcessNoRuleToApply(input interface{}, childRule map[string]Rule, result map[string]interface{}) map[string]interface{}

ProcessNoRuleToApply check if the the specification configuration provides some configs that don't need translation with rules. In this case, the translation of this config entry should be 1:1 map In json the default configuration should be like "cpu":{"interval":"10s"}

func ProcessRuleToApply

func ProcessRuleToApply(input interface{}, childRule map[string]Rule, result map[string]interface{}) map[string]interface{}

ProcessRuleToApply check if the specification configuration provide some configs that need translation with some rules In json the default configuration should be like "cpu":{"per_cpu":false}

func ResetMessages

func ResetMessages()

Used for testing purpose

func SetMetricPath

func SetMetricPath(result map[string]interface{}, sectionKey string)

Call this function to set SectionKey as MetricPath TagKey to all input plugins, processor plugins, and the one output plugin

func SetMetricPathForOneInput

func SetMetricPathForOneInput(result map[string]interface{}, sectionKey, inputPlugin string, processorPlugins []string)

Call this function to override MetricPath for one specific input plugin to go through a subset of processor plugins and then to the one output plugin

func SetTargetPlatform

func SetTargetPlatform(targetPlatform string)

Types

type Rule

type Rule interface {
	ApplyRule(interface{}) (string, interface{})
}

Concrete Rule implementation should return a (key string,val interface{})

Directories

Path Synopsis
csm

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL