PR Feedback

pull/645/head
Edward Welch 6 years ago committed by Ed
parent 04facc4d00
commit 1dc130d8cc
  1. 2
      docs/logentry/processing-log-lines.md
  2. 2
      docs/promtail.md
  3. 32
      pkg/logentry/stages/metrics_test.go

@ -218,7 +218,7 @@ A match stage will take the provided label `selector` and determine if a group o
pipeline_name: loki_pipeline ②
stages: ③
```
`selector` is **required** and uses logql label matcher expressions TODO LINK
`selector` is **required** and must be a [logql stream selector](../usage.md#log-stream-selector).
`pipeline_name` is **optional** but when defined, will create an additional label on the `pipeline_duration_seconds` histogram, the value for `pipeline_name` will be concatenated with the `job_name` using an underscore: `job_name`_`pipeline_name`
`stages` is a **required** list of additional pipeline stages which will only be executed if the defined `selector` matches the labels. The format is a list of pipeline stages which is defined exactly the same as the root pipeline

@ -104,7 +104,7 @@ See the [pipeline label docs](./logentry/processing-log-lines.md#labels) for mor
#### Metrics
Metrics can also be extracted from log line content as a set of Prometheus metrics. Metrics are exposed on the path `/metrics` in promtail. By default a counter of log entries (`log_entries_total`) and a log size histogram (`log_entries_bytes_bucket`) per stream is computed. This means you don't need to create metrics to count status code or log level, simply parse the log entry and add them to the labels. All custom metrics are prefixed with `promtail_custom_`.
Metrics can also be extracted from log line content as a set of Prometheus metrics. Metrics are exposed on the path `/metrics` in promtail. By default a log size histogram (`log_entries_bytes_bucket`) per stream is computed. This means you don't need to create metrics to count status code or log level, simply parse the log entry and add them to the labels. All custom metrics are prefixed with `promtail_custom_`.
There are three [Prometheus metric types](https://prometheus.io/docs/concepts/metric_types/) available.

@ -21,21 +21,21 @@ pipeline_stages:
app: app
payload: payload
- metrics:
loki_count_total:
loki_count:
type: Counter
description: uhhhhhhh
source: app
config:
value: loki
action: inc
bloki_count_total:
bloki_count:
type: Gauge
description: blerrrgh
source: app
config:
value: bloki
action: dec
payload_size:
payload_size_bytes:
type: Histogram
description: grrrragh
source: payload
@ -62,19 +62,19 @@ var testMetricLogLine2 = `
}
`
const expectedMetrics = `# HELP promtail_custom_bloki_count_total blerrrgh
# TYPE promtail_custom_bloki_count_total gauge
promtail_custom_bloki_count_total -1.0
# HELP promtail_custom_loki_count_total uhhhhhhh
# TYPE promtail_custom_loki_count_total counter
promtail_custom_loki_count_total 1.0
# HELP promtail_custom_payload_size grrrragh
# TYPE promtail_custom_payload_size histogram
promtail_custom_payload_size_bucket{le="10.0"} 1.0
promtail_custom_payload_size_bucket{le="20.0"} 2.0
promtail_custom_payload_size_bucket{le="+Inf"} 2.0
promtail_custom_payload_size_sum 30.0
promtail_custom_payload_size_count 2.0
const expectedMetrics = `# HELP promtail_custom_bloki_count blerrrgh
# TYPE promtail_custom_bloki_count gauge
promtail_custom_bloki_count -1.0
# HELP promtail_custom_loki_count uhhhhhhh
# TYPE promtail_custom_loki_count counter
promtail_custom_loki_count 1.0
# HELP promtail_custom_payload_size_bytes grrrragh
# TYPE promtail_custom_payload_size_bytes histogram
promtail_custom_payload_size_bytes_bucket{le="10.0"} 1.0
promtail_custom_payload_size_bytes_bucket{le="20.0"} 2.0
promtail_custom_payload_size_bytes_bucket{le="+Inf"} 2.0
promtail_custom_payload_size_bytes_sum 30.0
promtail_custom_payload_size_bytes_count 2.0
`
func TestMetricsPipeline(t *testing.T) {

Loading…
Cancel
Save