Guest User

Untitled

a guest
Dec 18th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. tellem
  2. ----
  3.  
  4. tellem dsl for extracting telemetry from json and xml and any other input that has a path lang for extracting content from messages
  5.  
  6. ### NOTES
  7.  
  8. * first implementation in scala and antlr
  9. * embeddable
  10. * uses jsonpath for first impl, xpath eventually, support for other path langs should be plugable
  11. * eventual support of first class logic programming as an ai frontend
  12.  
  13. ### FEATURES
  14.  
  15. 1. variables
  16. 2. assertions
  17. 3. yield template
  18.  
  19. * keywords: set, def, assert, template, int, string, float, datetime, eq, ne, lt, gt, lte, gte, pathlang, now
  20. * comments follow # to end of line
  21. * use 'now' if you want clock time as telemetry time
  22. * in the future, will support basic math in an assertion like totalCount / goodCount
  23. * whitespace within a line is ignored
  24. * a tellem defines any number of variables with paths
  25. * all variables are optional types of either string, int, float, or datetime
  26. * a tellem defines any number of assertions that reference the variables
  27. * an assertion that references a variable that isEmpty returns false
  28. * an assertion can use eq, ne, gt, lt, lte, gte
  29. * there is one implicit assertion: all variables musts resolve
  30. * if all the assertions are true, a record is formatted and yielded
  31.  
  32. ### EXAMPLE
  33.  
  34. ```
  35. set datetime yyy-mo-dd'T'hh-mm-ss.SSSZ
  36. set pathlang jsonpath
  37.  
  38. def device: str($.machineId)
  39. def time: datetime($.datetime)
  40. def msgType: str($.payload.type)
  41. def totalOps: int($.payload.opevent.totalCount)
  42. def goodOps: int($.payload.opevent.successCount)
  43.  
  44. assert msgType eq str(opEvent)
  45. assert totalOps gt int(12)
  46. assert goodOps lt int(10)
  47.  
  48. template {time} {goodOps} my.telemetry.record.for.device.{device}.lowgoodops.alert
  49.  
  50. ```
Add Comment
Please, Sign In to add comment