github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/metrics/http_server.md (about) 1 --- 2 title: http_server 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/http_server.go 12 --> 13 14 import Tabs from '@theme/Tabs'; 15 import TabItem from '@theme/TabItem'; 16 17 18 Serves metrics as [JSON object](#object-format) with the service wide HTTP 19 service at the endpoints `/stats` and `/metrics`. 20 21 ```yaml 22 # Config fields, showing default values 23 metrics: 24 http_server: 25 prefix: benthos 26 path_mapping: "" 27 ``` 28 29 This metrics type is useful for debugging as it provides a human readable format 30 that you can parse with tools such as `jq` 31 32 ## Fields 33 34 ### `prefix` 35 36 A string prefix to add to all metrics. 37 38 39 Type: `string` 40 Default: `"benthos"` 41 42 ### `path_mapping` 43 44 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. 45 46 47 Type: `string` 48 Default: `""` 49 50 ```yaml 51 # Examples 52 53 path_mapping: this.replace("input", "source").replace("output", "sink") 54 55 path_mapping: |- 56 if ![ 57 "benthos.input.received", 58 "benthos.input.latency", 59 "benthos.output.sent" 60 ].contains(this) { deleted() } 61 ``` 62 63 ## Object Format 64 65 The metrics object takes the form of a hierarchical representation of the dot 66 paths for each metric combined. So, for example, if Benthos exposed two metric 67 counters `foo.bar` and `bar.baz` then the resulting object might look 68 like this: 69 70 ``` json 71 { 72 "foo": { 73 "bar": 9 74 }, 75 "bar": { 76 "baz": 3 77 } 78 } 79 ``` 80