Prometheus

Prometheus Filter

Overview

Prometheus Filter Plugin to count Incoming Records

Configuration

PrometheusConfig

metrics ([]MetricSection, optional)

Metrics Section

Default: -

labels (Label, optional)

Default: -

Metrics Section

name (string, required)

Metrics name

Default: -

type (string, required)

Metrics type counter, gauge, summary, histogram

Default: -

desc (string, required)

Description of metric

Default: -

key (string, optional)

Key name of record for instrumentation.

Default: -

buckets (string, optional)

Buckets of record for instrumentation

Default: -

labels (Label, optional)

Additional labels for this metric

Default: -

Example Prometheus filter configurations

apiVersion: logging.banzaicloud.io/v1beta1
kind: Flow
metadata:
 name: demo-flow
spec:
 filters:
   - tag_normaliser: {}
   - parser:
       remove_key_name_field: true
       reserve_data: true
       parse:
         type: nginx
   - prometheus:
       metrics:
       - name: total_counter
         desc: The total number of foo in message.
         type: counter
         labels:
           foo: bar
       labels:
         host: ${hostname}
         tag: ${tag}
         namespace: $.kubernetes.namespace
 selectors: {}
 localOutputRefs:
   - demo-output

Fluentd Config Result

 <filter **>
   @type prometheus
   @id logging-demo-flow_2_prometheus
   <metric>
     desc The total number of foo in message.
     name total_counter
     type counter
     <labels>
       foo bar
     </labels>
   </metric>
   <labels>
     host ${hostname}
     namespace $.kubernetes.namespace
     tag ${tag}
   </labels>
 </filter>