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

Fix race on Collector.Start() loosing error info

Open iximiuz opened this issue 3 years ago • 7 comments

When the inner collector (go.opentelemetry.io/collector/service) Run() call fails (likely due to a bad config file) the lambda collector wrapper would likely loose the actual error information and report just the unexpected collector state (CLOSED) back to the caller. This PR makes the collector wrapper's Start() method race-free, so that the actual error information is not lost.

Another improvement is related to the main() procedure - before this PR the main loop wouldn't handle situations when the inner collector exits before the SHUTDOWN event.

iximiuz avatar Jul 02 '22 12:07 iximiuz

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: iximiuz / name: Ivan Velichko (90898ef4c330f4792b0aa11db4a7566dd1a9d0e7)

@Aneurysm9 could you please help take a look at this? I remember last time we edited these files in #194 we were burned pretty bad before a release until we fixed in #207 😓 Please let me know what you think of this change!

NathanielRN avatar Jul 07 '22 20:07 NathanielRN

Kind reminder that this PR is still awaiting its review 😇

iximiuz avatar Aug 26 '22 11:08 iximiuz

I think this PR will not cause the same issues that #194 did. It does not hang the initialization until the end of svc.Run() like that one did. I will try to run this through some tests today, but the approach and code seem sound to me.

Aneurysm9 avatar Oct 10 '22 17:10 Aneurysm9

Thank you @Aneurysm9! I defer to you to merge if you think it looks good 🙂

NathanielRN avatar Oct 25 '22 16:10 NathanielRN

Is this still a problem? This is a pretty old PR. I'm inclined to close it unless you want to revisit/rebase on main.

tylerbenson avatar Dec 14 '23 17:12 tylerbenson

@tylerbenson feel free to close it. I won't have time to check if the issue remains, and we don't use this code in prod now.

iximiuz avatar Dec 15 '23 16:12 iximiuz