Heka secmetrics Module

This module can be included in analysis modules to produce metrics for consumption by the metrics output module. This is intended to provide a uniform and consistent interface for metrics generation.

The intent of this module is to provide updates on metrics to the metrics output sandbox. Analysis plugins can choose to create and submit metrics in process_event, or if desired send accumulated metrics in a timer event. Either way, each time the send function is called to generate a metrics event the data structure is reset. It is up to the metrics output plugin to do longer term aggregation and collection.

Plugins that import this module must ensure a proper configuration is included that specifies an identifier. This identifier is used to group the metrics the plugin submits. All metrics submitted to the metrics output module that have the same identifier will be aggregated together when the metrics output module timer event fires.

heka_secmetrics = {
    identifier = "united_federation_of_planets"
}

1. Functions

1.1. new

Generate a new metrics data structure. This data structure stores metrics locally, prior to submission to the metrics output module. The table returned by this function is not serializable, so any metrics information stored here prior to submission will be lost when the process exits.

secm = require "heka.secmetrics".new()

Arguments

  • None

Return

  • secm (table) - metrics data structure

1.2. secm:inc_accumulator

Increment an accumulator value in the data structure. When the metrics output sandbox gets this it will increment it's stored value for the metric name specified in the submission.

Arguments

  • metric (string) - name of metric to increment
  • cnt (integer, nil) - amount to increment by (1 if unspecified)

Return

  • None

1.3. secm:add_uniqitem

Add a new item to the unique item metrics tracker. When the output sandbox summarizes unique items, it will convert the number of distinct items for a given metric into a counter.

Arguments

  • metric (string) - name of metric to add item to
  • item (string) - item being added

Return

  • None

1.4. secm:send

Inject a secmetrics message based on the currently collected metrics stored in the secm data structure. After the metrics message is generated, the data structure and all counters are reset.

Arguments

  • None

Return

  • None

source code: secmetrics.lua

results matching ""

    No results matching ""