-
Notifications
You must be signed in to change notification settings - Fork 45
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
ft: TCP adaptor #2067
base: main
Are you sure you want to change the base?
ft: TCP adaptor #2067
Conversation
e7ece77
to
e94d475
Compare
389a5f7
to
efc3721
Compare
] | ||
|
||
# TODO: Add support for non-transparent framing | ||
[to_string(IO.iodata_length(msg)), ?\s, msg] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently only octet-counting framing is implemented as I have no idea how to do nested configuration there. Non-transparent framing (with newline endings) is simple to implement, as all that is needed is simply removing byte count and space.
end | ||
|
||
defp header(%LogEvent{} = le, options) do | ||
level = to_level(le.body["level"] || le.body["metadata"]["level"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not have an idea how to extract level from log event in better way. So I am open to having better solution there.
|
||
defp header(%LogEvent{} = le, options) do | ||
level = to_level(le.body["level"] || le.body["metadata"]["level"]) | ||
facility = options[:facility] || 16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Facility is currently not configurable, but honestly I do not know if there is much need for that.
|
||
ingested_at = DateTime.from_naive!(le.ingested_at, "Etc/UTC") | ||
|
||
id = Ecto.UUID.dump!(le.id) |> Base.encode32(case: :lower, padding: false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of 32 characters limit I decided to encode UUIDs with Base32. Theoretically we could just remove -
(dashes) from canonical representation, but I think that this approach is effective enough as well as it reduces amount of data that needs to be transferred.
# XXX: Unknown hostname? | ||
" -", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left hostname field undefined, though if someone has proposal what could be in this field, then I am open to filling it.
# TODO: Change it to real value | ||
@pen 62137 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This need to be updated as soon as Supabase or Logflare will have assigned Private Enterprise Number from IANA.
defp structured_data(%LogEvent{} = le, _options) do | ||
[ | ||
"[source@#{@pen} name=#{inspect(le.source.name)} id=\"#{le.source.id}\"]" | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are more metadata informations that should be available there, then I am open to suggestions.
@@ -42,6 +42,15 @@ Mimic.copy(ExTwilio.Message) | |||
Mimic.stub(Goth) | |||
Mimic.stub(Finch) | |||
|
|||
ExUnit.configure(exclude: [integration: true, failing: true, benchmark: true]) | |||
has_telegraf? = not is_nil(System.find_executable("telegraf")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Telegraf is currently not installed on CI, so we will automatically skip these tests. There are some GitHub Actions to install it, but I didn't know what are the policies around adding 3rd party actions, so I have left it for the future.
No description provided.