enhancement(lua transform): Support metric events in version 2#2095
Conversation
Signed-off-by: Alexander Rodin <rodin.alexander@gmail.com>
|
Great PR! Please pay attention to the following items before merging: Files matching
Files matching
This is an automatically generated QA checklist based on modified files |
| "type(log.nested) == 'table'", | ||
| "log.nested.field == '2'", | ||
| "#log.nested.array == 3", | ||
| "log.nested.array[1] == 'example value'", |
There was a problem hiding this comment.
Oh no, I hate this. Array indexing is going to be my bane! Hahaha
There was a problem hiding this comment.
In principle, it possible to make it zero-based, as Lua arrays are just hash tables with numeric indexes. But third-party Lua libraries might not handle this well.
| count: aggregated_summary.get("count")?, | ||
| sum: aggregated_summary.get("sum")?, | ||
| } | ||
| } else { |
There was a problem hiding this comment.
It's unfortunate we can't make this a match statement to avoid this breaking accidentally in future metric type additions.
There was a problem hiding this comment.
I considered devising a serde-style derive macro which would implement FromLua for arbitrary enums, but decided against in the initial implementation because I thought that it might add too much complexity, and also it is not clear what to do with DateTime<Utc> and Bytes because both of these types are external, so FromLua cannot be implemented for them and it has to be worked around somehow.
But doing this this could have solved the issue of possible breaking of this in case if new metric type is added.
|
Looks good. :) Had a suggestion to improve the error message, but otherwise free to merge. |
|
From planning: Adding final touches before merging. |
Signed-off-by: Alexander Rodin <rodin.alexander@gmail.com>
Signed-off-by: Alexander Rodin <rodin.alexander@gmail.com>
Signed-off-by: Alexander Rodin <rodin.alexander@gmail.com>
|
@a-rodin we'll need to update the docs before merging this. This will be a little different in that we'll want good examples and properly document the hooks API. |
|
@binarylogic I'll add docs and examples for this. But I have two questions:
|
In the same file, no need to create a new one. Take a look at the
It's up to you. I want to discourage our docs from getting ahead of the code. If we want to do it all in one shot then I would merge this, implement the hooks, and then follow it all up with docs. In general though, we should be encouraging users to use v2 and not v1. |
I would like to proceed this way: implement hooks (at least |
This PR adds support for both metrics and log events in
luasupport APIv2 in accordance to RFC 1999.The change is not documented because Lua API v2 is not stable yet, so it is not advertised in the documentation.
Closes #1563, closes #1406, and closes #706 (for Lua APIv2).