Skip to content

Conversation

alltilla
Copy link
Collaborator

You can use all value-pairs options, like key(), rekey(), pair() or scope(), etc...

Example:

metrics-probe(
  key("foo")
  labels(
    "static-label" => "bar"
    key(".my_prefix.*" rekey(shift-levels(1)))
  )
);
syslogng_foo{static_label="bar",my_prefix_baz="almafa",my_prefix_foo="bar",my_prefix_nested_axo="flow"} 4

Signed-off-by: Attila Szakacs attila.szakacs@axoflow.com

It generates useful warning messages, like:
modules/metrics-probe/metrics-probe-grammar.y: error: 1 reduce/reduce conflict [-Werror=conflicts-rr]
modules/metrics-probe/metrics-probe-grammar.y: warning: reduce/reduce conflict on token ')' [-Wcounterexamples]
  Example: •
  First reduce derivation
    metrics_probe_labels_opts
    ↳ metrics_probe_label_vp_opts
      ↳ $@3 vp_options
        ↳ • ↳ ε
  Second reduce derivation
    metrics_probe_labels_opts
    ↳ metrics_probe_label_templates
      ↳ •

Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
We will add labels dynamically with the help of value pairs,
so we do not know the exact number of labels beforehand,
so it is not safe to use alloca() anymore.

Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
@OverOrion OverOrion self-requested a review August 25, 2023 06:41
Copy link
Collaborator

@OverOrion OverOrion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for this!

@OverOrion OverOrion merged commit a9640ec into syslog-ng:master Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants