-
Hello, I would like to reuse one Let's say I have the following events: {"name": "apple_metric", "labels": {"color": "red"}},
{"name": "car_metric", "labels": {"manufacturer": "Audi"}} and the following config [transforms.special_count_metrics]
type = "log_to_metric"
inputs = [ "..." ]
[[transforms.special_count_metrics.metrics]]
type = "counter"
field = "..."
name = "{{ name }}"
namespace = "vector"
increment_by_value = false
[transforms.special_count_metrics.metrics.tags]
# This would be the common tags
env = "test"
region = "cmh-1"
# I need to template color and/or manufacturer here How would I declare all fields defined under the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I realized that both metric and log are just an object for Vector. I added one more transformation as a workaround. [transforms.special_count_metrics]
...
[[transforms.special_count_metrics.metrics]]
...
[transforms.special_count_metrics.metrics.tags]
...
labels_hack = "{{ labels }}"
[transforms.special_count_metrics_labeled]
type = "remap"
inputs = ["special_count_metrics"]
source = '''
dynamic_labels = .tags.labels_hack
del(.tags.labels_hack)
.tags = merge!(.tags, parse_json!(dynamic_labels))
''' It still would have been nice if there was a way with no extra steps, but I think, this will work just fine for me. |
Beta Was this translation helpful? Give feedback.
I realized that both metric and log are just an object for Vector. I added one more transformation as a workaround.
It still would have been nice if there was a way with no extra steps, but I think, this w…