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

[Error on create model] "invalid field features.0.measurement: not a valid value" (name limited by config "^[a-zA-Z0-9-_@]+$") ?? #392

Open
toni-moreno opened this issue Aug 6, 2020 · 3 comments

Comments

@toni-moreno
Copy link

Hello @regel , sorry for this new issue.

I'm trying to create a model with this definition.

{
   "bucket_interval":"1m",
   "default_bucket":"output-influx1",
   "features":[
      {
         "anomaly_type":"low_high",
         "default":0,
         "field":"value",
         "io":"io",
         "match_all":[
            {
               "tag":"metric_id",
               "value":"XXXXX"
            }
         ],
         "measurement":"traffic.rxt_et-1/0/0", <-------------------------------SEE HERE
         "metric":"mean",
         "name":"mean_value"
      }
   ],
   "grace_period":0,
   "interval":"60s",
   "max_evals":20,
   "max_threshold":70,
   "min_threshold":50,
   "name":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
   "offset":"10s",
   "seasonality":{
      "daytime":false,
      "weekday":false
   },
   "span":256,
   "type":"donut"
}

it seems like doesn't like traffic.rxt_et-1/0/0 as measurement maybe character validation?

Required('measurement'): All(schemas.key, Length(max=256)),

loudml/loudml/schemas.py

Lines 28 to 32 in 2d05a3e

key = All(
str,
Length(min=1),
Match("^[a-zA-Z0-9-_@]+$"),
)

@regel IMHO is really important add as many characters in the measurement name as posibles in the influxdb database

As explained in the following doc

"',;:-/\.[]{} are valid characters and should be only scaped "" if conflicting with regex to use them, also key length limit should be 64Kb length

Would you accept a PR to fix this error?

Thank you in advance

@toni-moreno
Copy link
Author

Hello again @regel

This regex would be nice ^[a-zA-Z0-9-_@\/\[\]{}:;,.|=%"\$]+$

https://regex101.com/r/w633je/2

it will match with

traffic.rxt_et-1/0/0
traffic.rxt_et-[1/0/0]
traffic.rxt_et-{1/0/0}
traffic.rxt_et-00:11:11
traffic.rxt_et-00,1,1
traffic.rxt_et=adfa
traffic.rxt_et=%20%a
traffic.rxt_et="foo"
traffic.rxt_et="${value}

@regel
Copy link
Owner

regel commented Aug 7, 2020

Hi Toni. Yes. Good idea! Yes you can open a PR on this. The unit tests can be updated too based on the examples given.

Ps: I’m on vacation in the beautiful Loire valley. Responses will be delayed.

@toni-moreno
Copy link
Author

Thank you very much for your fast answer

Ok , I will be out for 1 week also just from today, I will build a PR when I come back.

toni-moreno pushed a commit to datadope-io/loudml that referenced this issue Aug 17, 2020
toni-moreno pushed a commit to datadope-io/loudml that referenced this issue Nov 7, 2020
toni-moreno pushed a commit to datadope-io/loudml that referenced this issue Nov 7, 2020
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

No branches or pull requests

2 participants