package
1.16.5
Repository: https://github.com/newrelic/nri-flex.git
Documentation: pkg.go.dev

# README

processor

-- import "."

Usage

func AutoSetMetricAPI

func AutoSetMetricAPI(currentSample *map[string]interface{}, api *load.API)

AutoSetMetricAPI automatically set metrics for use with the metric api

func AutoSetMetricInfra

func AutoSetMetricInfra(k string, v interface{}, metricSet *metric.Set, metrics map[string]string, autoSet bool, mode string)

AutoSetMetricInfra parse to number

func AutoSetStandard

func AutoSetStandard(currentSample *map[string]interface{}, api *load.API, workingEntity *integration.Entity, eventType string, config *load.Config)

AutoSetStandard x

func CreateMetricSets

func CreateMetricSets(samples []interface{}, config *load.Config, i int, mergeMetric bool, samplesToMerge *load.SamplesToMerge, originalAPINo int)

CreateMetricSets creates metric sets hren added samplesToMerge parameter, moved merge operation to CreateMetricSets so that the "Run...." functions still apply before merge

func FinalMerge

func FinalMerge(data map[string]interface{}) []interface{}

FinalMerge Perform final data merging Separates detected samples and already flattened attributes

func FindStartKey

func FindStartKey(mainDataset *map[string]interface{}, startKeys []string, inheritAttributes bool)

FindStartKey start at a different section of a payload

func FlattenData

func FlattenData(unknown interface{}, data map[string]interface{}, key string, sampleKeys map[string]string, api *load.API) map[string]interface{}

FlattenData flatten an interface

func ProcessSamplesMergeJoin

func ProcessSamplesMergeJoin(samplesToMerge *load.SamplesToMerge, yml *load.Config)

ProcessSamplesMergeJoin used to merge/join multiple samples together hren

func RunDataHandler

func RunDataHandler(dataSets []interface{}, samplesToMerge *load.SamplesToMerge, i int, cfg *load.Config, originalAPINo int)

RunDataHandler handles the data received for processing The originalAPINo is to track the original API sequential No. in the Flex config file. This is to diffentiate the new API Seq No. created by StoreLookup. The originalAPINo is used for Merge and Join operation

func RunEventFilter

func RunEventFilter(filters []load.Filter, createEvent *bool, k string, v interface{})

RunEventFilter filters events generated

func RunKeepKeys

func RunKeepKeys(keepKeys []string, key *string, currentSample *map[string]interface{})

RunKeepKeys will remove the key if is not defined in keep_keys.

func RunKeyConversion

func RunKeyConversion(key *string, api load.API, v interface{}, SkipProcessing *[]string)

RunKeyConversion handles to lower and snake to camel case for keys

func RunKeyFilter

func RunKeyFilter(filters []load.Filter, currentSample *map[string]interface{}, k string)

RunKeyFilter filters keys generated

func RunKeyRemover

func RunKeyRemover(currentSample *map[string]interface{}, removeKeys []string)

RunKeyRemover Remove unwanted keys with regex

func RunKeyRenamer

func RunKeyRenamer(renameKeys map[string]string, key *string)

RunKeyRenamer find keys with regex, and replace the value

func RunLazyFlatten

func RunLazyFlatten(ds *map[string]interface{}, cfg *load.Config, api int)

RunLazyFlatten lazy flattens the payload

func RunMathCalculations

func RunMathCalculations(math *map[string]string, currentSample *map[string]interface{})

RunMathCalculations performs math calculations

func RunPluckNumbers

func RunPluckNumbers(v *interface{}, api load.API, key *string)

RunPluckNumbers pluck numbers out automatically with ValueParser eg. "sample_start_time = 1552864614.137869 (Sun, 17 Mar 2019 23:16:54 GMT)" returns 1552864614.137869

func RunSampleFilter

func RunSampleFilter(currentSample map[string]interface{}, sampleFilters []map[string]string, createSample *bool)

RunSampleFilter Filters samples generated

func RunSampleFilterMatchAll

func RunSampleFilterMatchAll(currentSample map[string]interface{}, sampleFilters []map[string]string, createSample *bool)

RunSampleFilterMatchAll Sample Filter to match all keys

func RunSampleRenamer

func RunSampleRenamer(renameSamples map[string]string, currentSample *map[string]interface{}, key string, eventType *string)

RunSampleRenamer using regex if sample has a key that matches, make that a different sample (event_type)

func RunSubParse

func RunSubParse(subParse []load.Parse, currentSample *map[string]interface{}, key string, v interface{})

RunSubParse splits nested values out from one line eg. db0:keys=1,expires=0,avg_ttl=0

func RunTimestampConversion

func RunTimestampConversion(v *interface{}, api load.API, key *string)

RunTimestampConversion find keys with regex, convert date<=>timestamp

func RunValConversion

func RunValConversion(v *interface{}, api load.API, key *string)

RunValConversion performs percentage to decimal & nano second to millisecond

func RunValueMapper

func RunValueMapper(mapKeys map[string][]string, currentSample *map[string]interface{}, key string, v *interface{})

RunValueMapper map the value using regex grouping for keys e.g. "*.?\s(Service Status)=>$1-Good" -> "Service Status-Good"

func RunValueParser

func RunValueParser(v *interface{}, api load.API, key *string)

RunValueParser use regex to find a key, and pluck out its value by regex

func RunValueTransformer

func RunValueTransformer(v *interface{}, api load.API, key *string)

RunValueTransformer use regex to find a key, and then transform the value eg. key: world key: hello-${value} == key: hello-world

func SetEventType

func SetEventType(currentSample *map[string]interface{}, eventType *string, apiEventType string, apiMerge string, apiName string)

SetEventType sets the metricSet's eventType

func StoreLookups

func StoreLookups(storeLookups map[string]string, lookupStore *map[string]map[string]struct{}, key string, v interface{})

StoreLookups if key is found (using regex), store the values in the lookupStore as the defined lookupStoreKey for later use

func StripKeys

func StripKeys(ds *map[string]interface{}, stripKeys []string)

StripKeys strip defined keys out

func VariableLookups

func VariableLookups(variableLookups map[string]string, variableStore *map[string]string, key string, v interface{})

VariableLookups if key is found (using regex), store the value in the variableStore, as the defined by the variableStoreKey for later use

# Functions

AutoSetMetricAPI automatically set metrics for use with the metric api.
AutoSetMetricInfra parse to number.
AutoSetStandard x.
CreateMetricSets creates metric sets hren added samplesToMerge parameter, moved merge operation to CreateMetricSets so that the "Run...." functions still apply before merge.
FinalMerge Perform final data merging Separates detected samples and already flattened attributes.
FindStartKey start at a different section of a payload.
FlattenData flatten an interface.
ProcessSamplesMergeJoin used to merge/join multiple samples together hren.
RunDataHandler handles the data received for processing The originalAPINo is to track the original API sequential No.
RunEventFilter filters events generated.
RunKeepKeys will remove the key if is not defined in keep_keys.
RunKeyConversion handles to lower and snake to camel case for keys.
RunKeyFilter filters keys generated.
RunKeyRemover Remove unwanted keys with regex.
RunKeyRenamer find keys with regex, and replace the value.
RunLazyFlatten lazy flattens the payload.
RunMathCalculations performs math calculations.
RunPluckNumbers pluck numbers out automatically with ValueParser eg.
RunSampleFilter Filters samples generated.
RunSampleFilterMatchAll Sample Filter to match all keys.
RunSampleRenamer using regex if sample has a key that matches, make that a different sample (event_type).
RunSubParse splits nested values out from one line eg.
RunTimestampConversion find keys with regex, convert date<=>timestamp.
RunValConversion performs percentage to decimal & nano second to millisecond.
RunValueMapper map the value using regex grouping for keys e.g.
RunValueParser use regex to find a key, and pluck out its value by regex.
RunValueTransformer use regex to find a key, and then transform the value eg.
SetEventType sets the metricSet's eventType.
StoreLookups if key is found (using regex), store the values in the lookupStore as the defined lookupStoreKey for later use.
StripKeys strip defined keys out.
VariableLookups if key is found (using regex), store the value in the variableStore, as the defined by the variableStoreKey for later use.