Skip to content

Scrape

Publish TenXSummary instance values as metric counters to a Prometheus Micrometer registry.

Configuration

To configure the Prometheus scrape metrics output module, Edit these settings.

Below is the default configuration from: scrape/config.yaml.

Edit Online

Edit config.yaml Locally

# 🔟❎ 'run' Prometheus metric output configuration

# Configure Prometheus metric counter outputs.
# To learn more see https://doc.log10x.com/run/output/metric/prometheus/

# Set the 10x pipeline to 'run'
tenx: run

# =============================== Dependencies ================================

include: run/modules/output/metric/prometheus/scrape

# ============================== Prometheus Outputs ===========================

# Define multiple Prometheus metric outputs below
prometheus:

    # --------------------------- Connection Options --------------------------

    # 'port' sets the port number to listen to the Prometheus scraper on
  - port: 9100

    # ---------------------------- Counter Options ----------------------------

    # 'nameField' sets the TenXSummary field whose value identifies the micrometer counter to increment. 
    #  The 'inputName' field returns the name of the aggregator that produced the target TenXSummary instance.
    #  To learn more see https://doc.log10x.com/run/aggregate
    nameField: inputName

    # 'counterFields' specifies the TenXSummary fields whose values are used to increment the counter.
    #  To learn more see https://doc.log10x.com/run/aggregate/#summary-fields
    counterFields:
      - summaryVolume
      - summaryBytes
      - summaryTotals

    # 'tagFields' sets the TenXSummary fields used as the counter tag dimension values.
    #  Defaults to https://doc.log10x.com/run/initialize/#enrichmentFields
    tagFields:
      - $=yield TenXEnv.get("enrichmentFields")

    # 'tagFieldNames' allows setting custom names to aggregated fields for metrics reporting.
    #  Defaults to https://doc.log10x.com/run/initialize/#metricFieldNames
    tagFieldNames:
      - $=yield TenXEnv.get("metricFieldNames")

    # 'filter' sets a JavaScript expression that TenXSummaries must evaluate as truthy to write to the output.
    #  To learn more see https://doc.log10x.com/run/output/regulate/#filter-expressions
    filter: isSummary

Options

Specify the options below to configure multiple Prometheus scrape metrics output:

Name Description Category
prometheusEnabled Enable this output General
prometheusPort Scraper port number Connection
prometheusNameField Name of the TenXSummary field identifying the metric Counter
prometheusCounterFields Names of the TenXSummary fields used to increment the metric counter value Counter
prometheusTagFields List of TenXSummary fields to use as metric tag values Counter
prometheusTagFieldNames List of custom names to use for TenXSummary fields. Counter
prometheusFilter A JavaScript expression an TenXSummary must evaluate as 'truthy' against to be written to this output Counter
prometheusMaxCardinality Maximum number of unique metric combinations allowed Counter

General

prometheusEnabled

Enable this output.

Type Default Category
Boolean true General

Enable or disable this output.

Connection

prometheusPort

Scraper port number.

Type Required Category
Number Connection

Port number to listen to the Prometheus scraper on.

Counter

prometheusNameField

Name of the TenXSummary field identifying the metric.

Type Default Category
String summaryValues Counter

Defines the name of the TenXSummary field whose value identifies a metric counter. Defaults to the summaryValues field which holds the value(s) by which TenXObjects are grouped into the current TenXSummary instance. To learn more see micrometer counters.

prometheusCounterFields

Names of the TenXSummary fields used to increment the metric counter value.

Type Default Category
List summaryVolume Counter

Defines the name of the TenXSummary field by whose value to increment the counter.

prometheusTagFields

List of TenXSummary fields to use as metric tag values.

Type Default Category
List [] Counter

Defines the TenXSummary field names to use as tag values. Tags are dimensions that enable slicing a particular named metric to drill down to reason about its value. To learn more see micrometer tags.

prometheusTagFieldNames

List of custom names to use for TenXSummary fields.

Type Default Category
List [] Counter

Defines the a list of custom names to give fields when reporting them. Format as a list of name1, custom1, name2, custom2.

For example, to set a custom name of 'My-Custom-Field' to an existing 'intrinsic-field':

prometheus:
  tagFieldNames:
    - intrinsic-field
    - My-Custom-Field.

prometheusFilter

A JavaScript expression an TenXSummary must evaluate as 'truthy' against to be written to this output.

Type Default Category
String "" Counter

Specifies a JavaScript expression that an TenXSummary must evaluate as truthy to write its instance/template field values to the target counter.

For example, to only emit TenXSummaries produced by the 'myMetric' aggregator, specify:

prometheus:
  filter: this.inputName == "myMetric"

To learn more see inputName.

prometheusMaxCardinality

Maximum number of unique metric combinations allowed.

Type Default Category
Number 500 Counter

Sets the maximum number of unique metric combinations (cardinality) allowed for this output. When exceeded, metrics will be dropped to prevent excessive cardinality.


This module is defined in scrape/module.yaml.