opentelemetry-lambda icon indicating copy to clipboard operation
opentelemetry-lambda copied to clipboard

feat: Add support for exporting telemetry API 'platform.*' log events

Open herin049 opened this issue 1 month ago • 3 comments

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: Screenshot From 2025-12-08 18-31-52

herin049 avatar Dec 08 '25 00:12 herin049

@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?

wpessers avatar Dec 17 '25 15:12 wpessers

@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.

herin049 avatar Dec 17 '25 15:12 herin049

@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.

herin049 avatar Dec 18 '25 18:12 herin049

Thanks again for the work! Nice one! 🚀

wpessers avatar Dec 18 '25 21:12 wpessers