fluent / fluent/fluent-plugin-prometheus
Record accessor in Labels does not work on all fields
- Dominant language
- Ruby
- Stars
- 257
- Forks
- 83
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 7
Description
I am trying to export a metric with labels created by kubernetes_metadata filter.
I'm using the following match:
```
@type parser
key_name log
@type regexp
expression upstream: \"http://(?.*?)/.*?\"
@type prometheus
name nginx_upstream_error
type counter
desc The total number of Nginx upstream timeouts.
error ${tag_parts[3]}
upstream $.upstream
origin-pod $.kubernetes.pod_name
origin-namespace $.kubernetes.namespace_name
```
Output in `/metrics` looks like this:
```
# TYPE nginx_upstream_error counter
# HELP nginx_upstream_error The total number of Nginx upstream timeouts.
nginx_upstream_error{error="timeout",upstream=":",origin-pod="",origin-namespace=""} 3.0
```
For some reason `$.kubernetes.pod_name` and `$.kubernetes.namespace_name` doesn't work and stay empty.
The source of this tag goes through the kubernetes metadata plugin:
```
@type kubernetes_metadata
```
I've validated that the object `kubernetes` with the specified fields is there (my whole logging infrastructure is based on it).
What is even stranger is that the `upstream` label works!
Seems like the record accessor does not work on fields came out from k8s enrichment but does work on fields came out of the previous parser.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.