feat: Add support for exporting telemetry API 'platform.*' log events
Fixes issue #2054 where platform.* telemetry API event types (except part of platform.report) do not get exported for logging. The implemented solution captures all logs by default, and simplifies the current implementation by reusing the core log record construction logic while reducing code duplication.
I have setup a toy lambda function to export logs to Grafana Cloud with the changes in this PR, here are the updated logs:
@herin049 I see your solution captures all the logs by default. Does it also fix the issue, so can you exclude the extension logs and only get function and platform logs like was the reason for the original issue?
@herin049 I see your solution captures all the logs by default. Does it also fix the issue, so can you exclude the extension logs and only get function and platform logs like was the reason for the original issue?
Yes, I can verify again by manually deploying the layer into my AWS account. The original issue is worded a bit weirdly, the original issue is that platform logs are not generated. The creator of the issue was trying to exclude extension and include platform and function but was only getting function logs (he was receiving no extension logs as expected, but also wasn't getting the platform logs).
The determining factor if you receive these logs or not if whether you add platform/extension/function to the event list which is passed to the Lambda TelemetryAPI during the initial subscription call. If you don't include one of these, then you'll get none of those events.
@wpessers Updated all float64 conversions to explicitly check the ok result instead of checking for a non-zero return value. Also updated the format string to use %.0f instead of casting to an int.
Thanks again for the work! Nice one! 🚀