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
[META 753] Support Partial Transaction for AWS Lambda #1734
Comments
For reference (sorry about the private link) https://elastic.slack.com/archives/C5M04AVJA/p1675266805397529 |
@lahsivjar I'm getting a 415 back from the Lambda Extension when I send the partial transaction. Any ideas? I don't see anything in the extension's debug logs -- it's just an uninterrupted sea of
|
@basepi you need to set |
Thanks @axw, that got me a little further. Now I'm successfully getting the transaction registered.....or at least I think I am, I don't think there's any logging for that. Still just a sea of However, when I put a sleep in the lambda function such that it times out, I'm not getting the partial transaction in Elasticsearch. I see this error in the logs: {
"log.level": "error",
"@timestamp": "2023-03-29T19:05:18.002Z",
"log.origin": {
"file.name": "app/run.go",
"file.line": 167
},
"message": "Error finalizing invocation on shutdown: metadata is not yet available",
"ecs.version": "1.6.0",
"log.origin.stack_trace": "github.com/elastic/apm-aws-lambda/app.(*App).processEvent.func1\n\tgithub.com/elastic/apm-aws-lambda/app/run.go:167\ngithub.com/elastic/apm-aws-lambda/app.(*App).processEvent\n\tgithub.com/elastic/apm-aws-lambda/app/run.go:234\ngithub.com/elastic/apm-aws-lambda/app.(*App).Run\n\tgithub.com/elastic/apm-aws-lambda/app/run.go:91\nmain.main\n\tgithub.com/elastic/apm-aws-lambda/main.go:71\nruntime.main\n\truntime/proc.go:250"
} In python, we don't use streaming connections. This means we send the metadata at the end of the invocation, when we flush everything at once. Is that what is causing this problem? I'm going to hack in a metadata send (by itself) and see if that changes anything. |
Alright, that seems to have worked. @lahsivjar How difficult would it be to support sending the metadata before or after the partial transaction, to the If that's difficult, I can add support to our transport to force a metadata send as part of the transport thread, even though we're not ready to flush anything else with it. Thoughts? This is my "working, but hacky" current solution: #1784 |
@basepi I think it should be quite easy and straightforward to accept partial transaction + metadata as a single payload to the register transaction endpoint. This will also help fix an existing issue. I was initially thinking it might be beneficial to have a separate flow for agents to report metadata as soon as it is available but doing it with registered transactions sounds more reasonable. @felixbarny @AlexanderWert WDYT? If this sounds reasonable I can put a quick PR to support metadata in the register transaction endpoint. |
@basepi Does it mean that the metadata at this point is not complete and when the agent starts sending actual data the metadata might be different? |
Metadata is always ready, but we don't send it until other data is available to send (and we hit either our time or size threshold). |
Again, this might be too Python-specific. Most other agents have streaming connections. I don't know if they open a connection immediately on startup, or just when they have data available, but since they're not waiting for size/time thresholds to send (like Python does) it likely won't be an issue in other agents. But if it solves your other issue, I'm all for it, it would be easier from my end to be able to send it to Anyway, I'm going to modify my solution to add the metadata directly after the transaction. Though I assume you'll make it order-agnostic, since they both start with either Please keep me posted if I need to change the |
The Node.js APM agent would be similar: it does not set metadata until there is other data to send. This means that if the first Lambda invocation hangs/timesout (such that there is no complete transaction to send), then the APM agent will not send metadata to the intake v2 -- it actually won't start an intake v2 request at all. In other words, it would help the Node.js APM agent as well to support sending the metadata via the |
@lahsivjar Can you link here when you have the PR against the extension? And can you confirm my questions above about |
I have created a PR here
|
Sounds fine 👍 I'll update my PR today and then I'll test when we get the next version of the extension released. |
See meta issue for the description and details:
The text was updated successfully, but these errors were encountered: