Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vm handling of measurement, tag, field names not following PromQL conventions #42

Closed
yuyutime opened this issue May 30, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@yuyutime
Copy link

When telemetry data is sent to VictoriaMetrics via influx line protocol by pipeline telemetry collector measurement,tag and field names contain characters not allowed by regexps in Prometheus Data Model.

VictoriaMetrics accepts and stores such input data but its further usage in queries is difficult or not possible due to PromQL restrictions. For example for sample data below:

Server: [http://10.xx.xx.xx:8428], wkid 0, writing 570 points in db: telemetry
(prec: [ms], consistency: [], retention: [])
        Cisco-IOS-XR-wdsysmon-fd-oper:system-monitoring/cpu-utilization,EncodingPath=Cisco-IOS-XR-wdsysmon-fd-oper:system-monitoring/cpu-utilization,Producer=xxxxx,node-name=0/0/CPU0 total-cpu-fifteen-minute=3i,total-cpu-five-minute=3i,total-cpu-one-minute=3i 1559204774467000000

node-name label name is not allowed in selection expressions like node-name=~"abc.+" and there is no way to quote label name or escape "bad" characters in it.
Metric name in VictoriaMetrics is created as measurement.field can also be addressed only indirectly with __name__="...." syntax.

Options to deal with this problem:

  • patch pipeline source code for influx output (possible, but won't cure same problem with other bad-behaving data sources)
  • PromQL in VM has to be extended to provide a better way to handle "exotic" names (quote, escape, etc) or
  • Validate input data & Reject or Rewrite names to valid PromQL strings (will protect VM from bad data getting into database)
  • Leave VM as is - let users preprocess data before sending to VM (using telegraf [[processors]] or smth else).
@valyala
Copy link
Collaborator

valyala commented May 30, 2019

@yuyutime , I like the second solution:

PromQL in VM has to be extended to provide a better way to handle "exotic" names (quote, escape, etc)

How about escaping special chars with \?

Then node-name metric could be referenced as node\-name in PromQL.

@valyala valyala added the enhancement New feature or request label May 30, 2019
@valyala valyala closed this as completed May 31, 2019
@valyala
Copy link
Collaborator

valyala commented May 31, 2019

Now VictoriaMetrics accepts escaped identifiers starting from v1.18.9. Escape rules for identifiers - metric names, labels, function names and function args:

  1. Arbitrary char may be escaped with \ before it. For instance, a\-b\+c is treated as a-b+c identifier.
  2. \xXX is converted to a single char with the corresponding hex code XX. For instance, a\x20b is treated as a b identifier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants