github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/metrics/prometheus.md (about)

     1  ---
     2  title: prometheus
     3  type: metrics
     4  status: stable
     5  ---
     6  
     7  <!--
     8       THIS FILE IS AUTOGENERATED!
     9  
    10       To make changes please edit the contents of:
    11       lib/metrics/prometheus.go
    12  -->
    13  
    14  import Tabs from '@theme/Tabs';
    15  import TabItem from '@theme/TabItem';
    16  
    17  
    18  Host endpoints (`/metrics` and `/stats`) for Prometheus scraping.
    19  
    20  
    21  <Tabs defaultValue="common" values={[
    22    { label: 'Common', value: 'common', },
    23    { label: 'Advanced', value: 'advanced', },
    24  ]}>
    25  
    26  <TabItem value="common">
    27  
    28  ```yaml
    29  # Common config fields, showing default values
    30  metrics:
    31    prometheus:
    32      prefix: benthos
    33      path_mapping: ""
    34  ```
    35  
    36  </TabItem>
    37  <TabItem value="advanced">
    38  
    39  ```yaml
    40  # All config fields, showing default values
    41  metrics:
    42    prometheus:
    43      prefix: benthos
    44      path_mapping: ""
    45      use_histogram_timing: false
    46      histogram_buckets: []
    47      push_url: ""
    48      push_interval: ""
    49      push_job_name: benthos_push
    50      push_basic_auth:
    51        username: ""
    52        password: ""
    53  ```
    54  
    55  </TabItem>
    56  </Tabs>
    57  
    58  Metrics paths will differ from [the standard list](/docs/components/metrics/about#metric_names) in order to comply with Prometheus naming restrictions, where dots are replaced with underscores (and underscores replaced with double underscores). This change is made _before_ the mapping from `path_mapping` is applied.
    59  
    60  ## Fields
    61  
    62  ### `prefix`
    63  
    64  A string prefix to add to all metrics.
    65  
    66  
    67  Type: `string`  
    68  Default: `"benthos"`  
    69  
    70  ### `path_mapping`
    71  
    72  An optional [Bloblang mapping](/docs/guides/bloblang/about) that allows you to rename or prevent certain metrics paths from being exported. When metric paths are created, renamed and dropped a trace log is written, enabling TRACE level logging is therefore a good way to diagnose path mappings. BETA FEATURE: Labels can also be created for the metric path by mapping meta fields.
    73  
    74  
    75  Type: `string`  
    76  Default: `""`  
    77  
    78  ```yaml
    79  # Examples
    80  
    81  path_mapping: this.replace("input", "source").replace("output", "sink")
    82  
    83  path_mapping: |-
    84    if ![
    85      "benthos_input_received",
    86      "benthos_input_latency",
    87      "benthos_output_sent"
    88    ].contains(this) { deleted() }
    89  
    90  path_mapping: |-
    91    let matches = this.re_find_all_submatch("resource_processor_([a-zA-Z]+)_(.*)")
    92    meta processor = $matches.0.1 | deleted()
    93    root = $matches.0.2 | deleted()
    94  ```
    95  
    96  ### `use_histogram_timing`
    97  
    98  Whether to export timing metrics as a histogram, if `false` a summary is used instead. For more information on histograms and summaries refer to: https://prometheus.io/docs/practices/histograms/.
    99  
   100  
   101  Type: `bool`  
   102  Default: `false`  
   103  Requires version 3.63.0 or newer  
   104  
   105  ### `histogram_buckets`
   106  
   107  Timing metrics histogram buckets (in seconds). If left empty defaults to DefBuckets (https://pkg.go.dev/github.com/prometheus/client_golang/prometheus#pkg-variables)
   108  
   109  
   110  Type: `array`  
   111  Default: `[]`  
   112  Requires version 3.63.0 or newer  
   113  
   114  ### `push_url`
   115  
   116  An optional [Push Gateway URL](#push-gateway) to push metrics to.
   117  
   118  
   119  Type: `string`  
   120  Default: `""`  
   121  
   122  ### `push_interval`
   123  
   124  The period of time between each push when sending metrics to a Push Gateway.
   125  
   126  
   127  Type: `string`  
   128  Default: `""`  
   129  
   130  ### `push_job_name`
   131  
   132  An identifier for push jobs.
   133  
   134  
   135  Type: `string`  
   136  Default: `"benthos_push"`  
   137  
   138  ### `push_basic_auth`
   139  
   140  The Basic Authentication credentials.
   141  
   142  
   143  Type: `object`  
   144  
   145  ### `push_basic_auth.username`
   146  
   147  The Basic Authentication username.
   148  
   149  
   150  Type: `string`  
   151  Default: `""`  
   152  
   153  ### `push_basic_auth.password`
   154  
   155  The Basic Authentication password.
   156  
   157  
   158  Type: `string`  
   159  Default: `""`  
   160  
   161  ## Push Gateway
   162  
   163  The field `push_url` is optional and when set will trigger a push of
   164  metrics to a [Prometheus Push Gateway](https://prometheus.io/docs/instrumenting/pushing/)
   165  once Benthos shuts down. It is also possible to specify a
   166  `push_interval` which results in periodic pushes.
   167  
   168  The Push Gateway is useful for when Benthos instances are short lived. Do not
   169  include the "/metrics/jobs/..." path in the push URL.
   170  
   171  If the Push Gateway requires HTTP Basic Authentication it can be configured with
   172  `push_basic_auth`.
   173